@xeokit/xeokit-sdk 2.3.4 → 2.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -81198,6 +81198,9 @@ class DistanceMeasurement extends Component {
81198
81198
  this.targetVisible = cfg.targetVisible;
81199
81199
  this.wireVisible = cfg.wireVisible;
81200
81200
  this.axisVisible = cfg.axisVisible;
81201
+ this.xAxisVisible = cfg.xAxisVisible;
81202
+ this.yAxisVisible = cfg.yAxisVisible;
81203
+ this.zAxisVisible = cfg.zAxisVisible;
81201
81204
  this.labelsVisible = cfg.labelsVisible;
81202
81205
  }
81203
81206
 
@@ -81363,9 +81366,11 @@ class DistanceMeasurement extends Component {
81363
81366
 
81364
81367
  this._originDot.setVisible(this._visible && this._originVisible);
81365
81368
  this._targetDot.setVisible(this._visible && this._targetVisible);
81366
- this._xAxisWire.setVisible(this.axisVisible);
81367
- this._yAxisWire.setVisible(this.axisVisible);
81368
- this._zAxisWire.setVisible(this.axisVisible);
81369
+
81370
+ this._xAxisWire.setVisible(this.axisVisible && this.xAxisVisible);
81371
+ this._yAxisWire.setVisible(this.axisVisible && this.yAxisVisible);
81372
+ this._zAxisWire.setVisible(this.axisVisible && this.zAxisVisible);
81373
+
81369
81374
  this._lengthWire.setVisible(this.wireVisible);
81370
81375
  this._lengthLabel.setCulled(!this.wireVisible);
81371
81376
 
@@ -81535,12 +81540,12 @@ class DistanceMeasurement extends Component {
81535
81540
  value = value !== undefined ? Boolean(value) : this.plugin.defaultAxisVisible;
81536
81541
  this._axisEnabled = value;
81537
81542
  var axisVisible = this._visible && this._axisVisible && this._axisEnabled;
81538
- this._xAxisWire.setVisible(axisVisible);
81539
- this._yAxisWire.setVisible(axisVisible);
81540
- this._zAxisWire.setVisible(axisVisible);
81541
- this._xAxisLabel.setVisible(axisVisible && !this._xAxisLabelCulled);
81542
- this._yAxisLabel.setVisible(axisVisible && !this._yAxisLabelCulled);
81543
- this._zAxisLabel.setVisible(axisVisible && !this._zAxisLabelCulled);
81543
+ this._xAxisWire.setVisible(axisVisible && this._xAxisVisible);
81544
+ this._yAxisWire.setVisible(axisVisible && this._yAxisVisible);
81545
+ this._zAxisWire.setVisible(axisVisible && this._zAxisVisible);
81546
+ this._xAxisLabel.setVisible(axisVisible && !this._xAxisLabelCulled&& this._xAxisVisible);
81547
+ this._yAxisLabel.setVisible(axisVisible && !this._yAxisLabelCulled&& this._xAxisVisible);
81548
+ this._zAxisLabel.setVisible(axisVisible && !this._zAxisLabelCulled&& this._xAxisVisible);
81544
81549
  this._cpDirty = true;
81545
81550
  this._needUpdate();
81546
81551
  }
@@ -81567,12 +81572,12 @@ class DistanceMeasurement extends Component {
81567
81572
  value = value !== undefined ? Boolean(value) : this.plugin.defaultAxisVisible;
81568
81573
  this._axisVisible = value;
81569
81574
  var axisVisible = this._visible && this._axisVisible && this._axisEnabled;
81570
- this._xAxisWire.setVisible(axisVisible);
81571
- this._yAxisWire.setVisible(axisVisible);
81572
- this._zAxisWire.setVisible(axisVisible);
81573
- this._xAxisLabel.setVisible(axisVisible && !this._xAxisLabelCulled);
81574
- this._yAxisLabel.setVisible(axisVisible && !this._yAxisLabelCulled);
81575
- this._zAxisLabel.setVisible(axisVisible && !this._zAxisLabelCulled);
81575
+ this._xAxisWire.setVisible(axisVisible && this._xAxisVisible);
81576
+ this._yAxisWire.setVisible(axisVisible && this._yAxisVisible);
81577
+ this._zAxisWire.setVisible(axisVisible && this._zAxisVisible);
81578
+ this._xAxisLabel.setVisible(axisVisible && !this._xAxisLabelCulled&& this._xAxisVisible);
81579
+ this._yAxisLabel.setVisible(axisVisible && !this._yAxisLabelCulled&& this._yAxisVisible);
81580
+ this._zAxisLabel.setVisible(axisVisible && !this._zAxisLabelCulled&& this._zAxisVisible);
81576
81581
  this._cpDirty = true;
81577
81582
  this._needUpdate();
81578
81583
  }
@@ -96433,9 +96438,9 @@ class GLTFVBOSceneModelLoader {
96433
96438
  });
96434
96439
  }
96435
96440
 
96436
- parse(plugin, gltf, metaModelJSON, options, sceneModel, ok, error) {
96441
+ parse(plugin, gltf, metaModelJSON, options, sceneModel, ok, error) {
96437
96442
  options = options || {};
96438
- parseGLTF(plugin, "", gltf, metaModelJSON, options, sceneModel, function () {
96443
+ parseGLTF(plugin, "", gltf, metaModelJSON, options, sceneModel, function () {
96439
96444
  sceneModel.scene.fire("modelLoaded", sceneModel.id); // FIXME: Assumes listeners know order of these two events
96440
96445
  sceneModel.fire("loaded", true, false);
96441
96446
  if (ok) {
@@ -96479,14 +96484,14 @@ function getMetaModelCorrections(metaModelJSON) {
96479
96484
  };
96480
96485
  }
96481
96486
 
96482
- function loadGLTF(plugin, src, metaModelJSON, options, sceneModel, ok, error) {
96487
+ function loadGLTF(plugin, src, metaModelJSON, options, sceneModel, ok, error) {
96483
96488
  const spinner = plugin.viewer.scene.canvas.spinner;
96484
96489
  spinner.processes++;
96485
96490
  const isGLB = (src.split('.').pop() === "glb");
96486
96491
  if (isGLB) {
96487
96492
  plugin.dataSource.getGLB(src, (arrayBuffer) => { // OK
96488
96493
  options.basePath = getBasePath(src);
96489
- parseGLTF(plugin, src, arrayBuffer, metaModelJSON, options, sceneModel, ok);
96494
+ parseGLTF(plugin, src, arrayBuffer, metaModelJSON, options, sceneModel, ok);
96490
96495
  spinner.processes--;
96491
96496
  },
96492
96497
  (err) => {
@@ -96496,7 +96501,7 @@ function loadGLTF(plugin, src, metaModelJSON, options, sceneModel, ok, error) {
96496
96501
  } else {
96497
96502
  plugin.dataSource.getGLTF(src, (gltf) => { // OK
96498
96503
  options.basePath = getBasePath(src);
96499
- parseGLTF(plugin, src, gltf, metaModelJSON, options, sceneModel, ok);
96504
+ parseGLTF(plugin, src, gltf, metaModelJSON, options, sceneModel, ok);
96500
96505
  spinner.processes--;
96501
96506
  },
96502
96507
  (err) => {
@@ -96511,7 +96516,7 @@ function getBasePath(src) {
96511
96516
  return (i !== 0) ? src.substring(0, i + 1) : "";
96512
96517
  }
96513
96518
 
96514
- function parseGLTF(plugin, src, gltf, metaModelJSON, options, sceneModel, ok) {
96519
+ function parseGLTF(plugin, src, gltf, metaModelJSON, options, sceneModel, ok) {
96515
96520
  const spinner = plugin.viewer.scene.canvas.spinner;
96516
96521
  spinner.processes++;
96517
96522
  parse$3(gltf, GLTFLoader, {
@@ -96530,7 +96535,10 @@ function parseGLTF(plugin, src, gltf, metaModelJSON, options, sceneModel, ok) {
96530
96535
  //geometryCreated: {},
96531
96536
  numObjects: 0,
96532
96537
  nodes: [],
96533
- nextId: 0
96538
+ nextId: 0,
96539
+ log: (msg) => {
96540
+ plugin.log(msg);
96541
+ }
96534
96542
  };
96535
96543
  loadTextures(ctx);
96536
96544
  loadMaterials(ctx);
@@ -81194,6 +81194,9 @@ class DistanceMeasurement extends Component {
81194
81194
  this.targetVisible = cfg.targetVisible;
81195
81195
  this.wireVisible = cfg.wireVisible;
81196
81196
  this.axisVisible = cfg.axisVisible;
81197
+ this.xAxisVisible = cfg.xAxisVisible;
81198
+ this.yAxisVisible = cfg.yAxisVisible;
81199
+ this.zAxisVisible = cfg.zAxisVisible;
81197
81200
  this.labelsVisible = cfg.labelsVisible;
81198
81201
  }
81199
81202
 
@@ -81359,9 +81362,11 @@ class DistanceMeasurement extends Component {
81359
81362
 
81360
81363
  this._originDot.setVisible(this._visible && this._originVisible);
81361
81364
  this._targetDot.setVisible(this._visible && this._targetVisible);
81362
- this._xAxisWire.setVisible(this.axisVisible);
81363
- this._yAxisWire.setVisible(this.axisVisible);
81364
- this._zAxisWire.setVisible(this.axisVisible);
81365
+
81366
+ this._xAxisWire.setVisible(this.axisVisible && this.xAxisVisible);
81367
+ this._yAxisWire.setVisible(this.axisVisible && this.yAxisVisible);
81368
+ this._zAxisWire.setVisible(this.axisVisible && this.zAxisVisible);
81369
+
81365
81370
  this._lengthWire.setVisible(this.wireVisible);
81366
81371
  this._lengthLabel.setCulled(!this.wireVisible);
81367
81372
 
@@ -81531,12 +81536,12 @@ class DistanceMeasurement extends Component {
81531
81536
  value = value !== undefined ? Boolean(value) : this.plugin.defaultAxisVisible;
81532
81537
  this._axisEnabled = value;
81533
81538
  var axisVisible = this._visible && this._axisVisible && this._axisEnabled;
81534
- this._xAxisWire.setVisible(axisVisible);
81535
- this._yAxisWire.setVisible(axisVisible);
81536
- this._zAxisWire.setVisible(axisVisible);
81537
- this._xAxisLabel.setVisible(axisVisible && !this._xAxisLabelCulled);
81538
- this._yAxisLabel.setVisible(axisVisible && !this._yAxisLabelCulled);
81539
- this._zAxisLabel.setVisible(axisVisible && !this._zAxisLabelCulled);
81539
+ this._xAxisWire.setVisible(axisVisible && this._xAxisVisible);
81540
+ this._yAxisWire.setVisible(axisVisible && this._yAxisVisible);
81541
+ this._zAxisWire.setVisible(axisVisible && this._zAxisVisible);
81542
+ this._xAxisLabel.setVisible(axisVisible && !this._xAxisLabelCulled&& this._xAxisVisible);
81543
+ this._yAxisLabel.setVisible(axisVisible && !this._yAxisLabelCulled&& this._xAxisVisible);
81544
+ this._zAxisLabel.setVisible(axisVisible && !this._zAxisLabelCulled&& this._xAxisVisible);
81540
81545
  this._cpDirty = true;
81541
81546
  this._needUpdate();
81542
81547
  }
@@ -81563,12 +81568,12 @@ class DistanceMeasurement extends Component {
81563
81568
  value = value !== undefined ? Boolean(value) : this.plugin.defaultAxisVisible;
81564
81569
  this._axisVisible = value;
81565
81570
  var axisVisible = this._visible && this._axisVisible && this._axisEnabled;
81566
- this._xAxisWire.setVisible(axisVisible);
81567
- this._yAxisWire.setVisible(axisVisible);
81568
- this._zAxisWire.setVisible(axisVisible);
81569
- this._xAxisLabel.setVisible(axisVisible && !this._xAxisLabelCulled);
81570
- this._yAxisLabel.setVisible(axisVisible && !this._yAxisLabelCulled);
81571
- this._zAxisLabel.setVisible(axisVisible && !this._zAxisLabelCulled);
81571
+ this._xAxisWire.setVisible(axisVisible && this._xAxisVisible);
81572
+ this._yAxisWire.setVisible(axisVisible && this._yAxisVisible);
81573
+ this._zAxisWire.setVisible(axisVisible && this._zAxisVisible);
81574
+ this._xAxisLabel.setVisible(axisVisible && !this._xAxisLabelCulled&& this._xAxisVisible);
81575
+ this._yAxisLabel.setVisible(axisVisible && !this._yAxisLabelCulled&& this._yAxisVisible);
81576
+ this._zAxisLabel.setVisible(axisVisible && !this._zAxisLabelCulled&& this._zAxisVisible);
81572
81577
  this._cpDirty = true;
81573
81578
  this._needUpdate();
81574
81579
  }
@@ -96429,9 +96434,9 @@ class GLTFVBOSceneModelLoader {
96429
96434
  });
96430
96435
  }
96431
96436
 
96432
- parse(plugin, gltf, metaModelJSON, options, sceneModel, ok, error) {
96437
+ parse(plugin, gltf, metaModelJSON, options, sceneModel, ok, error) {
96433
96438
  options = options || {};
96434
- parseGLTF(plugin, "", gltf, metaModelJSON, options, sceneModel, function () {
96439
+ parseGLTF(plugin, "", gltf, metaModelJSON, options, sceneModel, function () {
96435
96440
  sceneModel.scene.fire("modelLoaded", sceneModel.id); // FIXME: Assumes listeners know order of these two events
96436
96441
  sceneModel.fire("loaded", true, false);
96437
96442
  if (ok) {
@@ -96475,14 +96480,14 @@ function getMetaModelCorrections(metaModelJSON) {
96475
96480
  };
96476
96481
  }
96477
96482
 
96478
- function loadGLTF(plugin, src, metaModelJSON, options, sceneModel, ok, error) {
96483
+ function loadGLTF(plugin, src, metaModelJSON, options, sceneModel, ok, error) {
96479
96484
  const spinner = plugin.viewer.scene.canvas.spinner;
96480
96485
  spinner.processes++;
96481
96486
  const isGLB = (src.split('.').pop() === "glb");
96482
96487
  if (isGLB) {
96483
96488
  plugin.dataSource.getGLB(src, (arrayBuffer) => { // OK
96484
96489
  options.basePath = getBasePath(src);
96485
- parseGLTF(plugin, src, arrayBuffer, metaModelJSON, options, sceneModel, ok);
96490
+ parseGLTF(plugin, src, arrayBuffer, metaModelJSON, options, sceneModel, ok);
96486
96491
  spinner.processes--;
96487
96492
  },
96488
96493
  (err) => {
@@ -96492,7 +96497,7 @@ function loadGLTF(plugin, src, metaModelJSON, options, sceneModel, ok, error) {
96492
96497
  } else {
96493
96498
  plugin.dataSource.getGLTF(src, (gltf) => { // OK
96494
96499
  options.basePath = getBasePath(src);
96495
- parseGLTF(plugin, src, gltf, metaModelJSON, options, sceneModel, ok);
96500
+ parseGLTF(plugin, src, gltf, metaModelJSON, options, sceneModel, ok);
96496
96501
  spinner.processes--;
96497
96502
  },
96498
96503
  (err) => {
@@ -96507,7 +96512,7 @@ function getBasePath(src) {
96507
96512
  return (i !== 0) ? src.substring(0, i + 1) : "";
96508
96513
  }
96509
96514
 
96510
- function parseGLTF(plugin, src, gltf, metaModelJSON, options, sceneModel, ok) {
96515
+ function parseGLTF(plugin, src, gltf, metaModelJSON, options, sceneModel, ok) {
96511
96516
  const spinner = plugin.viewer.scene.canvas.spinner;
96512
96517
  spinner.processes++;
96513
96518
  parse$3(gltf, GLTFLoader, {
@@ -96526,7 +96531,10 @@ function parseGLTF(plugin, src, gltf, metaModelJSON, options, sceneModel, ok) {
96526
96531
  //geometryCreated: {},
96527
96532
  numObjects: 0,
96528
96533
  nodes: [],
96529
- nextId: 0
96534
+ nextId: 0,
96535
+ log: (msg) => {
96536
+ plugin.log(msg);
96537
+ }
96530
96538
  };
96531
96539
  loadTextures(ctx);
96532
96540
  loadMaterials(ctx);
@@ -19038,7 +19038,7 @@ origin:eye,direction:look});look=hit?hit.worldPos:math.addVec3(eye,look,tempVec3
19038
19038
  });_this85._targetMarker.on("worldPos",function(value){_this85._targetWorld.set(value||[0,0,0]);_this85._wpDirty=true;_this85._needUpdate(0);// No lag
19039
19039
  });_this85._onViewMatrix=scene.camera.on("viewMatrix",function(){_this85._vpDirty=true;_this85._needUpdate(0);// No lag
19040
19040
  });_this85._onProjMatrix=scene.camera.on("projMatrix",function(){_this85._cpDirty=true;_this85._needUpdate();});_this85._onCanvasBoundary=scene.canvas.on("boundary",function(){_this85._cpDirty=true;_this85._needUpdate(0);// No lag
19041
- });_this85._onMetricsUnits=scene.metrics.on("units",function(){_this85._cpDirty=true;_this85._needUpdate();});_this85._onMetricsScale=scene.metrics.on("scale",function(){_this85._cpDirty=true;_this85._needUpdate();});_this85._onMetricsOrigin=scene.metrics.on("origin",function(){_this85._cpDirty=true;_this85._needUpdate();});_this85.approximate=cfg.approximate;_this85.visible=cfg.visible;_this85.originVisible=cfg.originVisible;_this85.targetVisible=cfg.targetVisible;_this85.wireVisible=cfg.wireVisible;_this85.axisVisible=cfg.axisVisible;_this85.labelsVisible=cfg.labelsVisible;return _this85;}_createClass(DistanceMeasurement,[{key:"_update",value:function _update(){if(!this._visible){return;}var scene=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.0;this._wp[4]=this._targetWorld[0];this._wp[5]=this._originWorld[1];this._wp[6]=this._originWorld[2];this._wp[7]=1.0;this._wp[8]=this._targetWorld[0];this._wp[9]=this._targetWorld[1];this._wp[10]=this._originWorld[2];this._wp[11]=1.0;this._wp[12]=this._targetWorld[0];this._wp[13]=this._targetWorld[1];this._wp[14]=this._targetWorld[2];this._wp[15]=1.0;this._wpDirty=false;this._vpDirty=true;}if(this._vpDirty){math.transformPositions4(scene.camera.viewMatrix,this._wp,this._vp);this._vp[3]=1.0;this._vp[7]=1.0;this._vp[11]=1.0;this._vp[15]=1.0;this._vpDirty=false;this._cpDirty=true;}var near=-0.3;var vpz1=this._originMarker.viewPos[2];var vpz2=this._targetMarker.viewPos[2];if(vpz1>near||vpz2>near){this._xAxisLabel.setVisible(false);this._yAxisLabel.setVisible(false);this._zAxisLabel.setVisible(false);this._lengthLabel.setVisible(false);this._xAxisWire.setVisible(false);this._yAxisWire.setVisible(false);this._zAxisWire.setVisible(false);this._lengthWire.setVisible(false);this._originDot.setVisible(false);this._targetDot.setVisible(false);return;}if(this._cpDirty){math.transformPositions4(scene.camera.project.matrix,this._vp,this._pp);var pp=this._pp;var cp=this._cp;var canvas=scene.canvas.canvas;var offsets=canvas.getBoundingClientRect();var containerOffsets=this._container.getBoundingClientRect();var top=offsets.top-containerOffsets.top;var left=offsets.left-containerOffsets.left;var aabb=scene.canvas.boundary;var canvasWidth=aabb[2];var canvasHeight=aabb[3];var j=0;var metrics=this.plugin.viewer.scene.metrics;var _scale3=metrics.scale;var units=metrics.units;var unitInfo=metrics.unitsInfo[units];var unitAbbrev=unitInfo.abbrev;for(var i=0,len=pp.length;i<len;i+=4){cp[j]=left+Math.floor((1+pp[i+0]/pp[i+3])*canvasWidth/2);cp[j+1]=top+Math.floor((1-pp[i+1]/pp[i+3])*canvasHeight/2);j+=2;}this._originDot.setPos(cp[0],cp[1]);this._targetDot.setPos(cp[6],cp[7]);this._lengthWire.setStartAndEnd(cp[0],cp[1],cp[6],cp[7]);this._xAxisWire.setStartAndEnd(cp[0],cp[1],cp[2],cp[3]);this._yAxisWire.setStartAndEnd(cp[2],cp[3],cp[4],cp[5]);this._zAxisWire.setStartAndEnd(cp[4],cp[5],cp[6],cp[7]);if(!this.labelsVisible){this._lengthLabel.setCulled(true);this._xAxisLabel.setCulled(true);this._yAxisLabel.setCulled(true);this._zAxisLabel.setCulled(true);}else{this._lengthLabel.setPosOnWire(cp[0],cp[1],cp[6],cp[7]);this._xAxisLabel.setPosOnWire(cp[0],cp[1],cp[2],cp[3]);this._yAxisLabel.setPosOnWire(cp[2],cp[3],cp[4],cp[5]);this._zAxisLabel.setPosOnWire(cp[4],cp[5],cp[6],cp[7]);var tilde=this._approximate?" ~ ":" = ";this._length=Math.abs(math.lenVec3(math.subVec3(this._targetWorld,this._originWorld,distVec3)));this._lengthLabel.setText(tilde+(this._length*_scale3).toFixed(2)+unitAbbrev);var xAxisCanvasLength=Math.abs(lengthWire(cp[0],cp[1],cp[2],cp[3]));var yAxisCanvasLength=Math.abs(lengthWire(cp[2],cp[3],cp[4],cp[5]));var zAxisCanvasLength=Math.abs(lengthWire(cp[4],cp[5],cp[6],cp[7]));var labelMinAxisLength=this.plugin.labelMinAxisLength;this._xAxisLabelCulled=xAxisCanvasLength<labelMinAxisLength;this._yAxisLabelCulled=yAxisCanvasLength<labelMinAxisLength;this._zAxisLabelCulled=zAxisCanvasLength<labelMinAxisLength;if(!this._xAxisLabelCulled){this._xAxisLabel.setText(tilde+Math.abs((this._targetWorld[0]-this._originWorld[0])*_scale3).toFixed(2)+unitAbbrev);this._xAxisLabel.setCulled(!this.axisVisible);}else{this._xAxisLabel.setCulled(true);}if(!this._yAxisLabelCulled){this._yAxisLabel.setText(tilde+Math.abs((this._targetWorld[1]-this._originWorld[1])*_scale3).toFixed(2)+unitAbbrev);this._yAxisLabel.setCulled(!this.axisVisible);}else{this._yAxisLabel.setCulled(true);}if(!this._zAxisLabelCulled){this._zAxisLabel.setText(tilde+Math.abs((this._targetWorld[2]-this._originWorld[2])*_scale3).toFixed(2)+unitAbbrev);this._zAxisLabel.setCulled(!this.axisVisible);}else{this._zAxisLabel.setCulled(true);}}this._originDot.setVisible(this._visible&&this._originVisible);this._targetDot.setVisible(this._visible&&this._targetVisible);this._xAxisWire.setVisible(this.axisVisible);this._yAxisWire.setVisible(this.axisVisible);this._zAxisWire.setVisible(this.axisVisible);this._lengthWire.setVisible(this.wireVisible);this._lengthLabel.setCulled(!this.wireVisible);this._cpDirty=false;}}/**
19041
+ });_this85._onMetricsUnits=scene.metrics.on("units",function(){_this85._cpDirty=true;_this85._needUpdate();});_this85._onMetricsScale=scene.metrics.on("scale",function(){_this85._cpDirty=true;_this85._needUpdate();});_this85._onMetricsOrigin=scene.metrics.on("origin",function(){_this85._cpDirty=true;_this85._needUpdate();});_this85.approximate=cfg.approximate;_this85.visible=cfg.visible;_this85.originVisible=cfg.originVisible;_this85.targetVisible=cfg.targetVisible;_this85.wireVisible=cfg.wireVisible;_this85.axisVisible=cfg.axisVisible;_this85.xAxisVisible=cfg.xAxisVisible;_this85.yAxisVisible=cfg.yAxisVisible;_this85.zAxisVisible=cfg.zAxisVisible;_this85.labelsVisible=cfg.labelsVisible;return _this85;}_createClass(DistanceMeasurement,[{key:"_update",value:function _update(){if(!this._visible){return;}var scene=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.0;this._wp[4]=this._targetWorld[0];this._wp[5]=this._originWorld[1];this._wp[6]=this._originWorld[2];this._wp[7]=1.0;this._wp[8]=this._targetWorld[0];this._wp[9]=this._targetWorld[1];this._wp[10]=this._originWorld[2];this._wp[11]=1.0;this._wp[12]=this._targetWorld[0];this._wp[13]=this._targetWorld[1];this._wp[14]=this._targetWorld[2];this._wp[15]=1.0;this._wpDirty=false;this._vpDirty=true;}if(this._vpDirty){math.transformPositions4(scene.camera.viewMatrix,this._wp,this._vp);this._vp[3]=1.0;this._vp[7]=1.0;this._vp[11]=1.0;this._vp[15]=1.0;this._vpDirty=false;this._cpDirty=true;}var near=-0.3;var vpz1=this._originMarker.viewPos[2];var vpz2=this._targetMarker.viewPos[2];if(vpz1>near||vpz2>near){this._xAxisLabel.setVisible(false);this._yAxisLabel.setVisible(false);this._zAxisLabel.setVisible(false);this._lengthLabel.setVisible(false);this._xAxisWire.setVisible(false);this._yAxisWire.setVisible(false);this._zAxisWire.setVisible(false);this._lengthWire.setVisible(false);this._originDot.setVisible(false);this._targetDot.setVisible(false);return;}if(this._cpDirty){math.transformPositions4(scene.camera.project.matrix,this._vp,this._pp);var pp=this._pp;var cp=this._cp;var canvas=scene.canvas.canvas;var offsets=canvas.getBoundingClientRect();var containerOffsets=this._container.getBoundingClientRect();var top=offsets.top-containerOffsets.top;var left=offsets.left-containerOffsets.left;var aabb=scene.canvas.boundary;var canvasWidth=aabb[2];var canvasHeight=aabb[3];var j=0;var metrics=this.plugin.viewer.scene.metrics;var _scale3=metrics.scale;var units=metrics.units;var unitInfo=metrics.unitsInfo[units];var unitAbbrev=unitInfo.abbrev;for(var i=0,len=pp.length;i<len;i+=4){cp[j]=left+Math.floor((1+pp[i+0]/pp[i+3])*canvasWidth/2);cp[j+1]=top+Math.floor((1-pp[i+1]/pp[i+3])*canvasHeight/2);j+=2;}this._originDot.setPos(cp[0],cp[1]);this._targetDot.setPos(cp[6],cp[7]);this._lengthWire.setStartAndEnd(cp[0],cp[1],cp[6],cp[7]);this._xAxisWire.setStartAndEnd(cp[0],cp[1],cp[2],cp[3]);this._yAxisWire.setStartAndEnd(cp[2],cp[3],cp[4],cp[5]);this._zAxisWire.setStartAndEnd(cp[4],cp[5],cp[6],cp[7]);if(!this.labelsVisible){this._lengthLabel.setCulled(true);this._xAxisLabel.setCulled(true);this._yAxisLabel.setCulled(true);this._zAxisLabel.setCulled(true);}else{this._lengthLabel.setPosOnWire(cp[0],cp[1],cp[6],cp[7]);this._xAxisLabel.setPosOnWire(cp[0],cp[1],cp[2],cp[3]);this._yAxisLabel.setPosOnWire(cp[2],cp[3],cp[4],cp[5]);this._zAxisLabel.setPosOnWire(cp[4],cp[5],cp[6],cp[7]);var tilde=this._approximate?" ~ ":" = ";this._length=Math.abs(math.lenVec3(math.subVec3(this._targetWorld,this._originWorld,distVec3)));this._lengthLabel.setText(tilde+(this._length*_scale3).toFixed(2)+unitAbbrev);var xAxisCanvasLength=Math.abs(lengthWire(cp[0],cp[1],cp[2],cp[3]));var yAxisCanvasLength=Math.abs(lengthWire(cp[2],cp[3],cp[4],cp[5]));var zAxisCanvasLength=Math.abs(lengthWire(cp[4],cp[5],cp[6],cp[7]));var labelMinAxisLength=this.plugin.labelMinAxisLength;this._xAxisLabelCulled=xAxisCanvasLength<labelMinAxisLength;this._yAxisLabelCulled=yAxisCanvasLength<labelMinAxisLength;this._zAxisLabelCulled=zAxisCanvasLength<labelMinAxisLength;if(!this._xAxisLabelCulled){this._xAxisLabel.setText(tilde+Math.abs((this._targetWorld[0]-this._originWorld[0])*_scale3).toFixed(2)+unitAbbrev);this._xAxisLabel.setCulled(!this.axisVisible);}else{this._xAxisLabel.setCulled(true);}if(!this._yAxisLabelCulled){this._yAxisLabel.setText(tilde+Math.abs((this._targetWorld[1]-this._originWorld[1])*_scale3).toFixed(2)+unitAbbrev);this._yAxisLabel.setCulled(!this.axisVisible);}else{this._yAxisLabel.setCulled(true);}if(!this._zAxisLabelCulled){this._zAxisLabel.setText(tilde+Math.abs((this._targetWorld[2]-this._originWorld[2])*_scale3).toFixed(2)+unitAbbrev);this._zAxisLabel.setCulled(!this.axisVisible);}else{this._zAxisLabel.setCulled(true);}}this._originDot.setVisible(this._visible&&this._originVisible);this._targetDot.setVisible(this._visible&&this._targetVisible);this._xAxisWire.setVisible(this.axisVisible&&this.xAxisVisible);this._yAxisWire.setVisible(this.axisVisible&&this.yAxisVisible);this._zAxisWire.setVisible(this.axisVisible&&this.zAxisVisible);this._lengthWire.setVisible(this.wireVisible);this._lengthLabel.setCulled(!this.wireVisible);this._cpDirty=false;}}/**
19042
19042
  * Sets whether this DistanceMeasurement indicates that its measurement is approximate.
19043
19043
  *
19044
19044
  * This is ````true```` by default.
@@ -19104,7 +19104,7 @@ origin:eye,direction:look});look=hit?hit.worldPos:math.addVec3(eye,look,tempVec3
19104
19104
  * Wires are only shown if enabled and visible.
19105
19105
  *
19106
19106
  * @type {Boolean}
19107
- */,set:function set(value){value=value!==undefined?Boolean(value):this.plugin.defaultAxisVisible;this._axisEnabled=value;var axisVisible=this._visible&&this._axisVisible&&this._axisEnabled;this._xAxisWire.setVisible(axisVisible);this._yAxisWire.setVisible(axisVisible);this._zAxisWire.setVisible(axisVisible);this._xAxisLabel.setVisible(axisVisible&&!this._xAxisLabelCulled);this._yAxisLabel.setVisible(axisVisible&&!this._yAxisLabelCulled);this._zAxisLabel.setVisible(axisVisible&&!this._zAxisLabelCulled);this._cpDirty=true;this._needUpdate();}},{key:"axisVisible",get:/**
19107
+ */,set:function set(value){value=value!==undefined?Boolean(value):this.plugin.defaultAxisVisible;this._axisEnabled=value;var axisVisible=this._visible&&this._axisVisible&&this._axisEnabled;this._xAxisWire.setVisible(axisVisible&&this._xAxisVisible);this._yAxisWire.setVisible(axisVisible&&this._yAxisVisible);this._zAxisWire.setVisible(axisVisible&&this._zAxisVisible);this._xAxisLabel.setVisible(axisVisible&&!this._xAxisLabelCulled&&this._xAxisVisible);this._yAxisLabel.setVisible(axisVisible&&!this._yAxisLabelCulled&&this._xAxisVisible);this._zAxisLabel.setVisible(axisVisible&&!this._zAxisLabelCulled&&this._xAxisVisible);this._cpDirty=true;this._needUpdate();}},{key:"axisVisible",get:/**
19108
19108
  * Gets if the axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target} are visible.
19109
19109
  *
19110
19110
  * Wires are only shown if enabled and visible.
@@ -19116,7 +19116,7 @@ origin:eye,direction:look});look=hit?hit.worldPos:math.addVec3(eye,look,tempVec3
19116
19116
  * Wires are only shown if enabled and visible.
19117
19117
  *
19118
19118
  * @type {Boolean}
19119
- */,set:function set(value){value=value!==undefined?Boolean(value):this.plugin.defaultAxisVisible;this._axisVisible=value;var axisVisible=this._visible&&this._axisVisible&&this._axisEnabled;this._xAxisWire.setVisible(axisVisible);this._yAxisWire.setVisible(axisVisible);this._zAxisWire.setVisible(axisVisible);this._xAxisLabel.setVisible(axisVisible&&!this._xAxisLabelCulled);this._yAxisLabel.setVisible(axisVisible&&!this._yAxisLabelCulled);this._zAxisLabel.setVisible(axisVisible&&!this._zAxisLabelCulled);this._cpDirty=true;this._needUpdate();}},{key:"xAxisVisible",get:/**
19119
+ */,set:function set(value){value=value!==undefined?Boolean(value):this.plugin.defaultAxisVisible;this._axisVisible=value;var axisVisible=this._visible&&this._axisVisible&&this._axisEnabled;this._xAxisWire.setVisible(axisVisible&&this._xAxisVisible);this._yAxisWire.setVisible(axisVisible&&this._yAxisVisible);this._zAxisWire.setVisible(axisVisible&&this._zAxisVisible);this._xAxisLabel.setVisible(axisVisible&&!this._xAxisLabelCulled&&this._xAxisVisible);this._yAxisLabel.setVisible(axisVisible&&!this._yAxisLabelCulled&&this._yAxisVisible);this._zAxisLabel.setVisible(axisVisible&&!this._zAxisLabelCulled&&this._zAxisVisible);this._cpDirty=true;this._needUpdate();}},{key:"xAxisVisible",get:/**
19120
19120
  * Gets if the X-axis-aligned wires between {@link DistanceMeasurement#origin} and {@link DistanceMeasurement#target} are visible.
19121
19121
  *
19122
19122
  * Wires are only shown if enabled and visible.
@@ -21829,7 +21829,7 @@ sceneModel.fire("loaded",true,false);});if(ok){ok();}},function(msg){plugin.erro
21829
21829
  sceneModel.fire("loaded",true,false);if(ok){ok();}});}}]);return GLTFVBOSceneModelLoader;}();function getMetaModelCorrections(metaModelJSON){var eachRootStats={};var eachChildRoot={};var metaObjects=metaModelJSON.metaObjects||[];var metaObjectsMap={};for(var _i425=0,len=metaObjects.length;_i425<len;_i425++){var metaObject=metaObjects[_i425];metaObjectsMap[metaObject.id]=metaObject;}for(var _i426=0,_len96=metaObjects.length;_i426<_len96;_i426++){var _metaObject4=metaObjects[_i426];if(_metaObject4.parent!==undefined&&_metaObject4.parent!==null){var metaObjectParent=metaObjectsMap[_metaObject4.parent];if(_metaObject4.type===metaObjectParent.type){var rootMetaObject=metaObjectParent;while(rootMetaObject.parent&&metaObjectsMap[rootMetaObject.parent].type===rootMetaObject.type){rootMetaObject=metaObjectsMap[rootMetaObject.parent];}var rootStats=eachRootStats[rootMetaObject.id]||(eachRootStats[rootMetaObject.id]={numChildren:0,countChildren:0});rootStats.numChildren++;eachChildRoot[_metaObject4.id]=rootMetaObject;}}}return{metaObjectsMap:metaObjectsMap,eachRootStats:eachRootStats,eachChildRoot:eachChildRoot};}function loadGLTF(plugin,src,metaModelJSON,options,sceneModel,ok,error){var spinner=plugin.viewer.scene.canvas.spinner;spinner.processes++;var isGLB=src.split('.').pop()==="glb";if(isGLB){plugin.dataSource.getGLB(src,function(arrayBuffer){// OK
21830
21830
  options.basePath=getBasePath(src);parseGLTF(plugin,src,arrayBuffer,metaModelJSON,options,sceneModel,ok);spinner.processes--;},function(err){spinner.processes--;error(err);});}else{plugin.dataSource.getGLTF(src,function(gltf){// OK
21831
21831
  options.basePath=getBasePath(src);parseGLTF(plugin,src,gltf,metaModelJSON,options,sceneModel,ok);spinner.processes--;},function(err){spinner.processes--;error(err);});}}function getBasePath(src){var i=src.lastIndexOf("/");return i!==0?src.substring(0,i+1):"";}function parseGLTF(plugin,src,gltf,metaModelJSON,options,sceneModel,ok){var spinner=plugin.viewer.scene.canvas.spinner;spinner.processes++;parse$3(gltf,GLTFLoader,{baseUri:options.basePath}).then(function(gltfData){var ctx={src:src,metaModelCorrections:metaModelJSON?getMetaModelCorrections(metaModelJSON):null,loadBuffer:options.loadBuffer,basePath:options.basePath,handlenode:options.handlenode,gltfData:gltfData,scene:sceneModel.scene,plugin:plugin,sceneModel:sceneModel,//geometryCreated: {},
21832
- numObjects:0,nodes:[],nextId:0};loadTextures(ctx);loadMaterials(ctx);loadDefaultScene(ctx);sceneModel.finalize();spinner.processes--;ok();});}function loadTextures(ctx){var gltfData=ctx.gltfData;var textures=gltfData.textures;if(textures){for(var _i427=0,len=textures.length;_i427<len;_i427++){loadTexture(ctx,textures[_i427]);}}}function loadTexture(ctx,texture){if(!texture.source||!texture.source.image){return;}var textureId="texture-".concat(ctx.nextId++);var minFilter=NearestMipMapLinearFilter;switch(texture.sampler.minFilter){case 9728:minFilter=NearestFilter;break;case 9729:minFilter=LinearFilter;break;case 9984:minFilter=NearestMipMapNearestFilter;break;case 9985:minFilter=LinearMipMapNearestFilter;break;case 9986:minFilter=NearestMipMapLinearFilter;break;case 9987:minFilter=LinearMipMapLinearFilter;break;}var magFilter=LinearFilter;switch(texture.sampler.magFilter){case 9728:magFilter=NearestFilter;break;case 9729:magFilter=LinearFilter;break;}var wrapS=RepeatWrapping;switch(texture.sampler.wrapS){case 33071:wrapS=ClampToEdgeWrapping;break;case 33648:wrapS=MirroredRepeatWrapping;break;case 10497:wrapS=RepeatWrapping;break;}var wrapT=RepeatWrapping;switch(texture.sampler.wrapT){case 33071:wrapT=ClampToEdgeWrapping;break;case 33648:wrapT=MirroredRepeatWrapping;break;case 10497:wrapT=RepeatWrapping;break;}var wrapR=RepeatWrapping;switch(texture.sampler.wrapR){case 33071:wrapR=ClampToEdgeWrapping;break;case 33648:wrapR=MirroredRepeatWrapping;break;case 10497:wrapR=RepeatWrapping;break;}ctx.sceneModel.createTexture({id:textureId,image:texture.source.image,flipY:!!texture.flipY,minFilter:minFilter,magFilter:magFilter,wrapS:wrapS,wrapT:wrapT,wrapR:wrapR,encoding:sRGBEncoding});texture._textureId=textureId;}function loadMaterials(ctx){var gltfData=ctx.gltfData;var materials=gltfData.materials;if(materials){for(var _i428=0,len=materials.length;_i428<len;_i428++){var material=materials[_i428];material._textureSetId=loadTextureSet(ctx,material);material._attributes=loadMaterialAttributes(ctx,material);}}}function loadTextureSet(ctx,material){var textureSetCfg={};if(material.normalTexture){textureSetCfg.normalTextureId=material.normalTexture.texture._textureId;}if(material.occlusionTexture){textureSetCfg.occlusionTextureId=material.occlusionTexture.texture._textureId;}if(material.emissiveTexture){textureSetCfg.emissiveTextureId=material.emissiveTexture.texture._textureId;}// const alphaMode = material.alphaMode;
21832
+ numObjects:0,nodes:[],nextId:0,log:function log(msg){plugin.log(msg);}};loadTextures(ctx);loadMaterials(ctx);loadDefaultScene(ctx);sceneModel.finalize();spinner.processes--;ok();});}function loadTextures(ctx){var gltfData=ctx.gltfData;var textures=gltfData.textures;if(textures){for(var _i427=0,len=textures.length;_i427<len;_i427++){loadTexture(ctx,textures[_i427]);}}}function loadTexture(ctx,texture){if(!texture.source||!texture.source.image){return;}var textureId="texture-".concat(ctx.nextId++);var minFilter=NearestMipMapLinearFilter;switch(texture.sampler.minFilter){case 9728:minFilter=NearestFilter;break;case 9729:minFilter=LinearFilter;break;case 9984:minFilter=NearestMipMapNearestFilter;break;case 9985:minFilter=LinearMipMapNearestFilter;break;case 9986:minFilter=NearestMipMapLinearFilter;break;case 9987:minFilter=LinearMipMapLinearFilter;break;}var magFilter=LinearFilter;switch(texture.sampler.magFilter){case 9728:magFilter=NearestFilter;break;case 9729:magFilter=LinearFilter;break;}var wrapS=RepeatWrapping;switch(texture.sampler.wrapS){case 33071:wrapS=ClampToEdgeWrapping;break;case 33648:wrapS=MirroredRepeatWrapping;break;case 10497:wrapS=RepeatWrapping;break;}var wrapT=RepeatWrapping;switch(texture.sampler.wrapT){case 33071:wrapT=ClampToEdgeWrapping;break;case 33648:wrapT=MirroredRepeatWrapping;break;case 10497:wrapT=RepeatWrapping;break;}var wrapR=RepeatWrapping;switch(texture.sampler.wrapR){case 33071:wrapR=ClampToEdgeWrapping;break;case 33648:wrapR=MirroredRepeatWrapping;break;case 10497:wrapR=RepeatWrapping;break;}ctx.sceneModel.createTexture({id:textureId,image:texture.source.image,flipY:!!texture.flipY,minFilter:minFilter,magFilter:magFilter,wrapS:wrapS,wrapT:wrapT,wrapR:wrapR,encoding:sRGBEncoding});texture._textureId=textureId;}function loadMaterials(ctx){var gltfData=ctx.gltfData;var materials=gltfData.materials;if(materials){for(var _i428=0,len=materials.length;_i428<len;_i428++){var material=materials[_i428];material._textureSetId=loadTextureSet(ctx,material);material._attributes=loadMaterialAttributes(ctx,material);}}}function loadTextureSet(ctx,material){var textureSetCfg={};if(material.normalTexture){textureSetCfg.normalTextureId=material.normalTexture.texture._textureId;}if(material.occlusionTexture){textureSetCfg.occlusionTextureId=material.occlusionTexture.texture._textureId;}if(material.emissiveTexture){textureSetCfg.emissiveTextureId=material.emissiveTexture.texture._textureId;}// const alphaMode = material.alphaMode;
21833
21833
  // switch (alphaMode) {
21834
21834
  // case "NORMAL_OPAQUE":
21835
21835
  // materialCfg.alphaMode = "opaque";