@xeokit/xeokit-sdk 2.6.48 → 2.6.50

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.
Files changed (41) hide show
  1. package/dist/xeokit-sdk.cjs.js +117 -82
  2. package/dist/xeokit-sdk.es.js +117 -82
  3. package/dist/xeokit-sdk.es5.js +55 -52
  4. package/dist/xeokit-sdk.min.cjs.js +3 -3
  5. package/dist/xeokit-sdk.min.es.js +3 -3
  6. package/dist/xeokit-sdk.min.es5.js +3 -3
  7. package/package.json +1 -1
  8. package/src/plugins/StoreyViewsPlugin/Storey.js +3 -3
  9. package/src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js +43 -3
  10. package/src/plugins/TreeViewPlugin/TreeViewPlugin.js +2 -2
  11. package/src/viewer/Viewer.js +6 -0
  12. package/src/viewer/scene/math/rtcCoords.js +4 -4
  13. package/src/viewer/scene/model/SceneModel.js +18 -31
  14. package/src/viewer/scene/model/dtx/lines/renderers/DTXLinesColorRenderer.js +2 -2
  15. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js +2 -2
  16. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js +2 -2
  17. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesColorRenderer.js +2 -2
  18. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js +2 -2
  19. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js +2 -2
  20. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js +2 -2
  21. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js +2 -2
  22. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js +2 -2
  23. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js +2 -2
  24. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsRenderer.js +1 -2
  25. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js +2 -2
  26. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js +2 -2
  27. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js +2 -2
  28. package/src/viewer/scene/model/vbo/VBORenderer.js +2 -2
  29. package/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLineSnapInitRenderer.js +1 -1
  30. package/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapInitRenderer.js +1 -1
  31. package/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapRenderer.js +1 -1
  32. package/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapInitRenderer.js +5 -1
  33. package/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapRenderer.js +1 -1
  34. package/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js +1 -1
  35. package/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapRenderer.js +1 -1
  36. package/src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapInitRenderer.js +1 -1
  37. package/src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapRenderer.js +1 -1
  38. package/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapInitRenderer.js +1 -1
  39. package/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapRenderer.js +1 -1
  40. package/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapInitRenderer.js +1 -1
  41. package/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapRenderer.js +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xeokit/xeokit-sdk",
3
- "version": "2.6.48",
3
+ "version": "2.6.50",
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",
@@ -41,7 +41,7 @@ class Storey {
41
41
  /**
42
42
  * Axis-aligned World-space boundary of the {@link Entity}s that represent the IfcBuildingStorey.
43
43
  *
44
- * The boundary is a six-element Float32Array containing the min/max extents of the
44
+ * The boundary is a six-element Float64Array containing the min/max extents of the
45
45
  * axis-aligned boundary, ie. ````[xmin, ymin, zmin, xmax, ymax, zmax]````
46
46
  *
47
47
  * @property storeyAABB
@@ -52,7 +52,7 @@ class Storey {
52
52
  /**
53
53
  * Axis-aligned World-space boundary of the {@link Entity}s that represent the IfcBuildingStorey.
54
54
  *
55
- * The boundary is a six-element Float32Array containing the min/max extents of the
55
+ * The boundary is a six-element Float64Array containing the min/max extents of the
56
56
  * axis-aligned boundary, ie. ````[xmin, ymin, zmin, xmax, ymax, zmax]````
57
57
  *
58
58
  * @deprecated
@@ -64,7 +64,7 @@ class Storey {
64
64
  /**
65
65
  * Axis-aligned World-space boundary of the {@link Entity}s that represent the model.
66
66
  *
67
- * The boundary is a six-element Float32Array containing the min/max extents of the
67
+ * The boundary is a six-element Float64Array containing the min/max extents of the
68
68
  * axis-aligned boundary, ie. ````[xmin, ymin, zmin, xmax, ymax, zmax]````
69
69
  *
70
70
  * @property modelAABB
@@ -258,6 +258,8 @@ class StoreyViewsPlugin extends Plugin {
258
258
  */
259
259
  this.storeys = {};
260
260
 
261
+ this._storeysList = null;
262
+
261
263
  /**
262
264
  * A set of {@link Storey}s for each {@link MetaModel}.
263
265
  *
@@ -299,6 +301,7 @@ class StoreyViewsPlugin extends Plugin {
299
301
  this.fire("storeys", this.storeys);
300
302
  });
301
303
  this.storeys[storeyId] = storey;
304
+ this._storeysList= null;
302
305
  if (!this.modelStoreys[modelId]) {
303
306
  this.modelStoreys[modelId] = {};
304
307
  }
@@ -319,6 +322,7 @@ class StoreyViewsPlugin extends Plugin {
319
322
  model.off(storey._onModelDestroyed);
320
323
  }
321
324
  delete this.storeys[storyObjectId];
325
+ this._storeysList= null;
322
326
  }
323
327
  }
324
328
  delete this.modelStoreys[modelId];
@@ -423,7 +427,7 @@ class StoreyViewsPlugin extends Plugin {
423
427
  * @param {String} storeyId ID of the ````IfcBuildingStorey```` object.
424
428
  * @param {*} [options] Options for showing the Entitys within the storey.
425
429
  * @param {Boolean} [options.hideOthers=false] When ````true````, hide all other {@link Entity}s.
426
- */
430
+ */
427
431
  showStoreyObjects(storeyId, options = {}) {
428
432
 
429
433
  const storey = this.storeys[storeyId];
@@ -448,7 +452,7 @@ class StoreyViewsPlugin extends Plugin {
448
452
 
449
453
  this.withStoreyObjects(storeyId, (entity, metaObject) => {
450
454
  if (entity) {
451
- entity.visible = true;
455
+ entity.visible = true;
452
456
  }
453
457
  });
454
458
  }
@@ -684,7 +688,7 @@ class StoreyViewsPlugin extends Plugin {
684
688
 
685
689
  /**
686
690
  * Gets the ID of the storey which's bounding box contains the y point of the world position
687
- *
691
+ *
688
692
  * @param {Number[]} worldPos 3D World-space position.
689
693
  * @returns {String} ID of the storey containing the position, or null if the position falls outside all the storeys.
690
694
  */
@@ -804,6 +808,42 @@ class StoreyViewsPlugin extends Plugin {
804
808
  this.viewer.scene.off(this._onModelLoaded);
805
809
  super.destroy();
806
810
  }
811
+
812
+ /**
813
+ * Gets Storeys in a list, spatially sorted on the vertical World axis, the lowest Storey first.
814
+ *
815
+ * @returns {null}
816
+ */
817
+ get storeysList() {
818
+ if (!this._storeysList) {
819
+ this._storeysList = Object.values(this.storeys);
820
+ this._storeysList.sort(this._getSpatialSortFunc());
821
+ }
822
+ return this._storeysList;
823
+ }
824
+
825
+ _getSpatialSortFunc() {
826
+ const viewer = this.viewer;
827
+ const scene = viewer.scene;
828
+ const camera = scene.camera;
829
+ return this._spatialSortFunc || (this._spatialSortFunc = (storey1, storey2) => {
830
+ let idx = 0;
831
+ if (camera.xUp) {
832
+ idx = 0;
833
+ } else if (camera.yUp) {
834
+ idx = 1;
835
+ } else {
836
+ idx = 2;
837
+ }
838
+ if (storey1.aabb[idx] > storey2.aabb[idx]) {
839
+ return -1;
840
+ }
841
+ if (storey1.aabb[idx] < storey2.aabb[idx]) {
842
+ return 1;
843
+ }
844
+ return 0;
845
+ });
846
+ }
807
847
  }
808
848
 
809
849
  export {StoreyViewsPlugin}
@@ -1204,8 +1204,8 @@ export class TreeViewPlugin extends Plugin {
1204
1204
  if (!children || children.length === 0) {
1205
1205
  return;
1206
1206
  }
1207
- if (this._hierarchy === "storeys" && node.type === "IfcBuilding") {
1208
- // Assumes that children of an IfcBuilding will always be IfcBuildingStoreys
1207
+ const firstChild = children[0];
1208
+ if (this._hierarchy === "storeys" && firstChild.type === "IfcBuildingStorey") {
1209
1209
  children.sort(this._getSpatialSortFunc());
1210
1210
  } else {
1211
1211
  children.sort(this._alphaSortFunc);
@@ -4,6 +4,8 @@ import {CameraControl} from "./scene/CameraControl/CameraControl.js";
4
4
  import {MetaScene} from "./metadata/MetaScene.js";
5
5
  import {LocaleService} from "./localization/LocaleService.js";
6
6
  import html2canvas from 'html2canvas/dist/html2canvas.esm.js';
7
+ import {math} from "./scene/math/math.js";
8
+ import {transformToNode} from "../plugins/lib/ui/index.js";
7
9
 
8
10
  /**
9
11
  * The 3D Viewer at the heart of the xeokit SDK.
@@ -495,9 +497,13 @@ class Viewer {
495
497
  //for all others keep the scale 1 otherwise it will keep multiplying the scale with the base scale of canvas
496
498
  //resulting in increase/decreased size for the the canvas that is being overlapped
497
499
  const scale = i == 0 ? snapshotCanvas.width / containerElement.clientWidth : 1;
500
+ const off = math.vec2([ 0, 0 ]);
501
+ transformToNode(canvas, containerElement, off);
498
502
  await html2canvas(containerElement, {
499
503
  canvas: snapshotCanvas,
500
504
  backgroundColor: null,
505
+ x: off[0],
506
+ y: off[1],
501
507
  scale
502
508
  });
503
509
  }
@@ -130,9 +130,9 @@ function rtcToWorldPos(rtcCenter, rtcPos, worldPos) {
130
130
  * @param rtcPlanePos
131
131
  * @returns {*}
132
132
  */
133
- function getPlaneRTCPos(dist, dir, rtcOrigin, rtcPlanePos, rotationMatrix) {
134
- const rtcCenter = (rotationMatrix
135
- ? (tempVec4.set(rtcOrigin, 0), tempVec4[3] = 1, math.mulMat4v4(rotationMatrix, tempVec4, tempVec4))
133
+ function getPlaneRTCPos(dist, dir, rtcOrigin, rtcPlanePos, originMatrix) {
134
+ const rtcCenter = (originMatrix
135
+ ? (tempVec4.set(rtcOrigin, 0), tempVec4[3] = 1, math.mulMat4v4(originMatrix, tempVec4, tempVec4))
136
136
  : rtcOrigin);
137
137
  const rtcCenterToPlaneDist = math.dotVec3(dir, rtcCenter) + dist;
138
138
  const dirNormalized = math.normalizeVec3(dir, tempVec3a);
@@ -140,4 +140,4 @@ function getPlaneRTCPos(dist, dir, rtcOrigin, rtcPlanePos, rotationMatrix) {
140
140
  return rtcPlanePos;
141
141
  }
142
142
 
143
- export {createRTCViewMat, worldToRTCPos, worldToRTCPositions, rtcToWorldPos, getPlaneRTCPos};
143
+ export {createRTCViewMat, worldToRTCPos, worldToRTCPositions, rtcToWorldPos, getPlaneRTCPos};
@@ -1583,9 +1583,7 @@ export class SceneModel extends Component {
1583
1583
  * @type {Number[]}
1584
1584
  */
1585
1585
  get matrix() {
1586
- if (this._matrixDirty) {
1587
- this._rebuildMatrices();
1588
- }
1586
+ this._rebuildMatrices();
1589
1587
  return this._matrix;
1590
1588
  }
1591
1589
 
@@ -1595,9 +1593,7 @@ export class SceneModel extends Component {
1595
1593
  * @type {Number[]}
1596
1594
  */
1597
1595
  get rotationMatrix() {
1598
- if (this._matrixDirty) {
1599
- this._rebuildMatrices();
1600
- }
1596
+ this._rebuildMatrices();
1601
1597
  return this._worldRotationMatrix;
1602
1598
  }
1603
1599
 
@@ -1606,9 +1602,12 @@ export class SceneModel extends Component {
1606
1602
  math.quaternionToRotationMat4(this._quaternion, this._worldRotationMatrix);
1607
1603
  math.conjugateQuaternion(this._quaternion, this._conjugateQuaternion);
1608
1604
  math.quaternionToRotationMat4(this._conjugateQuaternion, this._worldRotationMatrixConjugate);
1605
+ math.scaleMat4v(this._scale, this._worldRotationMatrix);
1606
+ math.scaleMat4v(this._scale, this._worldRotationMatrixConjugate);
1609
1607
  this._matrix.set(this._worldRotationMatrix);
1610
1608
  math.translateMat4v(this._position, this._matrix);
1611
1609
  this._matrixDirty = false;
1610
+ this._viewMatrixDirty = true;
1612
1611
  }
1613
1612
  }
1614
1613
 
@@ -1620,9 +1619,7 @@ export class SceneModel extends Component {
1620
1619
  * @type {Number[]}
1621
1620
  */
1622
1621
  get rotationMatrixConjugate() {
1623
- if (this._matrixDirty) {
1624
- this._rebuildMatrices();
1625
- }
1622
+ this._rebuildMatrices();
1626
1623
  return this._worldRotationMatrixConjugate;
1627
1624
  }
1628
1625
 
@@ -1666,6 +1663,16 @@ export class SceneModel extends Component {
1666
1663
  return this._worldNormalMatrix;
1667
1664
  }
1668
1665
 
1666
+ _rebuildViewMatrices() {
1667
+ this._rebuildMatrices();
1668
+ if (this._viewMatrixDirty) {
1669
+ math.mulMat4(this.scene.camera.viewMatrix, this._matrix, this._viewMatrix);
1670
+ math.inverseMat4(this._viewMatrix, this._viewNormalMatrix);
1671
+ math.transposeMat4(this._viewNormalMatrix);
1672
+ this._viewMatrixDirty = false;
1673
+ }
1674
+ }
1675
+
1669
1676
  /**
1670
1677
  * Called by private renderers in ./lib, returns the view matrix with which to
1671
1678
  * render this SceneModel. The view matrix is the concatenation of the
@@ -1677,16 +1684,7 @@ export class SceneModel extends Component {
1677
1684
  if (!this._viewMatrix) {
1678
1685
  return this.scene.camera.viewMatrix;
1679
1686
  }
1680
- if (this._matrixDirty) {
1681
- this._rebuildMatrices();
1682
- this._viewMatrixDirty = true;
1683
- }
1684
- if (this._viewMatrixDirty) {
1685
- math.mulMat4(this.scene.camera.viewMatrix, this._matrix, this._viewMatrix);
1686
- math.inverseMat4(this._viewMatrix, this._viewNormalMatrix);
1687
- math.transposeMat4(this._viewNormalMatrix);
1688
- this._viewMatrixDirty = false;
1689
- }
1687
+ this._rebuildViewMatrices();
1690
1688
  return this._viewMatrix;
1691
1689
  }
1692
1690
 
@@ -1699,18 +1697,7 @@ export class SceneModel extends Component {
1699
1697
  if (!this._viewNormalMatrix) {
1700
1698
  return this.scene.camera.viewNormalMatrix;
1701
1699
  }
1702
- if (this._matrixDirty) {
1703
- this._rebuildMatrices();
1704
- this._viewMatrixDirty = true;
1705
- }
1706
- if (this._viewMatrixDirty) {
1707
- math.mulMat4(this.scene.camera.viewMatrix, this._matrix, this._viewMatrix);
1708
- math.inverseMat4(this._viewMatrix, this._viewNormalMatrix);
1709
- math.transposeMat4(this._viewNormalMatrix);
1710
- this._viewMatrixDirty = false;
1711
- }
1712
- math.inverseMat4(this._viewMatrix, this._viewNormalMatrix);
1713
- math.transposeMat4(this._viewNormalMatrix);
1700
+ this._rebuildViewMatrices();
1714
1701
  return this._viewNormalMatrix;
1715
1702
  }
1716
1703
 
@@ -34,7 +34,7 @@ export class DTXLinesColorRenderer {
34
34
  const state = dataTextureLayer._state;
35
35
  const textureState = state.textureState;
36
36
  const origin = dataTextureLayer._state.origin;
37
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
37
+ const {position, rotationMatrix} = model;
38
38
  const viewMatrix = camera.viewMatrix;
39
39
 
40
40
  if (!this._program) {
@@ -106,7 +106,7 @@ export class DTXLinesColorRenderer {
106
106
  if (active) {
107
107
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
108
108
  if (origin) {
109
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a, rotationMatrix);
109
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a, model.matrix);
110
110
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
111
111
  } else {
112
112
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -41,7 +41,7 @@ export class DTXTrianglesColorRenderer {
41
41
  const state = dataTextureLayer._state;
42
42
  const textureState = state.textureState;
43
43
  const origin = dataTextureLayer._state.origin;
44
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
44
+ const {position, rotationMatrix} = model;
45
45
 
46
46
  if (!this._program) {
47
47
  this._allocate();
@@ -119,7 +119,7 @@ export class DTXTrianglesColorRenderer {
119
119
  if (active) {
120
120
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
121
121
  if (origin) {
122
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a, rotationMatrix);
122
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a, model.matrix);
123
123
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
124
124
  } else {
125
125
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -36,7 +36,7 @@ export class DTXTrianglesDepthRenderer {
36
36
  const state = dataTextureLayer._state;
37
37
  const textureState = state.textureState;
38
38
  const origin = dataTextureLayer._state.origin;
39
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
39
+ const {position, rotationMatrix} = model;
40
40
 
41
41
  if (!this._program) {
42
42
  this._allocate();
@@ -114,7 +114,7 @@ export class DTXTrianglesDepthRenderer {
114
114
  if (active) {
115
115
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
116
116
  if (origin) {
117
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a, rotationMatrix);
117
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a, model.matrix);
118
118
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
119
119
  } else {
120
120
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -33,7 +33,7 @@ export class DTXTrianglesEdgesColorRenderer {
33
33
  const state = dataTextureLayer._state;
34
34
  const textureState = state.textureState;
35
35
  const origin = dataTextureLayer._state.origin;
36
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
36
+ const {position, rotationMatrix} = model;
37
37
  const viewMatrix = camera.viewMatrix;
38
38
 
39
39
  if (!this._program) {
@@ -100,7 +100,7 @@ export class DTXTrianglesEdgesColorRenderer {
100
100
  if (active) {
101
101
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
102
102
  if (origin) {
103
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a, rotationMatrix);
103
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a, model.matrix);
104
104
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
105
105
  } else {
106
106
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -38,7 +38,7 @@ export class DTXTrianglesEdgesRenderer {
38
38
  const state = dataTextureLayer._state;
39
39
  const textureState = state.textureState;
40
40
  const origin = dataTextureLayer._state.origin;
41
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
41
+ const {position, rotationMatrix} = model;
42
42
  const viewMatrix = camera.viewMatrix;
43
43
 
44
44
  if (!this._program) {
@@ -127,7 +127,7 @@ export class DTXTrianglesEdgesRenderer {
127
127
  if (active) {
128
128
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
129
129
  if (origin) {
130
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a, rotationMatrix);
130
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a, model.matrix);
131
131
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
132
132
  } else {
133
133
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -36,7 +36,7 @@ export class DTXTrianglesNormalsRenderer {
36
36
  const gl = scene.canvas.gl;
37
37
  const state = dataTextureLayer._state;
38
38
  const origin = dataTextureLayer._state.origin;
39
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
39
+ const {position, rotationMatrix} = model;
40
40
  const viewMatrix = camera.viewMatrix;
41
41
 
42
42
  if (!this._program) {
@@ -106,7 +106,7 @@ export class DTXTrianglesNormalsRenderer {
106
106
  if (active) {
107
107
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
108
108
  if (origin) {
109
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a, rotationMatrix);
109
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a, model.matrix);
110
110
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
111
111
  } else {
112
112
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -42,7 +42,7 @@ export class DTXTrianglesOcclusionRenderer {
42
42
  const state = dataTextureLayer._state;
43
43
  const textureState = state.textureState;
44
44
  const origin = dataTextureLayer._state.origin;
45
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
45
+ const {position, rotationMatrix} = model;
46
46
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
47
47
 
48
48
  if (!this._program) {
@@ -121,7 +121,7 @@ export class DTXTrianglesOcclusionRenderer {
121
121
  if (active) {
122
122
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
123
123
  if (origin) {
124
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a, rotationMatrix);
124
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a, model.matrix);
125
125
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
126
126
  } else {
127
127
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -36,7 +36,7 @@ export class DTXTrianglesPickDepthRenderer {
36
36
  const state = dataTextureLayer._state;
37
37
  const textureState = state.textureState;
38
38
  const origin = dataTextureLayer._state.origin;
39
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
39
+ const {position, rotationMatrix} = model;
40
40
 
41
41
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
42
42
  const projMatrix = frameCtx.pickProjMatrix || camera.projMatrix;
@@ -125,7 +125,7 @@ export class DTXTrianglesPickDepthRenderer {
125
125
  if (active) {
126
126
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
127
127
  if (origin) {
128
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a, rotationMatrix);
128
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a, model.matrix);
129
129
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
130
130
  } else {
131
131
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -44,7 +44,7 @@ export class DTXTrianglesPickMeshRenderer {
44
44
  const state = dataTextureLayer._state;
45
45
  const textureState = state.textureState;
46
46
  const origin = dataTextureLayer._state.origin;
47
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
47
+ const {position, rotationMatrix} = model;
48
48
 
49
49
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
50
50
  const projMatrix = frameCtx.pickProjMatrix || camera.projMatrix;
@@ -112,7 +112,7 @@ export class DTXTrianglesPickMeshRenderer {
112
112
  if (active) {
113
113
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
114
114
  if (origin) {
115
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a, rotationMatrix);
115
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a, model.matrix);
116
116
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
117
117
  } else {
118
118
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -41,7 +41,7 @@ export class DTXTrianglesPickNormalsFlatRenderer {
41
41
  const state = dataTextureLayer._state;
42
42
  const textureState = state.textureState;
43
43
  const origin = dataTextureLayer._state.origin;
44
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
44
+ const {position, rotationMatrix} = model;
45
45
 
46
46
  if (!this._program) {
47
47
  this._allocate();
@@ -123,7 +123,7 @@ export class DTXTrianglesPickNormalsFlatRenderer {
123
123
  if (active) {
124
124
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
125
125
  if (origin) {
126
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a, rotationMatrix);
126
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a, model.matrix);
127
127
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
128
128
  } else {
129
129
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -32,7 +32,6 @@ export class DTXTrianglesPickNormalsRenderer {
32
32
  const state = dataTextureLayer._state;
33
33
  const textureState = state.textureState;
34
34
  const origin = dataTextureLayer._state.origin;
35
- const {rotationMatrix} = model;
36
35
 
37
36
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
38
37
  const projMatrix = frameCtx.pickProjMatrix || camera.projMatrix;
@@ -94,7 +93,7 @@ export class DTXTrianglesPickNormalsRenderer {
94
93
  if (active) {
95
94
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
96
95
  if (origin) {
97
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a, rotationMatrix);
96
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a, model.matrix);
98
97
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
99
98
  } else {
100
99
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -39,7 +39,7 @@ export class DTXTrianglesSilhouetteRenderer {
39
39
  const state = dataTextureLayer._state;
40
40
  const textureState = state.textureState;
41
41
  const origin = dataTextureLayer._state.origin;
42
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
42
+ const {position, rotationMatrix} = model;
43
43
  const viewMatrix = camera.viewMatrix;
44
44
 
45
45
  if (!this._program) {
@@ -138,7 +138,7 @@ export class DTXTrianglesSilhouetteRenderer {
138
138
  if (active) {
139
139
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
140
140
  if (origin) {
141
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a, rotationMatrix);
141
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a, model.matrix);
142
142
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
143
143
  } else {
144
144
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -47,7 +47,7 @@ export class DTXTrianglesSnapInitRenderer {
47
47
  const state = dataTextureLayer._state;
48
48
  const textureState = state.textureState;
49
49
  const origin = dataTextureLayer._state.origin;
50
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
50
+ const {position, rotationMatrix} = model;
51
51
  const aabb = dataTextureLayer.aabb; // Per-layer AABB for best RTC accuracy
52
52
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
53
53
 
@@ -132,7 +132,7 @@ export class DTXTrianglesSnapInitRenderer {
132
132
  if (active) {
133
133
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
134
134
  if (origin) {
135
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a, rotationMatrix);
135
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a, model.matrix);
136
136
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
137
137
  } else {
138
138
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -51,7 +51,7 @@ export class DTXTrianglesSnapRenderer {
51
51
  const state = dataTextureLayer._state;
52
52
  const textureState = state.textureState;
53
53
  const origin = dataTextureLayer._state.origin;
54
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
54
+ const {position, rotationMatrix} = model;
55
55
  const aabb = dataTextureLayer.aabb; // Per-layer AABB for best RTC accuracy
56
56
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
57
57
 
@@ -137,7 +137,7 @@ export class DTXTrianglesSnapRenderer {
137
137
  if (active) {
138
138
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
139
139
  if (origin) {
140
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a, rotationMatrix);
140
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a, model.matrix);
141
141
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
142
142
  } else {
143
143
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -132,7 +132,7 @@ export class VBORenderer {
132
132
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
133
133
  const origin = layer._state.origin;
134
134
  if (origin) {
135
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a, model.rotationMatrix);
135
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a, model.matrix);
136
136
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
137
137
  } else {
138
138
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -439,7 +439,7 @@ export class VBORenderer {
439
439
  const {camera} = model.scene;
440
440
  const {viewNormalMatrix, project} = camera;
441
441
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix
442
- const {position, rotationMatrix, rotationMatrixConjugate, worldNormalMatrix} = model;
442
+ const {position, rotationMatrix, worldNormalMatrix} = model;
443
443
 
444
444
  if (!this._program) {
445
445
  this._allocate();
@@ -36,7 +36,7 @@ export class VBOBatchingLineSnapInitRenderer extends VBORenderer {
36
36
  const gl = scene.canvas.gl;
37
37
  const state = batchingLayer._state;
38
38
  const origin = batchingLayer._state.origin;
39
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
39
+ const {position, rotationMatrix} = model;
40
40
  const aabb = batchingLayer.aabb; // Per-layer AABB for best RTC accuracy
41
41
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
42
42
 
@@ -35,7 +35,7 @@ export class VBOBatchingLinesSnapInitRenderer extends VBORenderer {
35
35
  const gl = scene.canvas.gl;
36
36
  const state = batchingLayer._state;
37
37
  const origin = batchingLayer._state.origin;
38
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
38
+ const {position, rotationMatrix} = model;
39
39
  const aabb = batchingLayer.aabb; // Per-layer AABB for best RTC accuracy
40
40
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
41
41
 
@@ -39,7 +39,7 @@ export class VBOBatchingLinesSnapRenderer extends VBORenderer{
39
39
  const gl = scene.canvas.gl;
40
40
  const state = batchingLayer._state;
41
41
  const origin = batchingLayer._state.origin;
42
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
42
+ const {position, rotationMatrix} = model;
43
43
  const aabb = batchingLayer.aabb; // Per-layer AABB for best RTC accuracy
44
44
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
45
45
 
@@ -35,7 +35,7 @@ export class VBOBatchingPointsSnapInitRenderer extends VBORenderer {
35
35
  const gl = scene.canvas.gl;
36
36
  const state = batchingLayer._state;
37
37
  const origin = batchingLayer._state.origin;
38
- const {position, rotationMatrix, rotationMatrixConjugate} = model;
38
+ const {position, rotationMatrix} = model;
39
39
  const aabb = batchingLayer.aabb; // Per-layer AABB for best RTC accuracy
40
40
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
41
41
 
@@ -96,6 +96,7 @@ export class VBOBatchingPointsSnapInitRenderer extends VBORenderer {
96
96
  gl.uniform3fv(this._uCoordinateScaler, coordinateScaler);
97
97
  gl.uniform1i(this._uRenderPass, renderPass);
98
98
  gl.uniform1i(this._uPickInvisible, frameCtx.pickInvisible);
99
+ gl.uniform1f(this._uPointSize, 1.0);
99
100
 
100
101
  let offset = 0;
101
102
  const mat4Size = 4 * 4;
@@ -139,6 +140,7 @@ export class VBOBatchingPointsSnapInitRenderer extends VBORenderer {
139
140
  this.uInverseVectorAB = program.getLocation("snapInvVectorAB");
140
141
  this._uLayerNumber = program.getLocation("layerNumber");
141
142
  this._uCoordinateScaler = program.getLocation("coordinateScaler");
143
+ this._uPointSize = program.getLocation("pointSize");
142
144
  }
143
145
 
144
146
  _bindProgram() {
@@ -179,6 +181,7 @@ export class VBOBatchingPointsSnapInitRenderer extends VBORenderer {
179
181
  src.push("uniform vec3 uCameraEyeRtc;");
180
182
  src.push("uniform vec2 snapVectorA;");
181
183
  src.push("uniform vec2 snapInvVectorAB;");
184
+ src.push("uniform float pointSize;");
182
185
  if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {
183
186
  src.push("uniform float logDepthBufFC;");
184
187
  src.push("out float vFragDepth;");
@@ -226,6 +229,7 @@ export class VBOBatchingPointsSnapInitRenderer extends VBORenderer {
226
229
  src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");
227
230
  }
228
231
  src.push("gl_Position = clipPos;");
232
+ src.push("gl_PointSize = pointSize;");
229
233
  src.push(" }");
230
234
  src.push("}");
231
235
  return src;