@xeokit/xeokit-sdk 2.6.43 → 2.6.46

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 (51) hide show
  1. package/dist/xeokit-sdk.cjs.js +298 -99
  2. package/dist/xeokit-sdk.es.js +298 -99
  3. package/dist/xeokit-sdk.es5.js +135 -68
  4. package/dist/xeokit-sdk.min.cjs.js +5 -5
  5. package/dist/xeokit-sdk.min.es.js +5 -5
  6. package/dist/xeokit-sdk.min.es5.js +4 -4
  7. package/package.json +1 -1
  8. package/src/extras/ContextMenu/ContextMenu.js +24 -0
  9. package/src/plugins/DotBIMLoaderPlugin/DotBIMLoaderPlugin.js +2 -1
  10. package/src/plugins/GLTFLoaderPlugin/GLTFLoaderPlugin.js +1 -0
  11. package/src/plugins/GLTFLoaderPlugin/GLTFSceneModelLoader.js +5 -3
  12. package/src/plugins/LASLoaderPlugin/LASLoaderPlugin.js +156 -2
  13. package/src/plugins/TreeViewPlugin/RenderService.js +3 -0
  14. package/src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js +14 -16
  15. package/src/viewer/Viewer.js +5 -1
  16. package/src/viewer/scene/input/Input.js +5 -9
  17. package/src/viewer/scene/math/rtcCoords.js +5 -1
  18. package/src/viewer/scene/model/SceneModel.js +4 -2
  19. package/src/viewer/scene/model/SceneModelMesh.js +10 -9
  20. package/src/viewer/scene/model/dtx/lines/renderers/DTXLinesColorRenderer.js +2 -2
  21. package/src/viewer/scene/model/dtx/triangles/DTXTrianglesLayer.js +2 -2
  22. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js +2 -2
  23. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js +2 -2
  24. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesColorRenderer.js +2 -2
  25. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js +2 -2
  26. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js +2 -2
  27. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js +2 -2
  28. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js +2 -2
  29. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js +2 -2
  30. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js +2 -2
  31. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsRenderer.js +2 -1
  32. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js +2 -2
  33. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js +2 -2
  34. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js +2 -2
  35. package/src/viewer/scene/model/vbo/VBORenderer.js +2 -2
  36. package/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLineSnapInitRenderer.js +1 -1
  37. package/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapInitRenderer.js +1 -1
  38. package/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapRenderer.js +1 -1
  39. package/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapInitRenderer.js +1 -1
  40. package/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapRenderer.js +1 -1
  41. package/src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js +10 -6
  42. package/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js +1 -1
  43. package/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapRenderer.js +1 -1
  44. package/src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapInitRenderer.js +1 -1
  45. package/src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapRenderer.js +1 -1
  46. package/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapInitRenderer.js +1 -1
  47. package/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapRenderer.js +1 -1
  48. package/src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js +9 -4
  49. package/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapInitRenderer.js +1 -1
  50. package/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapRenderer.js +1 -1
  51. package/types/plugins/LASLoaderPlugin/LASLoaderPlugin.d.ts +95 -5
@@ -102,7 +102,7 @@ export class DTXTrianglesPickDepthRenderer {
102
102
  gl.uniform2f(this._uDrawingBufferSize, gl.drawingBufferWidth, gl.drawingBufferHeight);
103
103
  gl.uniform1f(this._uPickZNear, frameCtx.pickZNear);
104
104
  gl.uniform1f(this._uPickZFar, frameCtx.pickZFar);
105
- gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrixConjugate);
105
+ gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrix);
106
106
  gl.uniformMatrix4fv(this._uViewMatrix, false, rtcViewMatrix);
107
107
  gl.uniformMatrix4fv(this._uProjMatrix, false, projMatrix);
108
108
  if (scene.logarithmicDepthBufferEnabled) {
@@ -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);
128
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a, rotationMatrix);
129
129
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
130
130
  } else {
131
131
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -88,7 +88,7 @@ export class DTXTrianglesPickMeshRenderer {
88
88
  }
89
89
  gl.uniform2fv(this._uPickClipPos, frameCtx.pickClipPos);
90
90
  gl.uniform2f(this._uDrawingBufferSize, gl.drawingBufferWidth, gl.drawingBufferHeight);
91
- gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrixConjugate);
91
+ gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrix);
92
92
  gl.uniformMatrix4fv(this._uViewMatrix, false, rtcViewMatrix);
93
93
  gl.uniformMatrix4fv(this._uProjMatrix, false, projMatrix);
94
94
  gl.uniform3fv(this._uCameraEyeRtc, rtcCameraEye);
@@ -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);
115
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a, rotationMatrix);
116
116
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
117
117
  } else {
118
118
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -99,7 +99,7 @@ export class DTXTrianglesPickNormalsFlatRenderer {
99
99
  }
100
100
  gl.uniform2fv(this._uPickClipPos, frameCtx.pickClipPos);
101
101
  gl.uniform2f(this._uDrawingBufferSize, gl.drawingBufferWidth, gl.drawingBufferHeight);
102
- gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrixConjugate);
102
+ gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrix);
103
103
  gl.uniformMatrix4fv(this._uViewMatrix, false, rtcViewMatrix);
104
104
  gl.uniformMatrix4fv(this._uProjMatrix, false, projMatrix);
105
105
  gl.uniform3fv(this._uCameraEyeRtc, rtcCameraEye);
@@ -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);
126
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a, rotationMatrix);
127
127
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
128
128
  } else {
129
129
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -32,6 +32,7 @@ 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;
35
36
 
36
37
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
37
38
  const projMatrix = frameCtx.pickProjMatrix || camera.projMatrix;
@@ -93,7 +94,7 @@ export class DTXTrianglesPickNormalsRenderer {
93
94
  if (active) {
94
95
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
95
96
  if (origin) {
96
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a);
97
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a, rotationMatrix);
97
98
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
98
99
  } else {
99
100
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -94,7 +94,7 @@ export class DTXTrianglesSilhouetteRenderer {
94
94
 
95
95
  gl.uniform3fv(this._uCameraEyeRtc, rtcCameraEye);
96
96
  gl.uniform1i(this._uRenderPass, renderPass);
97
- gl.uniformMatrix4fv(this._uWorldMatrix, false, rotationMatrixConjugate);
97
+ gl.uniformMatrix4fv(this._uWorldMatrix, false, rotationMatrix);
98
98
  gl.uniformMatrix4fv(this._uViewMatrix, false, rtcViewMatrix);
99
99
  gl.uniformMatrix4fv(this._uProjMatrix, false, camera.projMatrix);
100
100
 
@@ -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);
141
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a, rotationMatrix);
142
142
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
143
143
  } else {
144
144
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -110,7 +110,7 @@ export class DTXTrianglesSnapInitRenderer {
110
110
  gl.uniform3fv(this._uCoordinateScaler, coordinateScaler);
111
111
  gl.uniform1i(this._uRenderPass, renderPass);
112
112
  gl.uniform1i(this._uPickInvisible, frameCtx.pickInvisible);
113
- gl.uniformMatrix4fv(this._uSceneWorldModelMatrix, false, rotationMatrixConjugate);
113
+ gl.uniformMatrix4fv(this._uSceneWorldModelMatrix, false, rotationMatrix);
114
114
  gl.uniformMatrix4fv(this._uViewMatrix, false, rtcViewMatrix);
115
115
  gl.uniformMatrix4fv(this._uProjMatrix, false, camera.projMatrix);
116
116
  if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {
@@ -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);
135
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a, rotationMatrix);
136
136
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
137
137
  } else {
138
138
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -115,7 +115,7 @@ export class DTXTrianglesSnapRenderer {
115
115
  gl.uniform3fv(this._uCoordinateScaler, coordinateScaler);
116
116
  gl.uniform1i(this._uRenderPass, renderPass);
117
117
  gl.uniform1i(this._uPickInvisible, frameCtx.pickInvisible);
118
- gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrixConjugate);
118
+ gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrix);
119
119
  gl.uniformMatrix4fv(this._uViewMatrix, false, rtcViewMatrix);
120
120
  gl.uniformMatrix4fv(this._uProjMatrix, false, camera.projMatrix);
121
121
  if (SNAPPING_LOG_DEPTH_BUF_ENABLED) {
@@ -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);
140
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a, rotationMatrix);
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);
135
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a, model.rotationMatrix);
136
136
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
137
137
  } else {
138
138
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -462,7 +462,7 @@ export class VBORenderer {
462
462
  let offset = 0;
463
463
  const mat4Size = 4 * 4;
464
464
 
465
- this._matricesUniformBlockBufferData.set(rotationMatrixConjugate, 0);
465
+ this._matricesUniformBlockBufferData.set(rotationMatrix, 0);
466
466
 
467
467
  const gotOrigin = (origin[0] !== 0 || origin[1] !== 0 || origin[2] !== 0);
468
468
  const gotPosition = (position[0] !== 0 || position[1] !== 0 || position[2] !== 0);
@@ -101,7 +101,7 @@ export class VBOBatchingLineSnapInitRenderer extends VBORenderer {
101
101
  let offset = 0;
102
102
  const mat4Size = 4 * 4;
103
103
 
104
- this._matricesUniformBlockBufferData.set(rotationMatrixConjugate, 0);
104
+ this._matricesUniformBlockBufferData.set(rotationMatrix, 0);
105
105
  this._matricesUniformBlockBufferData.set(rtcViewMatrix, offset += mat4Size);
106
106
  this._matricesUniformBlockBufferData.set(camera.projMatrix, offset += mat4Size);
107
107
  this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix, offset += mat4Size);
@@ -100,7 +100,7 @@ export class VBOBatchingLinesSnapInitRenderer extends VBORenderer {
100
100
  let offset = 0;
101
101
  const mat4Size = 4 * 4;
102
102
 
103
- this._matricesUniformBlockBufferData.set(rotationMatrixConjugate, 0);
103
+ this._matricesUniformBlockBufferData.set(rotationMatrix, 0);
104
104
  this._matricesUniformBlockBufferData.set(rtcViewMatrix, offset += mat4Size);
105
105
  this._matricesUniformBlockBufferData.set(camera.projMatrix, offset += mat4Size);
106
106
  this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix, offset += mat4Size);
@@ -104,7 +104,7 @@ export class VBOBatchingLinesSnapRenderer extends VBORenderer{
104
104
  let offset = 0;
105
105
  const mat4Size = 4 * 4;
106
106
 
107
- this._matricesUniformBlockBufferData.set(rotationMatrixConjugate, 0);
107
+ this._matricesUniformBlockBufferData.set(rotationMatrix, 0);
108
108
  this._matricesUniformBlockBufferData.set(rtcViewMatrix, offset += mat4Size);
109
109
  this._matricesUniformBlockBufferData.set(camera.projMatrix, offset += mat4Size);
110
110
  this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix, offset += mat4Size);
@@ -100,7 +100,7 @@ export class VBOBatchingPointsSnapInitRenderer extends VBORenderer {
100
100
  let offset = 0;
101
101
  const mat4Size = 4 * 4;
102
102
 
103
- this._matricesUniformBlockBufferData.set(rotationMatrixConjugate, 0);
103
+ this._matricesUniformBlockBufferData.set(rotationMatrix, 0);
104
104
  this._matricesUniformBlockBufferData.set(rtcViewMatrix, offset += mat4Size);
105
105
  this._matricesUniformBlockBufferData.set(camera.projMatrix, offset += mat4Size);
106
106
  this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix, offset += mat4Size);
@@ -104,7 +104,7 @@ export class VBOBatchingPointsSnapRenderer extends VBORenderer{
104
104
  let offset = 0;
105
105
  const mat4Size = 4 * 4;
106
106
 
107
- this._matricesUniformBlockBufferData.set(rotationMatrixConjugate, 0);
107
+ this._matricesUniformBlockBufferData.set(rotationMatrix, 0);
108
108
  this._matricesUniformBlockBufferData.set(rtcViewMatrix, offset += mat4Size);
109
109
  this._matricesUniformBlockBufferData.set(camera.projMatrix, offset += mat4Size);
110
110
  this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix, offset += mat4Size);
@@ -816,12 +816,15 @@ export class VBOBatchingTrianglesLayer {
816
816
  return;
817
817
  }
818
818
  const positions = portion.quantizedPositions;
819
- const origin = state.origin;
820
- const offsetX = origin[0] ;
821
- const offsetY = origin[1] ;
822
- const offsetZ = origin[2] ;
823
- const worldPos = tempVec4a;
824
819
  const sceneModelMatrix = this.model.matrix;
820
+ const origin = math.vec4();
821
+ origin.set(state.origin, 0);
822
+ origin[3] = 1;
823
+ math.mulMat4v4(sceneModelMatrix, origin, origin);
824
+ const offsetX = origin[0];
825
+ const offsetY = origin[1];
826
+ const offsetZ = origin[2];
827
+ const worldPos = tempVec4a;
825
828
  const positionsDecodeMatrix = state.positionsDecodeMatrix;
826
829
  for (let i = 0, len = positions.length; i < len; i += 3) {
827
830
  worldPos[0] = positions[i];
@@ -829,7 +832,8 @@ export class VBOBatchingTrianglesLayer {
829
832
  worldPos[2] = positions[i + 2];
830
833
  worldPos[3] = 1.0;
831
834
  math.decompressPosition(worldPos, positionsDecodeMatrix);
832
- math.transformPoint4(sceneModelMatrix, worldPos);
835
+ worldPos[3] = 1;
836
+ math.mulMat4v4(sceneModelMatrix, worldPos, worldPos);
833
837
  worldPos[0] += offsetX;
834
838
  worldPos[1] += offsetY;
835
839
  worldPos[2] += offsetZ;
@@ -100,7 +100,7 @@ export class TrianglesSnapInitRenderer extends VBORenderer {
100
100
  let offset = 0;
101
101
  const mat4Size = 4 * 4;
102
102
 
103
- this._matricesUniformBlockBufferData.set(rotationMatrixConjugate, 0);
103
+ this._matricesUniformBlockBufferData.set(rotationMatrix, 0);
104
104
  this._matricesUniformBlockBufferData.set(rtcViewMatrix, offset += mat4Size);
105
105
  this._matricesUniformBlockBufferData.set(camera.projMatrix, offset += mat4Size);
106
106
  this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix, offset += mat4Size);
@@ -103,7 +103,7 @@ export class TrianglesSnapRenderer extends VBORenderer{
103
103
  let offset = 0;
104
104
  const mat4Size = 4 * 4;
105
105
 
106
- this._matricesUniformBlockBufferData.set(rotationMatrixConjugate, 0);
106
+ this._matricesUniformBlockBufferData.set(rotationMatrix, 0);
107
107
  this._matricesUniformBlockBufferData.set(rtcViewMatrix, offset += mat4Size);
108
108
  this._matricesUniformBlockBufferData.set(camera.projMatrix, offset += mat4Size);
109
109
  this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix, offset += mat4Size);
@@ -96,7 +96,7 @@ export class VBOInstancingLinesSnapInitRenderer extends VBORenderer {
96
96
  let offset = 0;
97
97
  const mat4Size = 4 * 4;
98
98
 
99
- this._matricesUniformBlockBufferData.set(rotationMatrixConjugate, 0);
99
+ this._matricesUniformBlockBufferData.set(rotationMatrix, 0);
100
100
  this._matricesUniformBlockBufferData.set(rtcViewMatrix, offset += mat4Size);
101
101
  this._matricesUniformBlockBufferData.set(camera.projMatrix, offset += mat4Size);
102
102
  this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix, offset += mat4Size);
@@ -96,7 +96,7 @@ export class VBOInstancingLinesSnapRenderer extends VBORenderer {
96
96
  let offset = 0;
97
97
  const mat4Size = 4 * 4;
98
98
 
99
- this._matricesUniformBlockBufferData.set(rotationMatrixConjugate, 0);
99
+ this._matricesUniformBlockBufferData.set(rotationMatrix, 0);
100
100
  this._matricesUniformBlockBufferData.set(rtcViewMatrix, offset += mat4Size);
101
101
  this._matricesUniformBlockBufferData.set(camera.projMatrix, offset += mat4Size);
102
102
  this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix, offset += mat4Size);
@@ -96,7 +96,7 @@ export class VBOInstancingPointsSnapInitRenderer extends VBORenderer {
96
96
  let offset = 0;
97
97
  const mat4Size = 4 * 4;
98
98
 
99
- this._matricesUniformBlockBufferData.set(rotationMatrixConjugate, 0);
99
+ this._matricesUniformBlockBufferData.set(rotationMatrix, 0);
100
100
  this._matricesUniformBlockBufferData.set(rtcViewMatrix, offset += mat4Size);
101
101
  this._matricesUniformBlockBufferData.set(camera.projMatrix, offset += mat4Size);
102
102
  this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix, offset += mat4Size);
@@ -96,7 +96,7 @@ export class VBOInstancingPointsSnapRenderer extends VBORenderer {
96
96
  let offset = 0;
97
97
  const mat4Size = 4 * 4;
98
98
 
99
- this._matricesUniformBlockBufferData.set(rotationMatrixConjugate, 0);
99
+ this._matricesUniformBlockBufferData.set(rotationMatrix, 0);
100
100
  this._matricesUniformBlockBufferData.set(rtcViewMatrix, offset += mat4Size);
101
101
  this._matricesUniformBlockBufferData.set(camera.projMatrix, offset += mat4Size);
102
102
  this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix, offset += mat4Size);
@@ -378,6 +378,7 @@ export class VBOInstancingTrianglesLayer {
378
378
  && !!textureSet
379
379
  && !!textureSet.colorTexture;
380
380
 
381
+
381
382
  if (!this.model.scene.readableGeometryEnabled) {
382
383
  this._state.geometry = null;
383
384
  }
@@ -708,21 +709,25 @@ export class VBOInstancingTrianglesLayer {
708
709
  return;
709
710
  }
710
711
  const positions = geometry.positionsCompressed;
711
- const origin = state.origin;
712
+ const sceneModelMatrix = this.model.matrix;
713
+ const origin = math.vec4();
714
+ origin.set(state.origin, 0);
715
+ origin[3] = 1;
716
+ math.mulMat4v4(sceneModelMatrix, origin, origin);
712
717
  const offsetX = origin[0];
713
718
  const offsetY = origin[1];
714
719
  const offsetZ = origin[2];
715
720
  const worldPos = tempVec4a;
716
721
  const portionMatrix = portion.matrix;
717
- const sceneModelMatrix = this.model.matrix;
718
722
  const positionsDecodeMatrix = state.positionsDecodeMatrix;
719
723
  for (let i = 0, len = positions.length; i < len; i += 3) {
720
724
  worldPos[0] = positions[i];
721
725
  worldPos[1] = positions[i + 1];
722
726
  worldPos[2] = positions[i + 2];
723
727
  math.decompressPosition(worldPos, positionsDecodeMatrix);
724
- math.transformPoint3(portionMatrix, worldPos);
725
- math.transformPoint3(sceneModelMatrix, worldPos);
728
+ math.transformPoint3(portionMatrix, worldPos, worldPos);
729
+ worldPos[3] = 1;
730
+ math.mulMat4v4(sceneModelMatrix, worldPos, worldPos);
726
731
  worldPos[0] += offsetX;
727
732
  worldPos[1] += offsetY;
728
733
  worldPos[2] += offsetZ;
@@ -102,7 +102,7 @@ export class TrianglesSnapInitRenderer extends VBORenderer {
102
102
  let offset = 0;
103
103
  const mat4Size = 4 * 4;
104
104
 
105
- this._matricesUniformBlockBufferData.set(rotationMatrixConjugate, 0);
105
+ this._matricesUniformBlockBufferData.set(rotationMatrix, 0);
106
106
  this._matricesUniformBlockBufferData.set(rtcViewMatrix, offset += mat4Size);
107
107
  this._matricesUniformBlockBufferData.set(camera.projMatrix, offset += mat4Size);
108
108
  this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix, offset += mat4Size);
@@ -103,7 +103,7 @@ export class TrianglesSnapRenderer extends VBORenderer {
103
103
  let offset = 0;
104
104
  const mat4Size = 4 * 4;
105
105
 
106
- this._matricesUniformBlockBufferData.set(rotationMatrixConjugate, 0);
106
+ this._matricesUniformBlockBufferData.set(rotationMatrix, 0);
107
107
  this._matricesUniformBlockBufferData.set(rtcViewMatrix, offset += mat4Size);
108
108
  this._matricesUniformBlockBufferData.set(camera.projMatrix, offset += mat4Size);
109
109
  this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix, offset += mat4Size);
@@ -23,6 +23,14 @@ export declare type LASLoaderPluginConfiguration = {
23
23
  fp64?: number;
24
24
  /** Configures whether LASLoaderPlugin assumes that LAS colors are encoded using 8 or 16 bits. Accepted values are 8, 16 an "auto". */
25
25
  colorDepth?: 8 | 16 | "auto";
26
+ /** Whether to center the LAS points. Applied before "rotateX", "rotate" and "transform". */
27
+ center?: boolean;
28
+ /** Whether to rotate the LAS point positions 90 degrees. Applied after "center". */
29
+ rotateX?: boolean;
30
+ /** Rotations to apply to the LAS points, given as Euler angles in degrees, for each of the X, Y and Z axis. Rotation is applied after "center" and "rotateX".*/
31
+ rotate?: number[];
32
+ /** 4x4 transform matrix to immediately apply to the LAS points. This is applied after "center", "rotateX" and "rotate". Typically used instead of "rotateX" and "rotate". */
33
+ transform?: number[];
26
34
  };
27
35
 
28
36
  export declare type LoadLASModel = {
@@ -89,7 +97,7 @@ export declare class LASLoaderPlugin extends Plugin {
89
97
  *
90
98
  * @param {Number} value The **n**th point that LASLoaderPlugin will read.
91
99
  */
92
- set skip(arg: number);
100
+ set skip(value: number);
93
101
 
94
102
  /**
95
103
  * When LASLoaderPlugin is configured to load every **n** points, returns the value of **n**.
@@ -107,7 +115,7 @@ export declare class LASLoaderPlugin extends Plugin {
107
115
  *
108
116
  * @param {Boolean} value True if LASLoaderPlugin assumes that positions are stored in 64-bit floats instead of 32-bit.
109
117
  */
110
- set fp64(arg: boolean);
118
+ set fp64(value: boolean);
111
119
 
112
120
  /**
113
121
  * Gets if LASLoaderPlugin assumes that LAS positions are stored in 64-bit floats instead of 32-bit.
@@ -127,8 +135,8 @@ export declare class LASLoaderPlugin extends Plugin {
127
135
  *
128
136
  * @param {Number|String} value Valid values are 8, 16 and "auto".
129
137
  */
130
- set colorDepth(arg: 8 | 16 | "auto");
131
-
138
+ set colorDepth(value: 8 | 16 | "auto");
139
+
132
140
  /**
133
141
  * Gets whether LASLoaderPlugin assumes that LAS colors are encoded using 8 or 16 bits.
134
142
  *
@@ -139,7 +147,89 @@ export declare class LASLoaderPlugin extends Plugin {
139
147
  * @returns {Number|String} Possible returned values are 8, 16 and "auto".
140
148
  */
141
149
  get colorDepth(): 8 | 16 | "auto";
142
-
150
+
151
+ /**
152
+ * Gets if LASLoaderPlugin immediately centers LAS positions.
153
+ *
154
+ * If this is ````true```` then centering is the first thing that happens to LAS positions as they are loaded.
155
+ *
156
+ * Default value is ````false````.
157
+ *
158
+ * @returns {Boolean} True if LASLoaderPlugin immediately centers LAS positions.
159
+ */
160
+ get center():number[];
161
+
162
+ /**
163
+ * Configures if LASLoaderPlugin immediately centers LAS positions.
164
+ *
165
+ * If this is ````true```` then centering is the first thing that happens to LAS positions as they are loaded.
166
+ *
167
+ * Default value is ````false````.
168
+ *
169
+ * @param {Boolean} value True if LASLoaderPlugin immediately centers LAS positions.
170
+ */
171
+ set center(value:number[]);
172
+
173
+ /**
174
+ * Gets the current transformation to apply to LAS positions as they are loaded.
175
+ *
176
+ * If this is ````true```` then LAS positions will be transformed right after they are centered.
177
+ *
178
+ * Default value is null.
179
+ *
180
+ * @returns {Number[]|null} A 16-element array containing a 4x4 transformation matrix.
181
+ */
182
+ get transform(): number[];
183
+
184
+ /**
185
+ * Sets the current transformation to apply to LAS positions as they are loaded.
186
+ *
187
+ * Default value is null.
188
+ *
189
+ * @param {Number[]|null} transform A 16-element array containing a 4x4 transformation matrix.
190
+ */
191
+ set transform(transform: number[]);
192
+
193
+ /**
194
+ * Gets the current rotations to apply to LAS positions as they are loaded.
195
+ *
196
+ * Rotations are an array of three Euler angles in degrees, for each of the X, Y and Z axis, applied in that order.
197
+ *
198
+ * Default value is null.
199
+ *
200
+ * @returns {Number[]|null} If defined, an array of three Euler angles in degrees, for each of the X, Y and Z axis. Null if undefined.
201
+ */
202
+ get rotate():number[];
203
+
204
+ /**
205
+ * Sets the current rotations to apply to LAS positions as they are loaded.
206
+ *
207
+ * Rotations are an array of three Euler angles in degrees, for each of the X, Y and Z axis, applied in that order.
208
+ *
209
+ * Default value is null.
210
+ *
211
+ * @param {Number[]|null} rotate Array of three Euler angles in degrees, for each of the X, Y and Z axis.
212
+ */
213
+ set rotate(rotate:number[]) ;
214
+
215
+ /**
216
+ * Gets if LAS positions are rotated 90 degrees about X as they are loaded.
217
+ *
218
+ * Default value is ````false````.
219
+ *
220
+ * @returns {*}
221
+ */
222
+ get rotateX() :boolean;
223
+
224
+ /**
225
+ * Sets if LAS positions are rotated 90 degrees about X as they are loaded.
226
+ *
227
+ * Default value is ````false````.
228
+ *
229
+ * @param rotateX
230
+ */
231
+ set rotateX(rotateX:boolean);
232
+
143
233
  /**
144
234
  * Loads an ````LAS```` model into this LASLoaderPlugin's {@link Viewer}.
145
235
  *