@xeokit/xeokit-sdk 2.4.0-alpha-100 → 2.4.0-alpha-101

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xeokit/xeokit-sdk",
3
- "version": "2.4.0-alpha-100",
3
+ "version": "2.4.0-alpha-101",
4
4
  "description": "Web Programming Toolkit for 3D/2D BIM and AEC Graphics",
5
5
  "module": "./dist/xeokit-sdk.es.js",
6
6
  "main": "./dist/xeokit-sdk.cjs.js",
@@ -311,7 +311,6 @@ export class DistanceMeasurementsMouseControl extends DistanceMeasurementsContro
311
311
  this.pointerLens.visible = false;
312
312
  }
313
313
  this.reset();
314
- this.viewer
315
314
  const canvas = this.scene.canvas.canvas;
316
315
  canvas.removeEventListener("mousedown", this._onMouseDown);
317
316
  canvas.removeEventListener("mouseup", this._onMouseUp);
@@ -15,8 +15,8 @@ function CubeTextureCanvas(viewer, navCubeScene, cfg = {}) {
15
15
  const facesZUp = [
16
16
  {boundary: [6, 6, 6, 6], color: cfg.frontColor || cfg.color || "#55FF55"},
17
17
  {boundary: [18, 6, 6, 6], color: cfg.backColor || cfg.color || "#55FF55"},
18
- {boundary: [12, 6, 6, 6], color: cfg.leftColor || cfg.color || "#FF5555"},
19
- {boundary: [0, 6, 6, 6], color: cfg.rightColor || cfg.color || "#FF5555"},
18
+ {boundary: [12, 6, 6, 6], color: cfg.rightColor || cfg.color || "#FF5555"},
19
+ {boundary: [0, 6, 6, 6], color: cfg.leftColor || cfg.color || "#FF5555"},
20
20
  {boundary: [6, 0, 6, 6], color: cfg.topColor || cfg.color || "#7777FF"},
21
21
  {boundary: [6, 12, 6, 6], color: cfg.bottomColor || cfg.color || "#7777FF"}
22
22
  ];
@@ -53,8 +53,8 @@ function CubeTextureCanvas(viewer, navCubeScene, cfg = {}) {
53
53
  const facesYUp = [
54
54
  {boundary: [6, 6, 6, 6], color: cfg.frontColor || cfg.color || "#55FF55"},
55
55
  {boundary: [18, 6, 6, 6], color: cfg.backColor || cfg.color || "#55FF55"},
56
- {boundary: [12, 6, 6, 6], color: cfg.leftColor || cfg.color || "#FF5555"},
57
- {boundary: [0, 6, 6, 6], color: cfg.rightColor || cfg.color || "#FF5555"},
56
+ {boundary: [12, 6, 6, 6], color: cfg.rightColor || cfg.color || "#FF5555"},
57
+ {boundary: [0, 6, 6, 6], color: cfg.leftColor || cfg.color || "#FF5555"},
58
58
  {boundary: [6, 0, 6, 6], color: cfg.topColor || cfg.color || "#7777FF"},
59
59
  {boundary: [6, 12, 6, 6], color: cfg.bottomColor || cfg.color || "#7777FF"}
60
60
  ];
@@ -0,0 +1,31 @@
1
+ export class MeshClusteringManager {
2
+
3
+ constructor(sceneModel) {
4
+ this.sceneModel = sceneModel;
5
+ this.meshes = [];
6
+ this.entities = [];
7
+ this.clusteredMeshes = [];
8
+ }
9
+
10
+ addMeshCfg(meshCfg) {
11
+ this.meshes.push(meshCfg);
12
+ }
13
+
14
+ addEntityCfg(entityCfg) {
15
+ this.entities.push(entityCfg);
16
+ }
17
+
18
+ doClustering() {
19
+ this.clusteredMeshes = this.meshes;
20
+ }
21
+
22
+ finalize() {
23
+ this.doClustering();
24
+ for (let i = 0, len = this.clusteredMeshes.length; i < len; i++) {
25
+ this.sceneModel.addMesh(this.clusteredMeshes[i]);
26
+ }
27
+ for (let i = 0, len = this.entities.length; i < len; i++) {
28
+ this.sceneModel.addEntity(this.entities[i]);
29
+ }
30
+ }
31
+ }
@@ -371,7 +371,6 @@ export class TrianglesDataTextureSnapDepthBufInitRenderer {
371
371
  src.push("float tmp = clipPos.w;")
372
372
  src.push("clipPos.xyzw /= tmp;")
373
373
  src.push("clipPos.xy = remapClipPos(clipPos.xy);");
374
- src.push("clipPos.z += 0.0001;"); // small Z offset
375
374
  src.push("clipPos.xyzw *= tmp;")
376
375
  if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {
377
376
  src.push("vFragDepth = 1.0 + clipPos.w;");
@@ -429,7 +428,10 @@ export class TrianglesDataTextureSnapDepthBufInitRenderer {
429
428
  src.push(" }");
430
429
  }
431
430
  if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {
432
- src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");
431
+ src.push(" float dx = dFdx(vFragDepth);")
432
+ src.push(" float dy = dFdy(vFragDepth);")
433
+ src.push(" float diff = sqrt(dx*dx+dy*dy);");
434
+ src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;");
433
435
  }
434
436
  src.push("outCoords = ivec4(relativeToOriginPosition.xyz * uCoordinateScaler.xyz, - uLayerNumber);")
435
437
  src.push("}");
@@ -217,7 +217,6 @@ export class SnapBatchingDepthBufInitRenderer extends VBOSceneModelRenderer {
217
217
  src.push("float tmp = clipPos.w;")
218
218
  src.push("clipPos.xyzw /= tmp;")
219
219
  src.push("clipPos.xy = remapClipPos(clipPos.xy);");
220
- src.push("clipPos.z += 0.0001;"); // small Z offset
221
220
  src.push("clipPos.xyzw *= tmp;")
222
221
  if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {
223
222
  src.push("vFragDepth = 1.0 + clipPos.w;");
@@ -275,7 +274,10 @@ export class SnapBatchingDepthBufInitRenderer extends VBOSceneModelRenderer {
275
274
  src.push(" }");
276
275
  }
277
276
  if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {
278
- src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");
277
+ src.push(" float dx = dFdx(vFragDepth);")
278
+ src.push(" float dy = dFdy(vFragDepth);")
279
+ src.push(" float diff = sqrt(dx*dx+dy*dy);");
280
+ src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;");
279
281
  }
280
282
  src.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);")
281
283
  src.push("}");
@@ -249,7 +249,6 @@ class SnapInstancingDepthBufInitRenderer extends VBOSceneModelRenderer {
249
249
  src.push("float tmp = clipPos.w;")
250
250
  src.push("clipPos.xyzw /= tmp;")
251
251
  src.push("clipPos.xy = remapClipPos(clipPos.xy);");
252
- src.push("clipPos.z += 0.0001;"); // small Z offset
253
252
  src.push("clipPos.xyzw *= tmp;")
254
253
  if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {
255
254
  src.push("vFragDepth = 1.0 + clipPos.w;");
@@ -307,7 +306,10 @@ class SnapInstancingDepthBufInitRenderer extends VBOSceneModelRenderer {
307
306
  src.push("}");
308
307
  }
309
308
  if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {
310
- src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");
309
+ src.push(" float dx = dFdx(vFragDepth);")
310
+ src.push(" float dy = dFdy(vFragDepth);")
311
+ src.push(" float diff = sqrt(dx*dx+dy*dy);");
312
+ src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;");
311
313
  }
312
314
  src.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, -layerNumber);")
313
315
  src.push("}");