@xeokit/xeokit-sdk 2.6.48 → 2.6.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/xeokit-sdk.cjs.js +67 -74
- package/dist/xeokit-sdk.es.js +67 -74
- package/dist/xeokit-sdk.es5.js +42 -42
- package/dist/xeokit-sdk.min.cjs.js +3 -3
- package/dist/xeokit-sdk.min.es.js +3 -3
- package/dist/xeokit-sdk.min.es5.js +3 -3
- package/package.json +1 -1
- package/src/viewer/Viewer.js +6 -0
- package/src/viewer/scene/math/rtcCoords.js +4 -4
- package/src/viewer/scene/model/SceneModel.js +16 -31
- package/src/viewer/scene/model/dtx/lines/renderers/DTXLinesColorRenderer.js +2 -2
- package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesColorRenderer.js +2 -2
- package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesDepthRenderer.js +2 -2
- package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesColorRenderer.js +2 -2
- package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesEdgesRenderer.js +2 -2
- package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesNormalsRenderer.js +2 -2
- package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesOcclusionRenderer.js +2 -2
- package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js +2 -2
- package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js +2 -2
- package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js +2 -2
- package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsRenderer.js +1 -2
- package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSilhouetteRenderer.js +2 -2
- package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js +2 -2
- package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js +2 -2
- package/src/viewer/scene/model/vbo/VBORenderer.js +2 -2
- package/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLineSnapInitRenderer.js +1 -1
- package/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapInitRenderer.js +1 -1
- package/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapRenderer.js +1 -1
- package/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapInitRenderer.js +5 -1
- package/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapRenderer.js +1 -1
- package/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js +1 -1
- package/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapRenderer.js +1 -1
- package/src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapInitRenderer.js +1 -1
- package/src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapRenderer.js +1 -1
- package/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapInitRenderer.js +1 -1
- package/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapRenderer.js +1 -1
- package/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapInitRenderer.js +1 -1
- package/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapRenderer.js +1 -1
package/package.json
CHANGED
package/src/viewer/Viewer.js
CHANGED
|
@@ -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,
|
|
134
|
-
const rtcCenter = (
|
|
135
|
-
? (tempVec4.set(rtcOrigin, 0), tempVec4[3] = 1, math.mulMat4v4(
|
|
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
|
-
|
|
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
|
-
|
|
1599
|
-
this._rebuildMatrices();
|
|
1600
|
-
}
|
|
1596
|
+
this._rebuildMatrices();
|
|
1601
1597
|
return this._worldRotationMatrix;
|
|
1602
1598
|
}
|
|
1603
1599
|
|
|
@@ -1609,6 +1605,7 @@ export class SceneModel extends Component {
|
|
|
1609
1605
|
this._matrix.set(this._worldRotationMatrix);
|
|
1610
1606
|
math.translateMat4v(this._position, this._matrix);
|
|
1611
1607
|
this._matrixDirty = false;
|
|
1608
|
+
this._viewMatrixDirty = true;
|
|
1612
1609
|
}
|
|
1613
1610
|
}
|
|
1614
1611
|
|
|
@@ -1620,9 +1617,7 @@ export class SceneModel extends Component {
|
|
|
1620
1617
|
* @type {Number[]}
|
|
1621
1618
|
*/
|
|
1622
1619
|
get rotationMatrixConjugate() {
|
|
1623
|
-
|
|
1624
|
-
this._rebuildMatrices();
|
|
1625
|
-
}
|
|
1620
|
+
this._rebuildMatrices();
|
|
1626
1621
|
return this._worldRotationMatrixConjugate;
|
|
1627
1622
|
}
|
|
1628
1623
|
|
|
@@ -1666,6 +1661,16 @@ export class SceneModel extends Component {
|
|
|
1666
1661
|
return this._worldNormalMatrix;
|
|
1667
1662
|
}
|
|
1668
1663
|
|
|
1664
|
+
_rebuildViewMatrices() {
|
|
1665
|
+
this._rebuildMatrices();
|
|
1666
|
+
if (this._viewMatrixDirty) {
|
|
1667
|
+
math.mulMat4(this.scene.camera.viewMatrix, this._matrix, this._viewMatrix);
|
|
1668
|
+
math.inverseMat4(this._viewMatrix, this._viewNormalMatrix);
|
|
1669
|
+
math.transposeMat4(this._viewNormalMatrix);
|
|
1670
|
+
this._viewMatrixDirty = false;
|
|
1671
|
+
}
|
|
1672
|
+
}
|
|
1673
|
+
|
|
1669
1674
|
/**
|
|
1670
1675
|
* Called by private renderers in ./lib, returns the view matrix with which to
|
|
1671
1676
|
* render this SceneModel. The view matrix is the concatenation of the
|
|
@@ -1677,16 +1682,7 @@ export class SceneModel extends Component {
|
|
|
1677
1682
|
if (!this._viewMatrix) {
|
|
1678
1683
|
return this.scene.camera.viewMatrix;
|
|
1679
1684
|
}
|
|
1680
|
-
|
|
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
|
-
}
|
|
1685
|
+
this._rebuildViewMatrices();
|
|
1690
1686
|
return this._viewMatrix;
|
|
1691
1687
|
}
|
|
1692
1688
|
|
|
@@ -1699,18 +1695,7 @@ export class SceneModel extends Component {
|
|
|
1699
1695
|
if (!this._viewNormalMatrix) {
|
|
1700
1696
|
return this.scene.camera.viewNormalMatrix;
|
|
1701
1697
|
}
|
|
1702
|
-
|
|
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);
|
|
1698
|
+
this._rebuildViewMatrices();
|
|
1714
1699
|
return this._viewNormalMatrix;
|
|
1715
1700
|
}
|
|
1716
1701
|
|
|
@@ -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
|
|
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,
|
|
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
|
|
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,
|
|
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
|
|
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,
|
|
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
|
|
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,
|
|
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
|
|
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,
|
|
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
|
|
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,
|
|
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
|
|
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,
|
|
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
|
|
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,
|
|
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
|
|
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,
|
|
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);
|
package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js
CHANGED
|
@@ -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
|
|
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,
|
|
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,
|
|
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
|
|
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,
|
|
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
|
|
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,
|
|
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
|
|
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,
|
|
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.
|
|
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,
|
|
442
|
+
const {position, rotationMatrix, worldNormalMatrix} = model;
|
|
443
443
|
|
|
444
444
|
if (!this._program) {
|
|
445
445
|
this._allocate();
|
package/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLineSnapInitRenderer.js
CHANGED
|
@@ -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
|
|
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
|
|
package/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapInitRenderer.js
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
package/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapInitRenderer.js
CHANGED
|
@@ -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
|
|
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;
|
package/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapRenderer.js
CHANGED
|
@@ -39,7 +39,7 @@ export class VBOBatchingPointsSnapRenderer 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
|
|
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
|
|
package/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js
CHANGED
|
@@ -35,7 +35,7 @@ export class TrianglesSnapInitRenderer 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
|
|
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
|
|
|
@@ -38,7 +38,7 @@ export class TrianglesSnapRenderer extends VBORenderer{
|
|
|
38
38
|
const gl = scene.canvas.gl;
|
|
39
39
|
const state = batchingLayer._state;
|
|
40
40
|
const origin = batchingLayer._state.origin;
|
|
41
|
-
const {position, rotationMatrix
|
|
41
|
+
const {position, rotationMatrix} = model;
|
|
42
42
|
const aabb = batchingLayer.aabb; // Per-layer AABB for best RTC accuracy
|
|
43
43
|
const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
|
|
44
44
|
|
package/src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapInitRenderer.js
CHANGED
|
@@ -39,7 +39,7 @@ export class VBOInstancingLinesSnapInitRenderer extends VBORenderer {
|
|
|
39
39
|
const camera = scene.camera;
|
|
40
40
|
const state = instancingLayer._state;
|
|
41
41
|
const origin = instancingLayer._state.origin;
|
|
42
|
-
const {position, rotationMatrix
|
|
42
|
+
const {position, rotationMatrix} = model;
|
|
43
43
|
const aabb = instancingLayer.aabb; // Per-layer AABB for best RTC accuracy
|
|
44
44
|
const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
|
|
45
45
|
|
package/src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapRenderer.js
CHANGED
|
@@ -39,7 +39,7 @@ export class VBOInstancingLinesSnapRenderer extends VBORenderer {
|
|
|
39
39
|
const gl = scene.canvas.gl;
|
|
40
40
|
const state = instancingLayer._state;
|
|
41
41
|
const origin = instancingLayer._state.origin;
|
|
42
|
-
const {position, rotationMatrix
|
|
42
|
+
const {position, rotationMatrix} = model;
|
|
43
43
|
const aabb = instancingLayer.aabb; // Per-layer AABB for best RTC accuracy
|
|
44
44
|
const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
|
|
45
45
|
|
|
@@ -39,7 +39,7 @@ export class VBOInstancingPointsSnapInitRenderer extends VBORenderer {
|
|
|
39
39
|
const camera = scene.camera;
|
|
40
40
|
const state = instancingLayer._state;
|
|
41
41
|
const origin = instancingLayer._state.origin;
|
|
42
|
-
const {position, rotationMatrix
|
|
42
|
+
const {position, rotationMatrix} = model;
|
|
43
43
|
const aabb = instancingLayer.aabb; // Per-layer AABB for best RTC accuracy
|
|
44
44
|
const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
|
|
45
45
|
|
package/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapRenderer.js
CHANGED
|
@@ -39,7 +39,7 @@ export class VBOInstancingPointsSnapRenderer extends VBORenderer {
|
|
|
39
39
|
const gl = scene.canvas.gl;
|
|
40
40
|
const state = instancingLayer._state;
|
|
41
41
|
const origin = instancingLayer._state.origin;
|
|
42
|
-
const {position, rotationMatrix
|
|
42
|
+
const {position, rotationMatrix} = model;
|
|
43
43
|
const aabb = instancingLayer.aabb; // Per-layer AABB for best RTC accuracy
|
|
44
44
|
const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
|
|
45
45
|
|
package/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapInitRenderer.js
CHANGED
|
@@ -39,7 +39,7 @@ export class TrianglesSnapInitRenderer extends VBORenderer {
|
|
|
39
39
|
const camera = scene.camera;
|
|
40
40
|
const state = instancingLayer._state;
|
|
41
41
|
const origin = instancingLayer._state.origin;
|
|
42
|
-
const {position, rotationMatrix
|
|
42
|
+
const {position, rotationMatrix} = model;
|
|
43
43
|
const aabb = instancingLayer.aabb; // Per-layer AABB for best RTC accuracy
|
|
44
44
|
const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
|
|
45
45
|
|
|
@@ -39,7 +39,7 @@ export class TrianglesSnapRenderer extends VBORenderer {
|
|
|
39
39
|
const gl = scene.canvas.gl;
|
|
40
40
|
const state = instancingLayer._state;
|
|
41
41
|
const origin = instancingLayer._state.origin;
|
|
42
|
-
const {position, rotationMatrix
|
|
42
|
+
const {position, rotationMatrix} = model;
|
|
43
43
|
const aabb = instancingLayer.aabb; // Per-layer AABB for best RTC accuracy
|
|
44
44
|
const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
|
|
45
45
|
|