@xeokit/xeokit-sdk 2.6.0-beta-14 → 2.6.0-beta-16

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.
@@ -12403,13 +12403,16 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
12403
12403
  this._currentAngleMeasurement = this.angleMeasurementsPlugin.createMeasurement({
12404
12404
  id: math.createUUID(),
12405
12405
  origin: {
12406
- worldPos: mouseWorldPos
12406
+ worldPos: mouseWorldPos,
12407
+ entity: hoveredEntity
12407
12408
  },
12408
12409
  corner: {
12409
- worldPos: mouseWorldPos
12410
+ worldPos: mouseWorldPos,
12411
+ entity: hoveredEntity
12410
12412
  },
12411
12413
  target: {
12412
- worldPos: mouseWorldPos
12414
+ worldPos: mouseWorldPos,
12415
+ entity: hoveredEntity
12413
12416
  },
12414
12417
  approximate: true
12415
12418
  });
@@ -13245,13 +13248,16 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
13245
13248
  this._currentAngleMeasurement = plugin.createMeasurement({
13246
13249
  id: math.createUUID(),
13247
13250
  origin: {
13248
- worldPos: snapPickResult.worldPos
13251
+ worldPos: snapPickResult.worldPos,
13252
+ entity: snapPickResult.entity
13249
13253
  },
13250
13254
  corner: {
13251
- worldPos: snapPickResult.worldPos
13255
+ worldPos: snapPickResult.worldPos,
13256
+ entity: snapPickResult.entity
13252
13257
  },
13253
13258
  target: {
13254
- worldPos: snapPickResult.worldPos
13259
+ worldPos: snapPickResult.worldPos,
13260
+ entity: snapPickResult.entity
13255
13261
  }
13256
13262
  });
13257
13263
  this._currentAngleMeasurement.clickable = false;
@@ -13320,6 +13326,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
13320
13326
  this.pointerCircle.start(snapPickResult.snappedCanvasPos);
13321
13327
  pointerWorldPos.set(snapPickResult.worldPos);
13322
13328
  this._currentAngleMeasurement.corner.worldPos = snapPickResult.worldPos;
13329
+ this._currentAngleMeasurement.corner.entity = snapPickResult.entity;
13323
13330
  this._currentAngleMeasurement.originVisible = true;
13324
13331
  this._currentAngleMeasurement.originWireVisible = true;
13325
13332
  this._currentAngleMeasurement.cornerVisible = true;
@@ -13341,6 +13348,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
13341
13348
  this.pointerCircle.start(pickResult.canvasPos);
13342
13349
  pointerWorldPos.set(pickResult.worldPos);
13343
13350
  this._currentAngleMeasurement.corner.worldPos = pickResult.worldPos;
13351
+ this._currentAngleMeasurement.corner.entity = pickResult.entity;
13344
13352
  this._currentAngleMeasurement.originVisible = true;
13345
13353
  this._currentAngleMeasurement.originWireVisible = true;
13346
13354
  this._currentAngleMeasurement.cornerVisible = true;
@@ -13411,6 +13419,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
13411
13419
  this.pointerCircle.start(snapPickResult.snappedCanvasPos);
13412
13420
  pointerWorldPos.set(snapPickResult.worldPos);
13413
13421
  this._currentAngleMeasurement.target.worldPos = snapPickResult.worldPos;
13422
+ this._currentAngleMeasurement.target.entity = snapPickResult.entity;
13414
13423
  this._currentAngleMeasurement.originVisible = true;
13415
13424
  this._currentAngleMeasurement.originWireVisible = true;
13416
13425
  this._currentAngleMeasurement.cornerVisible = true;
@@ -13432,6 +13441,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
13432
13441
  this.pointerCircle.start(pickResult.canvasPos);
13433
13442
  pointerWorldPos.set(pickResult.worldPos);
13434
13443
  this._currentAngleMeasurement.target.worldPos = pickResult.worldPos;
13444
+ this._currentAngleMeasurement.target.entity = pickResult.entity;
13435
13445
  this._currentAngleMeasurement.originVisible = true;
13436
13446
  this._currentAngleMeasurement.originWireVisible = true;
13437
13447
  this._currentAngleMeasurement.cornerVisible = true;
@@ -83349,7 +83359,7 @@ class SceneModel extends Component {
83349
83359
  return;
83350
83360
  }
83351
83361
  let parentTransform;
83352
- if (this.parentTransformId) {
83362
+ if (cfg.parentTransformId) {
83353
83363
  parentTransform = this._transforms[cfg.parentTransformId];
83354
83364
  if (!parentTransform) {
83355
83365
  this.error("[createTransform] SceneModel.createTransform() config missing: id");
@@ -87192,10 +87202,12 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
87192
87202
  this._currentDistanceMeasurement = distanceMeasurementsPlugin.createMeasurement({
87193
87203
  id: math.createUUID(),
87194
87204
  origin: {
87195
- worldPos: pointerWorldPos.slice()
87205
+ worldPos: pointerWorldPos.slice(),
87206
+ entity: hoveredEntity
87196
87207
  },
87197
87208
  target: {
87198
- worldPos: pointerWorldPos.slice()
87209
+ worldPos: pointerWorldPos.slice(),
87210
+ entity: hoveredEntity
87199
87211
  },
87200
87212
  approximate: true
87201
87213
  });
@@ -87208,7 +87220,7 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
87208
87220
  this._currentDistanceMeasurement.clickable = false;
87209
87221
  this._currentDistanceMeasurement.origin.entity = hoveredEntity;
87210
87222
  hoveredEntity = null;
87211
- this.fire("measurementStart", this._currentDistanceMeasurement);
87223
+ this.distanceMeasurementsPlugin.fire("measurementStart", this._currentDistanceMeasurement);
87212
87224
  }
87213
87225
  }
87214
87226
  });
@@ -88093,10 +88105,12 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
88093
88105
  this._currentDistanceMeasurement = plugin.createMeasurement({
88094
88106
  id: math.createUUID(),
88095
88107
  origin: {
88096
- worldPos: pointerWorldPos
88108
+ worldPos: pointerWorldPos,
88109
+ entity: snapPickResult.entity
88097
88110
  },
88098
88111
  target: {
88099
- worldPos: pointerWorldPos
88112
+ worldPos: pointerWorldPos,
88113
+ entity: snapPickResult.entity
88100
88114
  }
88101
88115
  });
88102
88116
  this._currentDistanceMeasurement.labelsVisible = false;
@@ -88166,6 +88180,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
88166
88180
  this.pointerCircle.start(snapPickResult.snappedCanvasPos);
88167
88181
  pointerWorldPos.set(snapPickResult.worldPos);
88168
88182
  this._currentDistanceMeasurement.target.worldPos = snapPickResult.worldPos;
88183
+ this._currentDistanceMeasurement.target.entity = snapPickResult.entity;
88169
88184
  this._currentDistanceMeasurement.targetVisible = true;
88170
88185
  this._currentDistanceMeasurement.wireVisible = true;
88171
88186
  this._currentDistanceMeasurement.labelsVisible = true;
@@ -88183,6 +88198,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
88183
88198
  this.pointerCircle.start(pickResult.canvasPos);
88184
88199
  pointerWorldPos.set(pickResult.worldPos);
88185
88200
  this._currentDistanceMeasurement.target.worldPos = pickResult.worldPos;
88201
+ this._currentDistanceMeasurement.target.entity = pickResult.entity;
88186
88202
  this._currentDistanceMeasurement.targetVisible = true;
88187
88203
  this._currentDistanceMeasurement.wireVisible = true;
88188
88204
  this._currentDistanceMeasurement.labelsVisible = true;
@@ -88273,10 +88289,12 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
88273
88289
  this._currentDistanceMeasurement = plugin.createMeasurement({
88274
88290
  id: math.createUUID(),
88275
88291
  origin: {
88276
- worldPos: snapPickResult.worldPos
88292
+ worldPos: snapPickResult.worldPos,
88293
+ entity: snapPickResult.entity
88277
88294
  },
88278
88295
  target: {
88279
- worldPos: snapPickResult.worldPos
88296
+ worldPos: snapPickResult.worldPos,
88297
+ entity: snapPickResult.entity
88280
88298
  }
88281
88299
  });
88282
88300
  this._currentDistanceMeasurement.labelsVisible = false;
@@ -88307,10 +88325,12 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
88307
88325
  this._currentDistanceMeasurement = plugin.createMeasurement({
88308
88326
  id: math.createUUID(),
88309
88327
  origin: {
88310
- worldPos: pickResult.worldPos
88328
+ worldPos: pickResult.worldPos,
88329
+ entity: pickResult.entity
88311
88330
  },
88312
88331
  target: {
88313
- worldPos: pickResult.worldPos
88332
+ worldPos: pickResult.worldPos,
88333
+ entity: pickResult.entity
88314
88334
  }
88315
88335
  });
88316
88336
  this._currentDistanceMeasurement.labelsVisible = false;
@@ -88367,6 +88387,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
88367
88387
  this.pointerLens.snapped = true;
88368
88388
  }
88369
88389
  this._currentDistanceMeasurement.target.worldPos = snapPickResult.worldPos;
88390
+ this._currentDistanceMeasurement.target.entity = snapPickResult.entity;
88370
88391
  this._currentDistanceMeasurement.targetVisible = true;
88371
88392
  this._currentDistanceMeasurement.wireVisible = true;
88372
88393
  this._currentDistanceMeasurement.labelsVisible = true;
@@ -88381,6 +88402,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
88381
88402
  this.pointerLens.snapped = false;
88382
88403
  }
88383
88404
  this._currentDistanceMeasurement.target.worldPos = pickResult.worldPos;
88405
+ this._currentDistanceMeasurement.target.entity = pickResult.entity;
88384
88406
  this._currentDistanceMeasurement.targetVisible = true;
88385
88407
  this._currentDistanceMeasurement.wireVisible = true;
88386
88408
  this._currentDistanceMeasurement.labelsVisible = true;
@@ -88436,10 +88458,12 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
88436
88458
  this._currentDistanceMeasurement = plugin.createMeasurement({
88437
88459
  id: math.createUUID(),
88438
88460
  origin: {
88439
- worldPos: pickResult.worldPos
88461
+ worldPos: pickResult.worldPos,
88462
+ entity: pickResult.entity
88440
88463
  },
88441
88464
  target: {
88442
- worldPos: pickResult.worldPos
88465
+ worldPos: pickResult.worldPos,
88466
+ entity: pickResult.entity
88443
88467
  }
88444
88468
  });
88445
88469
  this._currentDistanceMeasurement.labelsVisible = false;
@@ -88451,6 +88475,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
88451
88475
  this._currentDistanceMeasurement.targetVisible = false;
88452
88476
  this._currentDistanceMeasurement.clickable = false;
88453
88477
  this._touchState = WAITING_FOR_TARGET_TOUCH_START;
88478
+ this.distanceMeasurementsPlugin.fire("measurementStart", this._currentDistanceMeasurement);
88454
88479
  // console.log("touchend: this._touchState= WAITING_FOR_ORIGIN_QUICK_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START")
88455
88480
  } else {
88456
88481
  if (this._currentDistanceMeasurement) {
@@ -88496,6 +88521,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
88496
88521
  });
88497
88522
  if (pickResult && pickResult.worldPos) {
88498
88523
  this._currentDistanceMeasurement.target.worldPos = pickResult.worldPos;
88524
+ this._currentDistanceMeasurement.target.entity = pickResult.entity;
88499
88525
  this._currentDistanceMeasurement.targetVisible = true;
88500
88526
  this._currentDistanceMeasurement.wireVisible = true;
88501
88527
  this._currentDistanceMeasurement.labelsVisible = true;
@@ -94873,6 +94899,7 @@ class PickController {
94873
94899
  if (this.snappedOrPicked) {
94874
94900
  if (this.snapPickResult) {
94875
94901
  const pickResult = new PickResult();
94902
+ pickResult.entity = this.snapPickResult.entity;
94876
94903
  pickResult.snappedToVertex = this.snapPickResult.snappedToVertex;
94877
94904
  pickResult.snappedToEdge = this.snapPickResult.snappedToEdge;
94878
94905
  pickResult.worldPos = this.snapPickResult.worldPos;
@@ -95081,7 +95108,7 @@ class MousePanRotateDollyHandler {
95081
95108
  }
95082
95109
  });
95083
95110
 
95084
- document.addEventListener("mousemove", this._documentMouseMoveHandler = () => {
95111
+ document.addEventListener("mousemove", this._documentMouseMoveHandler = (e) => {
95085
95112
 
95086
95113
  if (!(configs.active && configs.pointerEnabled)) {
95087
95114
  return;
@@ -95102,10 +95129,10 @@ class MousePanRotateDollyHandler {
95102
95129
 
95103
95130
  const panning = keyDown[scene.input.KEY_SHIFT] || configs.planView || (!configs.panRightClick && mouseDownMiddle) || (configs.panRightClick && mouseDownRight);
95104
95131
 
95105
- if (panning) {
95132
+ const xDelta = document.pointerLockElement ? e.movementX : (x - lastX);
95133
+ const yDelta = document.pointerLockElement ? e.movementY : (y - lastY);
95106
95134
 
95107
- const xPanDelta = (x - lastX);
95108
- const yPanDelta = (y - lastY);
95135
+ if (panning) {
95109
95136
 
95110
95137
  const camera = scene.camera;
95111
95138
 
@@ -95116,13 +95143,13 @@ class MousePanRotateDollyHandler {
95116
95143
  const depth = Math.abs(mouseDownPicked ? math.lenVec3(math.subVec3(pickedWorldPos, scene.camera.eye, [])) : scene.camera.eyeLookDist);
95117
95144
  const targetDistance = depth * Math.tan((camera.perspective.fov / 2) * Math.PI / 180.0);
95118
95145
 
95119
- updates.panDeltaX += (1.5 * xPanDelta * targetDistance / canvasHeight);
95120
- updates.panDeltaY += (1.5 * yPanDelta * targetDistance / canvasHeight);
95146
+ updates.panDeltaX += (1.5 * xDelta * targetDistance / canvasHeight);
95147
+ updates.panDeltaY += (1.5 * yDelta * targetDistance / canvasHeight);
95121
95148
 
95122
95149
  } else {
95123
95150
 
95124
- updates.panDeltaX += 0.5 * camera.ortho.scale * (xPanDelta / canvasHeight);
95125
- updates.panDeltaY += 0.5 * camera.ortho.scale * (yPanDelta / canvasHeight);
95151
+ updates.panDeltaX += 0.5 * camera.ortho.scale * (xDelta / canvasHeight);
95152
+ updates.panDeltaY += 0.5 * camera.ortho.scale * (yDelta / canvasHeight);
95126
95153
  }
95127
95154
 
95128
95155
  } else if (mouseDownLeft && !mouseDownMiddle && !mouseDownRight) {
@@ -95130,12 +95157,12 @@ class MousePanRotateDollyHandler {
95130
95157
  if (!configs.planView) { // No rotating in plan-view mode
95131
95158
 
95132
95159
  if (configs.firstPerson) {
95133
- updates.rotateDeltaY -= ((x - lastX) / canvasWidth) * configs.dragRotationRate / 2;
95134
- updates.rotateDeltaX += ((y - lastY) / canvasHeight) * (configs.dragRotationRate / 4);
95160
+ updates.rotateDeltaY -= (xDelta / canvasWidth) * configs.dragRotationRate / 2;
95161
+ updates.rotateDeltaX += (yDelta / canvasHeight) * (configs.dragRotationRate / 4);
95135
95162
 
95136
95163
  } else {
95137
- updates.rotateDeltaY -= ((x - lastX) / canvasWidth) * (configs.dragRotationRate * 1.5);
95138
- updates.rotateDeltaX += ((y - lastY) / canvasHeight) * (configs.dragRotationRate * 1.5);
95164
+ updates.rotateDeltaY -= (xDelta / canvasWidth) * (configs.dragRotationRate * 1.5);
95165
+ updates.rotateDeltaX += (yDelta / canvasHeight) * (configs.dragRotationRate * 1.5);
95139
95166
  }
95140
95167
  }
95141
95168
  }
@@ -115503,6 +115530,7 @@ function parseGLTF(plugin, src, gltf, metaModelJSON, options, sceneModel, ok) {
115503
115530
  loadBuffer: options.loadBuffer,
115504
115531
  basePath: options.basePath,
115505
115532
  handlenode: options.handlenode,
115533
+ backfaces: !!options.backfaces,
115506
115534
  gltfData: gltfData,
115507
115535
  scene: sceneModel.scene,
115508
115536
  plugin: plugin,
@@ -115708,7 +115736,8 @@ function loadMaterialAttributes(ctx, material) { // Substitute RGBA for material
115708
115736
  color: new Float32Array([1, 1, 1, 1]),
115709
115737
  opacity: 1,
115710
115738
  metallic: 0,
115711
- roughness: 1
115739
+ roughness: 1,
115740
+ doubleSided : true
115712
115741
  };
115713
115742
  if (extensions) {
115714
115743
  const specularPBR = extensions["KHR_materials_pbrSpecularGlossiness"];
@@ -115759,6 +115788,7 @@ function loadMaterialAttributes(ctx, material) { // Substitute RGBA for material
115759
115788
  materialAttributes.roughness = roughnessFactor;
115760
115789
  }
115761
115790
  }
115791
+ materialAttributes.doubleSided = (material.doubleSided !== false);
115762
115792
  return materialAttributes;
115763
115793
  }
115764
115794
 
@@ -115869,6 +115899,20 @@ function loadNode(ctx, node, depth, matrix) {
115869
115899
  id: sceneModel.id + "." + ctx.numObjects++
115870
115900
  };
115871
115901
 
115902
+ const material = primitive.material;
115903
+ if (material) {
115904
+ meshCfg.textureSetId = material._textureSetId;
115905
+ meshCfg.color = material._attributes.color;
115906
+ meshCfg.opacity = material._attributes.opacity;
115907
+ meshCfg.metallic = material._attributes.metallic;
115908
+ meshCfg.roughness = material._attributes.roughness;
115909
+ } else {
115910
+ meshCfg.color = new Float32Array([1.0, 1.0, 1.0]);
115911
+ meshCfg.opacity = 1.0;
115912
+ }
115913
+
115914
+ const backfaces = ((ctx.backfaces !== false) || (material.doubleSided !== false));
115915
+
115872
115916
  switch (primitive.mode) {
115873
115917
  case 0: // POINTS
115874
115918
  meshCfg.primitive = "points";
@@ -115883,16 +115927,16 @@ function loadNode(ctx, node, depth, matrix) {
115883
115927
  meshCfg.primitive = "lines";
115884
115928
  break;
115885
115929
  case 4: // TRIANGLES
115886
- meshCfg.primitive = "triangles";
115930
+ meshCfg.primitive = backfaces ? "triangles" : "solid";
115887
115931
  break;
115888
115932
  case 5: // TRIANGLE_STRIP
115889
- meshCfg.primitive = "triangles";
115933
+ meshCfg.primitive = backfaces ? "triangles" : "solid";
115890
115934
  break;
115891
115935
  case 6: // TRIANGLE_FAN
115892
- meshCfg.primitive = "triangles";
115936
+ meshCfg.primitive = backfaces ? "triangles" : "solid";
115893
115937
  break;
115894
115938
  default:
115895
- meshCfg.primitive = "triangles";
115939
+ meshCfg.primitive = backfaces ? "triangles" : "solid";
115896
115940
  }
115897
115941
 
115898
115942
  const POSITION = primitive.attributes.POSITION;
@@ -115921,17 +115965,6 @@ function loadNode(ctx, node, depth, matrix) {
115921
115965
  meshCfg.origin = origin;
115922
115966
  }
115923
115967
 
115924
- const material = primitive.material;
115925
- if (material) {
115926
- meshCfg.textureSetId = material._textureSetId;
115927
- meshCfg.color = material._attributes.color;
115928
- meshCfg.opacity = material._attributes.opacity;
115929
- meshCfg.metallic = material._attributes.metallic;
115930
- meshCfg.roughness = material._attributes.roughness;
115931
- } else {
115932
- meshCfg.color = new Float32Array([1.0, 1.0, 1.0]);
115933
- meshCfg.opacity = 1.0;
115934
- }
115935
115968
  // if (createEntity) {
115936
115969
  // if (createEntity.colorize) {
115937
115970
  // meshCfg.color = createEntity.colorize;
@@ -116274,7 +116307,7 @@ class GLTFLoaderPlugin extends Plugin {
116274
116307
  * @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````
116275
116308
  * @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````.
116276
116309
  * @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````.
116277
- * @param {Boolean} [params.backfaces=false] When true, allows visible backfaces, wherever specified in the glTF. When false, ignores backfaces.
116310
+ * @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.
116278
116311
  * @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.
116279
116312
  * @param {Boolean} [params.dtxEnabled=true] When ````true```` (default) use data textures (DTX), where appropriate, to
116280
116313
  * represent the returned model. Set false to always use vertex buffer objects (VBOs). Note that DTX is only applicable
@@ -136401,6 +136434,7 @@ exports.PNGMediaType = PNGMediaType;
136401
136434
  exports.Path = Path;
136402
136435
  exports.PerformanceModel = PerformanceModel;
136403
136436
  exports.PhongMaterial = PhongMaterial;
136437
+ exports.PickResult = PickResult;
136404
136438
  exports.Plugin = Plugin;
136405
136439
  exports.PointLight = PointLight;
136406
136440
  exports.PointerCircle = PointerCircle;