@xeokit/xeokit-sdk 2.6.69 → 2.6.72
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 +4332 -207
- package/dist/xeokit-sdk.es.js +4332 -208
- package/dist/xeokit-sdk.es5.js +221 -204
- package/dist/xeokit-sdk.min.cjs.js +10 -4
- package/dist/xeokit-sdk.min.es.js +11 -5
- package/dist/xeokit-sdk.min.es5.js +10 -4
- package/package.json +3 -1
- package/src/extras/ContextMenu/ContextMenu.js +11 -9
- package/src/plugins/AnnotationsPlugin/Annotation.js +28 -16
- package/src/plugins/CxConverterIFCLoaderPlugin/CxConverterIFCLoaderPlugin.js +86 -0
- package/src/plugins/CxConverterIFCLoaderPlugin/index.js +1 -0
- package/src/plugins/LASLoaderPlugin/LASDefaultDataSource.js +13 -1
- package/src/plugins/LASLoaderPlugin/LASLoaderPlugin.js +89 -43
- package/src/plugins/NavCubePlugin/CubeTextureCanvas.js +2 -2
- package/src/plugins/NavCubePlugin/NavCubePlugin.js +10 -10
- package/src/plugins/SectionPlanesPlugin/Control.js +2 -2
- package/src/plugins/TreeViewPlugin/TreeViewPlugin.js +4 -3
- package/src/plugins/ZonesPlugin/ZonesPlugin.js +6 -151
- package/src/plugins/index.js +1 -0
- package/src/plugins/lib/ui/index.js +592 -34
- package/src/viewer/scene/geometry/ReadableGeometry.js +60 -0
- package/src/viewer/scene/geometry/builders/buildPlaneGeometry.js +1 -1
- package/src/viewer/scene/math/math.js +14 -2
- package/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLineSnapInitRenderer.js +2 -0
- package/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapInitRenderer.js +2 -0
- package/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapRenderer.js +2 -0
- package/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapInitRenderer.js +2 -0
- package/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapRenderer.js +2 -0
- package/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js +2 -0
- package/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapRenderer.js +2 -0
- package/src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapInitRenderer.js +1 -24
- package/src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapRenderer.js +2 -19
- package/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapInitRenderer.js +1 -24
- package/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapRenderer.js +1 -19
- package/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapInitRenderer.js +1 -24
- package/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapRenderer.js +2 -19
- package/src/viewer/scene/scene/Scene.js +2 -3
- package/src/viewer/scene/sectionCaps/SectionCaps.js +46 -65
- package/types/plugins/CxConverterIFCLoaderPlugin/CxConverterIFCLoaderPlugin.d.ts +36 -0
- package/types/plugins/CxConverterIFCLoaderPlugin/index.d.ts +1 -0
- package/types/plugins/NavCubePlugin/NavCubePlugin.d.ts +1 -1
- package/types/plugins/index.d.ts +1 -0
- package/types/viewer/scene/ImagePlane/ImagePlane.d.ts +397 -0
- package/types/viewer/scene/ImagePlane/index.d.ts +1 -0
- package/types/viewer/scene/geometry/builders/index.d.ts +1 -0
- package/types/viewer/scene/index.d.ts +1 -0
|
@@ -5,159 +5,13 @@ import {ReadableGeometry} from "../../viewer/scene/geometry/ReadableGeometry.js"
|
|
|
5
5
|
import {PhongMaterial} from "../../viewer/scene/materials/PhongMaterial.js";
|
|
6
6
|
import {math} from "../../viewer/scene/math/math.js";
|
|
7
7
|
import {Mesh} from "../../viewer/scene/mesh/Mesh.js";
|
|
8
|
-
import {activateDraggableDots, Dot3D,
|
|
8
|
+
import {activateDraggableDots, Dot3D, marker3D, wire3D, touchPointSelector, transformToNode, triangulateEarClipping} from "../../../src/plugins/lib/ui/index.js";
|
|
9
9
|
|
|
10
10
|
const hex2rgb = function(color) {
|
|
11
11
|
const rgb = idx => parseInt(color.substr(idx + 1, 2), 16) / 255;
|
|
12
12
|
return [ rgb(0), rgb(2), rgb(4) ];
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
const triangulateEarClipping = function(planeCoords) {
|
|
16
|
-
|
|
17
|
-
const polygonVertices = [ ];
|
|
18
|
-
for (let i = 0; i < planeCoords.length; ++i)
|
|
19
|
-
polygonVertices.push(i);
|
|
20
|
-
|
|
21
|
-
const isCCW = (function() {
|
|
22
|
-
const ba = math.vec2();
|
|
23
|
-
const bc = math.vec2();
|
|
24
|
-
|
|
25
|
-
let anglesSum = 0;
|
|
26
|
-
const angles = [ ];
|
|
27
|
-
|
|
28
|
-
for (let i = 0; i < polygonVertices.length; ++i)
|
|
29
|
-
{
|
|
30
|
-
const a = planeCoords[polygonVertices[i]];
|
|
31
|
-
const b = planeCoords[polygonVertices[(i + 1) % polygonVertices.length]];
|
|
32
|
-
const c = planeCoords[polygonVertices[(i + 2) % polygonVertices.length]];
|
|
33
|
-
|
|
34
|
-
math.subVec2(a, b, ba);
|
|
35
|
-
math.subVec2(c, b, bc);
|
|
36
|
-
|
|
37
|
-
const theta = math.dotVec2(ba, bc) / Math.sqrt(math.sqLenVec2(ba) * math.sqLenVec2(bc));
|
|
38
|
-
const angle = Math.acos(Math.max(-1, Math.min(theta, 1)));
|
|
39
|
-
const convex = (ba[0] * bc[1] - ba[1] * bc[0]) >= 0;
|
|
40
|
-
anglesSum += convex ? angle : (2 * Math.PI - angle);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return anglesSum < (polygonVertices.length * Math.PI);
|
|
44
|
-
})();
|
|
45
|
-
|
|
46
|
-
const pointInTriangle = (function() {
|
|
47
|
-
const sign = (p1, p2, p3) => {
|
|
48
|
-
return (p1[0] - p3[0]) * (p2[1] - p3[1]) - (p2[0] - p3[0]) * (p1[1] - p3[1]);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
return (pt, v1, v2, v3) => {
|
|
52
|
-
const d1 = sign(pt, v1, v2);
|
|
53
|
-
const d2 = sign(pt, v2, v3);
|
|
54
|
-
const d3 = sign(pt, v3, v1);
|
|
55
|
-
|
|
56
|
-
const has_neg = (d1 < 0) || (d2 < 0) || (d3 < 0);
|
|
57
|
-
const has_pos = (d1 > 0) || (d2 > 0) || (d3 > 0);
|
|
58
|
-
|
|
59
|
-
return !(has_neg && has_pos);
|
|
60
|
-
};
|
|
61
|
-
})();
|
|
62
|
-
|
|
63
|
-
const baseTriangles = [ ];
|
|
64
|
-
|
|
65
|
-
const vertices = (isCCW ? polygonVertices : polygonVertices.slice(0).reverse()).map(i => ({ idx: i }));
|
|
66
|
-
vertices.forEach((v, i) => {
|
|
67
|
-
v.prev = vertices[(i - 1 + vertices.length) % vertices.length];
|
|
68
|
-
v.next = vertices[(i + 1) % vertices.length];
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
const ba = math.vec2();
|
|
72
|
-
const bc = math.vec2();
|
|
73
|
-
|
|
74
|
-
while (vertices.length > 2) {
|
|
75
|
-
let earIdx = 0;
|
|
76
|
-
while (true) {
|
|
77
|
-
if (earIdx >= vertices.length)
|
|
78
|
-
{
|
|
79
|
-
throw `isCCW = ${isCCW}; earIdx = ${earIdx}; len = ${vertices.length}`;
|
|
80
|
-
}
|
|
81
|
-
const v = vertices[earIdx];
|
|
82
|
-
|
|
83
|
-
const a = planeCoords[v.prev.idx];
|
|
84
|
-
const b = planeCoords[v.idx];
|
|
85
|
-
const c = planeCoords[v.next.idx];
|
|
86
|
-
|
|
87
|
-
math.subVec2(a, b, ba);
|
|
88
|
-
math.subVec2(c, b, bc);
|
|
89
|
-
|
|
90
|
-
if (((ba[0] * bc[1] - ba[1] * bc[0]) >= 0) // a convex vertex
|
|
91
|
-
&&
|
|
92
|
-
vertices.every( // no other vertices inside
|
|
93
|
-
vv => ((vv === v)
|
|
94
|
-
||
|
|
95
|
-
(vv === v.prev)
|
|
96
|
-
||
|
|
97
|
-
(vv === v.next)
|
|
98
|
-
||
|
|
99
|
-
!pointInTriangle(planeCoords[vv.idx], a, b, c))))
|
|
100
|
-
break;
|
|
101
|
-
++earIdx;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
const ear = vertices[earIdx];
|
|
105
|
-
vertices.splice(earIdx, 1);
|
|
106
|
-
|
|
107
|
-
baseTriangles.push([ ear.idx, ear.next.idx, ear.prev.idx ]);
|
|
108
|
-
|
|
109
|
-
const prev = ear.prev;
|
|
110
|
-
prev.next = ear.next;
|
|
111
|
-
const next = ear.next;
|
|
112
|
-
next.prev = ear.prev;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return [ planeCoords, baseTriangles, isCCW ];
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
const marker3D = function(scene, color) {
|
|
119
|
-
const marker = new Dot3D(scene, {}, scene.canvas.canvas.parentNode, {
|
|
120
|
-
borderColor: "white",
|
|
121
|
-
fillColor: color,
|
|
122
|
-
zIndex: 100
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
return {
|
|
126
|
-
update: function(worldPos) {
|
|
127
|
-
if (worldPos)
|
|
128
|
-
{
|
|
129
|
-
marker.worldPos = worldPos;
|
|
130
|
-
}
|
|
131
|
-
marker.setVisible(!!worldPos);
|
|
132
|
-
},
|
|
133
|
-
|
|
134
|
-
setHighlighted: h => marker.setHighlighted(h),
|
|
135
|
-
getCanvasPos: () => marker.canvasPos,
|
|
136
|
-
getWorldPos: () => marker.worldPos,
|
|
137
|
-
destroy: () => marker.destroy()
|
|
138
|
-
};
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
const wire3D = function(scene, color, startWorldPos) {
|
|
142
|
-
const wire = new Wire3D(scene, scene.canvas.canvas.ownerDocument.body, {
|
|
143
|
-
color: color,
|
|
144
|
-
thickness: 1,
|
|
145
|
-
thicknessClickable: 6
|
|
146
|
-
});
|
|
147
|
-
wire.setVisible(false);
|
|
148
|
-
return {
|
|
149
|
-
update: endWorldPos => {
|
|
150
|
-
if (endWorldPos)
|
|
151
|
-
{
|
|
152
|
-
wire.setEnds(startWorldPos, endWorldPos);
|
|
153
|
-
}
|
|
154
|
-
wire.setVisible(!!endWorldPos);
|
|
155
|
-
},
|
|
156
|
-
|
|
157
|
-
destroy: () => wire.destroy()
|
|
158
|
-
};
|
|
159
|
-
};
|
|
160
|
-
|
|
161
15
|
const basePolygon3D = function(scene, color, alpha) {
|
|
162
16
|
let mesh = null;
|
|
163
17
|
|
|
@@ -1160,7 +1014,8 @@ const startPolysurfaceZoneCreateUI = function(scene, zoneAltitude, zoneHeight, z
|
|
|
1160
1014
|
|
|
1161
1015
|
(function selectNextPoint(markers) {
|
|
1162
1016
|
const marker = marker3D(scene, zoneColor);
|
|
1163
|
-
const wire = (markers.length > 0) && wire3D(scene, zoneColor
|
|
1017
|
+
const wire = (markers.length > 0) && wire3D(scene, zoneColor);
|
|
1018
|
+
const wireStart = wire && markers[markers.length - 1].getWorldPos();
|
|
1164
1019
|
|
|
1165
1020
|
cleanups.push(() => {
|
|
1166
1021
|
marker.destroy();
|
|
@@ -1220,7 +1075,7 @@ const startPolysurfaceZoneCreateUI = function(scene, zoneAltitude, zoneHeight, z
|
|
|
1220
1075
|
() => {
|
|
1221
1076
|
updatePointerLens(null);
|
|
1222
1077
|
marker.update(null);
|
|
1223
|
-
wire && wire.update(null);
|
|
1078
|
+
wire && wire.update(wireStart, null);
|
|
1224
1079
|
basePolygon.updateBase((markers.length > 2) ? markers.map(m => m.getWorldPos()) : null);
|
|
1225
1080
|
},
|
|
1226
1081
|
(canvasPos, worldPos) => {
|
|
@@ -1228,7 +1083,7 @@ const startPolysurfaceZoneCreateUI = function(scene, zoneAltitude, zoneHeight, z
|
|
|
1228
1083
|
firstMarker && firstMarker.setHighlighted(!! snappedFirst);
|
|
1229
1084
|
updatePointerLens(snappedFirst ? snappedFirst.canvasPos : canvasPos);
|
|
1230
1085
|
marker.update((! snappedFirst) && worldPos);
|
|
1231
|
-
wire && wire.update(snappedFirst ? snappedFirst.worldPos : worldPos);
|
|
1086
|
+
wire && wire.update(wireStart, snappedFirst ? snappedFirst.worldPos : worldPos);
|
|
1232
1087
|
if ((markers.length >= 2))
|
|
1233
1088
|
{
|
|
1234
1089
|
const pos = markers.map(m => m.getWorldPos()).concat(snappedFirst ? [] : [worldPos]);
|
|
@@ -1272,7 +1127,7 @@ const startPolysurfaceZoneCreateUI = function(scene, zoneAltitude, zoneHeight, z
|
|
|
1272
1127
|
else
|
|
1273
1128
|
{
|
|
1274
1129
|
marker.update(worldPos);
|
|
1275
|
-
wire && wire.update(worldPos);
|
|
1130
|
+
wire && wire.update(wireStart, worldPos);
|
|
1276
1131
|
selectNextPoint(markers.concat(marker));
|
|
1277
1132
|
}
|
|
1278
1133
|
});
|
package/src/plugins/index.js
CHANGED
|
@@ -17,6 +17,7 @@ export * from "./ViewCullPlugin/index.js";
|
|
|
17
17
|
export * from "./XKTLoaderPlugin/index.js";
|
|
18
18
|
export * from "./XML3DLoaderPlugin/index.js";
|
|
19
19
|
export * from "./WebIFCLoaderPlugin/index.js";
|
|
20
|
+
export * from "./CxConverterIFCLoaderPlugin/index.js";
|
|
20
21
|
export * from "./LASLoaderPlugin/index.js";
|
|
21
22
|
export * from "./CityJSONLoaderPlugin/index.js";
|
|
22
23
|
export * from "./DotBIMLoaderPlugin/index.js";
|