@xeokit/xeokit-sdk 2.6.45 → 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 (41) hide show
  1. package/dist/xeokit-sdk.cjs.js +67 -60
  2. package/dist/xeokit-sdk.es.js +67 -60
  3. package/dist/xeokit-sdk.es5.js +33 -34
  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/XKTLoaderPlugin/XKTLoaderPlugin.js +2 -4
  9. package/src/viewer/scene/math/rtcCoords.js +3 -3
  10. package/src/viewer/scene/model/SceneModel.js +1 -1
  11. package/src/viewer/scene/model/dtx/lines/renderers/DTXLinesColorRenderer.js +2 -2
  12. package/src/viewer/scene/model/dtx/triangles/DTXTrianglesLayer.js +2 -2
  13. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js +2 -2
  14. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js +2 -2
  15. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesColorRenderer.js +2 -2
  16. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js +2 -2
  17. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js +2 -2
  18. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js +2 -2
  19. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js +2 -2
  20. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js +2 -2
  21. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js +2 -2
  22. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsRenderer.js +2 -2
  23. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js +2 -2
  24. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js +2 -2
  25. package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js +2 -2
  26. package/src/viewer/scene/model/vbo/VBORenderer.js +2 -2
  27. package/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLineSnapInitRenderer.js +1 -1
  28. package/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapInitRenderer.js +1 -1
  29. package/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapRenderer.js +1 -1
  30. package/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapInitRenderer.js +1 -1
  31. package/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapRenderer.js +1 -1
  32. package/src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js +10 -6
  33. package/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js +1 -1
  34. package/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapRenderer.js +1 -1
  35. package/src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapInitRenderer.js +1 -1
  36. package/src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapRenderer.js +1 -1
  37. package/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapInitRenderer.js +1 -1
  38. package/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapRenderer.js +1 -1
  39. package/src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js +9 -4
  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.45",
3
+ "version": "2.6.46",
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",
@@ -894,10 +894,8 @@ class XKTLoaderPlugin extends Plugin {
894
894
  delete params.id;
895
895
  }
896
896
 
897
- if (!params.src && !params.xkt && !params.manifestSrc && !params.manifest) {
898
- this.error("load() param expected: src, xkt, manifestSrc or manifestData");
899
- return sceneModel; // Return new empty model
900
- }
897
+ if (!params.src && !params.xkt && !params.manifestSrc && !params.manifest)
898
+ throw new Error("XKTLoaderPlugin: load() param expected: src, xkt, manifestSrc or manifestData");
901
899
 
902
900
  const options = {};
903
901
  const includeTypes = params.includeTypes || this._includeTypes;
@@ -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, rotationMatrixConjugate) {
134
- const rtcCenter = (rotationMatrixConjugate
135
- ? (tempVec4.set(rtcOrigin, 0), tempVec4[3] = 1, math.mulMat4v4(rotationMatrixConjugate, tempVec4, tempVec4))
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))
136
136
  : rtcOrigin);
137
137
  const rtcCenterToPlaneDist = math.dotVec3(dir, rtcCenter) + dist;
138
138
  const dirNormalized = math.normalizeVec3(dir, tempVec3a);
@@ -1605,7 +1605,7 @@ export class SceneModel extends Component {
1605
1605
  if (this._matrixDirty) {
1606
1606
  math.quaternionToRotationMat4(this._quaternion, this._worldRotationMatrix);
1607
1607
  math.conjugateQuaternion(this._quaternion, this._conjugateQuaternion);
1608
- math.quaternionToRotationMat4(this._quaternion, this._worldRotationMatrixConjugate);
1608
+ math.quaternionToRotationMat4(this._conjugateQuaternion, this._worldRotationMatrixConjugate);
1609
1609
  this._matrix.set(this._worldRotationMatrix);
1610
1610
  math.translateMat4v(this._position, this._matrix);
1611
1611
  this._matrixDirty = false;
@@ -81,7 +81,7 @@ export class DTXLinesColorRenderer {
81
81
  rtcViewMatrix = viewMatrix;
82
82
  }
83
83
 
84
- gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrixConjugate);
84
+ gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrix);
85
85
  gl.uniformMatrix4fv(this._uViewMatrix, false, rtcViewMatrix);
86
86
  gl.uniformMatrix4fv(this._uProjMatrix, false, camera.projMatrix);
87
87
  gl.uniform1i(this._uRenderPass, renderPass);
@@ -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, rotationMatrixConjugate);
109
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a, rotationMatrix);
110
110
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
111
111
  } else {
112
112
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -1122,8 +1122,8 @@ export class DTXTrianglesLayer {
1122
1122
  worldPos[2] = positions[i + 2];
1123
1123
  worldPos[3] = 1.0;
1124
1124
  math.decompressPosition(worldPos, positionsDecodeMatrix);
1125
- math.transformPoint4(this.model.worldMatrix, worldPos);
1126
- math.transformPoint4(this.model.worldMatrix, worldPos);
1125
+ math.transformPoint4(this.model.worldMatrix, worldPos, worldPos);
1126
+ math.transformPoint4(this.model.worldMatrix, worldPos, worldPos);
1127
1127
  worldPos[0] += offsetX;
1128
1128
  worldPos[1] += offsetY;
1129
1129
  worldPos[2] += offsetZ;
@@ -93,7 +93,7 @@ export class DTXTrianglesColorRenderer {
93
93
  rtcCameraEye = camera.eye;
94
94
  }
95
95
 
96
- gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrixConjugate);
96
+ gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrix);
97
97
  gl.uniformMatrix4fv(this._uViewMatrix, false, rtcViewMatrix);
98
98
  gl.uniformMatrix4fv(this._uProjMatrix, false, camera.projMatrix);
99
99
  gl.uniform3fv(this._uCameraEyeRtc, rtcCameraEye);
@@ -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, rotationMatrixConjugate);
122
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a, rotationMatrix);
123
123
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
124
124
  } else {
125
125
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -88,7 +88,7 @@ export class DTXTrianglesDepthRenderer {
88
88
  rtcCameraEye = camera.eye;
89
89
  }
90
90
 
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, camera.projMatrix);
94
94
  gl.uniform3fv(this._uCameraEyeRtc, rtcCameraEye);
@@ -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, rotationMatrixConjugate);
117
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a, rotationMatrix);
118
118
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
119
119
  } else {
120
120
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -81,7 +81,7 @@ export class DTXTrianglesEdgesColorRenderer {
81
81
  }
82
82
 
83
83
  gl.uniform1i(this._uRenderPass, renderPass);
84
- gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrixConjugate);
84
+ gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrix);
85
85
  gl.uniformMatrix4fv(this._uViewMatrix, false, rtcViewMatrix);
86
86
  gl.uniformMatrix4fv(this._uProjMatrix, false, camera.projMatrix);
87
87
 
@@ -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, rotationMatrixConjugate);
103
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a, rotationMatrix);
104
104
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
105
105
  } else {
106
106
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -86,7 +86,7 @@ export class DTXTrianglesEdgesRenderer {
86
86
  }
87
87
 
88
88
  gl.uniform1i(this._uRenderPass, renderPass);
89
- gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrixConjugate);
89
+ gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrix);
90
90
  gl.uniformMatrix4fv(this._uViewMatrix, false, rtcViewMatrix);
91
91
  gl.uniformMatrix4fv(this._uProjMatrix, false, camera.projMatrix);
92
92
 
@@ -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, rotationMatrixConjugate);
130
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a, rotationMatrix);
131
131
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
132
132
  } else {
133
133
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -84,7 +84,7 @@ export class DTXTrianglesNormalsRenderer {
84
84
 
85
85
  gl.uniform1i(this._uRenderPass, renderPass);
86
86
 
87
- gl.uniformMatrix4fv(this._uWorldMatrix, false, rotationMatrixConjugate);
87
+ gl.uniformMatrix4fv(this._uWorldMatrix, false, rotationMatrix);
88
88
  gl.uniformMatrix4fv(this._uViewMatrix, false, rtcViewMatrix);
89
89
  gl.uniformMatrix4fv(this._uProjMatrix, false, camera.projMatrix);
90
90
 
@@ -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, rotationMatrixConjugate);
109
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a, rotationMatrix);
110
110
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
111
111
  } else {
112
112
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -96,7 +96,7 @@ export class DTXTrianglesOcclusionRenderer {
96
96
 
97
97
  gl.uniform3fv(this._uCameraEyeRtc, rtcCameraEye);
98
98
  gl.uniform1i(this._uRenderPass, renderPass);
99
- gl.uniformMatrix4fv(this._uWorldMatrix, false, rotationMatrixConjugate);
99
+ gl.uniformMatrix4fv(this._uWorldMatrix, false, rotationMatrix);
100
100
  gl.uniformMatrix4fv(this._uViewMatrix, false, rtcViewMatrix);
101
101
 
102
102
  gl.uniformMatrix4fv(this._uProjMatrix, false, camera.projMatrix);
@@ -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, rotationMatrixConjugate);
124
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a, rotationMatrix);
125
125
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
126
126
  } else {
127
127
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -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, rotationMatrixConjugate);
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, rotationMatrixConjugate);
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, rotationMatrixConjugate);
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,7 +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 {rotationMatrixConjugate} = model;
35
+ const {rotationMatrix} = model;
36
36
 
37
37
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
38
38
  const projMatrix = frameCtx.pickProjMatrix || camera.projMatrix;
@@ -94,7 +94,7 @@ export class DTXTrianglesPickNormalsRenderer {
94
94
  if (active) {
95
95
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
96
96
  if (origin) {
97
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a, rotationMatrixConjugate);
97
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a, rotationMatrix);
98
98
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
99
99
  } else {
100
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, rotationMatrixConjugate);
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, rotationMatrixConjugate);
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, rotationMatrixConjugate);
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, model.rotationMatrixConjugate);
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);