@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.
Files changed (46) hide show
  1. package/dist/xeokit-sdk.cjs.js +4332 -207
  2. package/dist/xeokit-sdk.es.js +4332 -208
  3. package/dist/xeokit-sdk.es5.js +221 -204
  4. package/dist/xeokit-sdk.min.cjs.js +10 -4
  5. package/dist/xeokit-sdk.min.es.js +11 -5
  6. package/dist/xeokit-sdk.min.es5.js +10 -4
  7. package/package.json +3 -1
  8. package/src/extras/ContextMenu/ContextMenu.js +11 -9
  9. package/src/plugins/AnnotationsPlugin/Annotation.js +28 -16
  10. package/src/plugins/CxConverterIFCLoaderPlugin/CxConverterIFCLoaderPlugin.js +86 -0
  11. package/src/plugins/CxConverterIFCLoaderPlugin/index.js +1 -0
  12. package/src/plugins/LASLoaderPlugin/LASDefaultDataSource.js +13 -1
  13. package/src/plugins/LASLoaderPlugin/LASLoaderPlugin.js +89 -43
  14. package/src/plugins/NavCubePlugin/CubeTextureCanvas.js +2 -2
  15. package/src/plugins/NavCubePlugin/NavCubePlugin.js +10 -10
  16. package/src/plugins/SectionPlanesPlugin/Control.js +2 -2
  17. package/src/plugins/TreeViewPlugin/TreeViewPlugin.js +4 -3
  18. package/src/plugins/ZonesPlugin/ZonesPlugin.js +6 -151
  19. package/src/plugins/index.js +1 -0
  20. package/src/plugins/lib/ui/index.js +592 -34
  21. package/src/viewer/scene/geometry/ReadableGeometry.js +60 -0
  22. package/src/viewer/scene/geometry/builders/buildPlaneGeometry.js +1 -1
  23. package/src/viewer/scene/math/math.js +14 -2
  24. package/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLineSnapInitRenderer.js +2 -0
  25. package/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapInitRenderer.js +2 -0
  26. package/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapRenderer.js +2 -0
  27. package/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapInitRenderer.js +2 -0
  28. package/src/viewer/scene/model/vbo/batching/points/renderers/VBOBatchingPointsSnapRenderer.js +2 -0
  29. package/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapInitRenderer.js +2 -0
  30. package/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapRenderer.js +2 -0
  31. package/src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapInitRenderer.js +1 -24
  32. package/src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapRenderer.js +2 -19
  33. package/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapInitRenderer.js +1 -24
  34. package/src/viewer/scene/model/vbo/instancing/points/renderers/VBOInstancingPointsSnapRenderer.js +1 -19
  35. package/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapInitRenderer.js +1 -24
  36. package/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapRenderer.js +2 -19
  37. package/src/viewer/scene/scene/Scene.js +2 -3
  38. package/src/viewer/scene/sectionCaps/SectionCaps.js +46 -65
  39. package/types/plugins/CxConverterIFCLoaderPlugin/CxConverterIFCLoaderPlugin.d.ts +36 -0
  40. package/types/plugins/CxConverterIFCLoaderPlugin/index.d.ts +1 -0
  41. package/types/plugins/NavCubePlugin/NavCubePlugin.d.ts +1 -1
  42. package/types/plugins/index.d.ts +1 -0
  43. package/types/viewer/scene/ImagePlane/ImagePlane.d.ts +397 -0
  44. package/types/viewer/scene/ImagePlane/index.d.ts +1 -0
  45. package/types/viewer/scene/geometry/builders/index.d.ts +1 -0
  46. package/types/viewer/scene/index.d.ts +1 -0
@@ -0,0 +1,397 @@
1
+ import {Component} from '../Component.js';
2
+ import {Node} from '../nodes/Node.js';
3
+ import {Mesh} from '../mesh/Mesh.js';
4
+ import {Texture} from '../materials/Texture.js';
5
+
6
+ /**
7
+ * @desc A plane-shaped 3D object containing a bitmap image.
8
+ *
9
+ * Use ````ImagePlane```` to embed bitmap images in your scenes.
10
+ *
11
+ * As shown in the examples below, ````ImagePlane```` is useful for creating ground planes from satellite maps and embedding 2D plan
12
+ * view images in cross-section slicing planes.
13
+ *
14
+ * # Example 1: Create a ground plane from a satellite image
15
+ *
16
+ * In our first example, we'll load the Schependomlaan model, then use
17
+ * an ````ImagePlane```` to create a ground plane, which will contain
18
+ * a satellite image sourced from Google Maps.
19
+ *
20
+ * <img src="http://xeokit.io/img/docs/ImagePlane/schependomlaanGoogleSatMapMed.png">
21
+ *
22
+ * [<img src="http://xeokit.io/img/docs/ImagePlane/ImagePlane.png">](https://xeokit.github.io/xeokit-sdk/examples/scenegraph/#ImagePlane_groundPlane)
23
+ *
24
+ * [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/scenegraph/#ImagePlane_groundPlane)]
25
+ *
26
+ * ````javascript
27
+ * import {Viewer, ImagePlane, XKTLoaderPlugin} from "xeokit-sdk.es.js";
28
+ *
29
+ * const viewer = new Viewer({
30
+ * canvasId: "myCanvas",
31
+ * transparent: true
32
+ * });
33
+ *
34
+ * viewer.camera.eye = [-8.31, 42.21, 54.30];
35
+ * viewer.camera.look = [-0.86, 15.40, 14.90];
36
+ * viewer.camera.up = [0.10, 0.83, -0.54];
37
+ *
38
+ * const xktLoader = new XKTLoaderPlugin(viewer);
39
+ *
40
+ * xktLoader.load({ // Load IFC model
41
+ * id: "myModel",
42
+ * src: "./models/xkt/Schependomlaan.xkt",
43
+ * edges: true,
44
+ *
45
+ * rotation: [0, 22, 0], // Rotate, position and scale the model to align it correctly with the ImagePlane
46
+ * position: [-8, 0, 15],
47
+ * scale: [1.1, 1.1, 1.1]
48
+ * });
49
+ *
50
+ * new ImagePlane(viewer.scene, {
51
+ * src: "./images/schependomlaanSatMap.png", // Google satellite image; accepted file types are PNG and JPEG
52
+ * visible: true, // Show the ImagePlane
53
+ * gridVisible: true, // Show the grid - grid is only visible when ImagePlane is also visible
54
+ * size: 190, // Size of ImagePlane's longest edge
55
+ * position: [0, -1, 0], // World-space position of ImagePlane's center
56
+ * rotation: [0, 0, 0], // Euler angles for X, Y and Z
57
+ * opacity: 1.0, // Fully opaque
58
+ * collidable: false, // ImagePlane does not contribute to Scene boundary
59
+ * clippable: true, // ImagePlane can be clipped by SectionPlanes
60
+ * pickable: true // Allow the ground plane to be picked
61
+ * });
62
+ * ````
63
+ *<br>
64
+ *
65
+ * # Example 2: Embed an image in a cross-section plane
66
+ *
67
+ * In our second example, we'll load the Schependomlaan model again, then slice it in half with
68
+ * a {@link SectionPlanesPlugin}, then use an ````ImagePlane```` to embed a 2D plan view image in the slicing plane.
69
+ *
70
+ * <img src="http://xeokit.io/img/docs/ImagePlane/schependomlaanPlanViewMed.png">
71
+ *
72
+ * [<img src="http://xeokit.io/img/docs/ImagePlane/ImagePlane_planView.png">](https://xeokit.github.io/xeokit-sdk/examples/scenegraph/#ImagePlane_imageInSectionPlane)
73
+ *
74
+ * [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/scenegraph/#ImagePlane_imageInSectionPlane)]
75
+ *
76
+ * ````javascript
77
+ * import {Viewer, XKTLoaderPlugin, SectionPlanesPlugin, ImagePlane} from "xeokit-sdk.es.js";
78
+ *
79
+ * const viewer = new Viewer({
80
+ * canvasId: "myCanvas",
81
+ * transparent: true
82
+ * });
83
+ *
84
+ * viewer.camera.eye = [-9.11, 20.01, 5.13];
85
+ * viewer.camera.look = [9.07, 0.77, -9.78];
86
+ * viewer.camera.up = [0.47, 0.76, -0.38];
87
+ *
88
+ * const xktLoader = new XKTLoaderPlugin(viewer);
89
+ *
90
+ * const sectionPlanes = new SectionPlanesPlugin(viewer, {
91
+ * overviewVisible: false
92
+ * });
93
+ *
94
+ * model = xktLoader.load({
95
+ * id: "myModel",
96
+ * src: "./models/xkt/schependomlaan/schependomlaan.xkt",
97
+ * metaModelSrc: "./metaModels/schependomlaan/metaModel.json",
98
+ * edges: true,
99
+ * });
100
+ *
101
+ * const sectionPlane = sectionPlanes.createSectionPlane({
102
+ * id: "mySectionPlane",
103
+ * pos: [10.95, 1.95, -10.35],
104
+ * dir: [0.0, -1.0, 0.0]
105
+ * });
106
+ *
107
+ * const imagePlane = new ImagePlane(viewer.scene, {
108
+ * src: "./images/schependomlaanPlanView.png", // Plan view image; accepted file types are PNG and JPEG
109
+ * visible: true,
110
+ * gridVisible: true,
111
+ * size: 23.95,
112
+ * position: sectionPlane.pos,
113
+ * dir: sectionPlane.dir,
114
+ * collidable: false,
115
+ * opacity: 0.75,
116
+ * clippable: false, // Don't allow ImagePlane to be clipped by the SectionPlane
117
+ * pickable: false // Don't allow ImagePlane to be picked
118
+ * });
119
+ * ````
120
+ */
121
+ export declare class ImagePlane extends Component {
122
+ /**
123
+ * @constructor
124
+ * @param {Component} [owner] Owner component. When destroyed, the owner will destroy this ImagePlane as well.
125
+ * @param {*} [cfg] ImagePlane configuration
126
+ * @param {String} [cfg.id] Optional ID, unique among all components in the parent Scene, generated automatically when omitted.
127
+ * @param {Boolean} [cfg.visible=true] Indicates whether or not this ImagePlane is visible.
128
+ * @param {Boolean} [cfg.gridVisible=true] Indicates whether or not the grid is visible. Grid is only visible when ImagePlane is also visible.
129
+ * @param {Number[]} [cfg.position=[0,0,0]] World-space position of the ImagePlane.
130
+ * @param {Number[]} [cfg.size=1] World-space size of the longest edge of the ImagePlane.
131
+ * @param {Number[]} [cfg.rotation=[0,0,0]] Local rotation of the ImagePlane, as Euler angles given in degrees, for each of the X, Y and Z axis.
132
+ * @param {Number[]} [cfg.matrix=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]] Modelling transform matrix for the ImagePlane. Overrides the position, size, rotation and dir parameters.
133
+ * @param {Boolean} [cfg.collidable=true] Indicates if the ImagePlane is initially included in boundary calculations.
134
+ * @param {Boolean} [cfg.clippable=true] Indicates if the ImagePlane is initially clippable.
135
+ * @param {Boolean} [cfg.pickable=true] Indicates if the ImagePlane is initially pickable.
136
+ * @param {Number} [cfg.opacity=1.0] ImagePlane's initial opacity factor, multiplies by the rendered fragment alpha.
137
+ * @param {String} [cfg.src] URL of image. Accepted file types are PNG and JPEG.
138
+ * @param {HTMLImageElement} [cfg.image] An HTMLImageElement to source the image from. Overrides src.
139
+ */
140
+ constructor(owner: Component, cfg?: {
141
+ id?: string;
142
+ visible?: boolean;
143
+ gridVisible?: boolean;
144
+ position?: number[];
145
+ size?: number;
146
+ rotation?: number[];
147
+ matrix?: number[];
148
+ collidable?: boolean;
149
+ clippable?: boolean;
150
+ pickable?: boolean;
151
+ opacity?: number;
152
+ src?: string;
153
+ image?: HTMLImageElement;
154
+ dir?: number[];
155
+ });
156
+
157
+ /**
158
+ * Sets if this ````ImagePlane```` is visible or not.
159
+ *
160
+ * Default value is ````true````.
161
+ *
162
+ * @param {Boolean} visible Set ````true```` to make this ````ImagePlane```` visible.
163
+ */
164
+ set visible(visible: boolean);
165
+
166
+ /**
167
+ * Gets if this ````ImagePlane```` is visible or not.
168
+ *
169
+ * Default value is ````true````.
170
+ *
171
+ * @returns {Boolean} Returns ````true```` if visible.
172
+ */
173
+ get visible(): boolean;
174
+
175
+ /**
176
+ * Sets if this ````ImagePlane````'s grid is visible or not.
177
+ *
178
+ * Default value is ````false````.
179
+ *
180
+ * Grid is only visible when ````ImagePlane```` is also visible.
181
+ *
182
+ * @param {Boolean} visible Set ````true```` to make this ````ImagePlane````'s grid visible.
183
+ */
184
+ set gridVisible(visible: boolean);
185
+
186
+ /**
187
+ * Gets if this ````ImagePlane````'s grid is visible or not.
188
+ *
189
+ * Default value is ````false````.
190
+ *
191
+ * @returns {Boolean} Returns ````true```` if visible.
192
+ */
193
+ get gridVisible(): boolean;
194
+
195
+ /**
196
+ * Sets an ````HTMLImageElement```` to source the image from.
197
+ *
198
+ * Sets {@link Texture#src} null.
199
+ *
200
+ * @type {HTMLImageElement}
201
+ */
202
+ set image(image: HTMLImageElement | null);
203
+
204
+ /**
205
+ * Gets the ````HTMLImageElement```` the ````ImagePlane````'s image is sourced from, if set.
206
+ *
207
+ * Returns null if not set.
208
+ *
209
+ * @type {HTMLImageElement}
210
+ */
211
+ get image(): HTMLImageElement | null;
212
+
213
+ /**
214
+ * Sets an image file path that the ````ImagePlane````'s image is sourced from.
215
+ *
216
+ * Accepted file types are PNG and JPEG.
217
+ *
218
+ * Sets {@link Texture#image} null.
219
+ *
220
+ * @type {String}
221
+ */
222
+ set src(src: string | null);
223
+
224
+ /**
225
+ * Gets the image file path that the ````ImagePlane````'s image is sourced from, if set.
226
+ *
227
+ * Returns null if not set.
228
+ *
229
+ * @type {String}
230
+ */
231
+ get src(): string | null;
232
+
233
+ /**
234
+ * Sets the World-space position of this ````ImagePlane````.
235
+ *
236
+ * Default value is ````[0, 0, 0]````.
237
+ *
238
+ * @param {Number[]} value New position.
239
+ */
240
+ set position(value: number[]);
241
+
242
+ /**
243
+ * Gets the World-space position of this ````ImagePlane````.
244
+ *
245
+ * Default value is ````[0, 0, 0]````.
246
+ *
247
+ * @returns {Number[]} Current position.
248
+ */
249
+ get position(): number[];
250
+
251
+ /**
252
+ * Sets the direction of this ````ImagePlane```` using Euler angles.
253
+ *
254
+ * Default value is ````[0, 0, 0]````.
255
+ *
256
+ * @param {Number[]} value Euler angles for ````X````, ````Y```` and ````Z```` axis rotations.
257
+ */
258
+ set rotation(value: number[]);
259
+
260
+ /**
261
+ * Gets the direction of this ````ImagePlane```` as Euler angles.
262
+ *
263
+ * @returns {Number[]} Euler angles for ````X````, ````Y```` and ````Z```` axis rotations.
264
+ */
265
+ get rotation(): number[];
266
+
267
+ /**
268
+ * Sets the World-space size of the longest edge of the ````ImagePlane````.
269
+ *
270
+ * Note that ````ImagePlane```` sets its aspect ratio to match its image. If we set a value of ````1000````, and
271
+ * the image has size ````400x300````, then the ````ImagePlane```` will then have size ````1000 x 750````.
272
+ *
273
+ * Default value is ````1.0````.
274
+ *
275
+ * @param {Number} size New World-space size of the ````ImagePlane````.
276
+ */
277
+ set size(size: number);
278
+
279
+ /**
280
+ * Gets the World-space size of the longest edge of the ````ImagePlane````.
281
+ *
282
+ * @returns {Number} World-space size of the ````ImagePlane````.
283
+ */
284
+ get size(): number;
285
+
286
+ /**
287
+ * Sets the direction of this ````ImagePlane```` as a direction vector.
288
+ *
289
+ * Default value is ````[0, 0, -1]````.
290
+ *
291
+ * @param {Number[]} dir New direction vector.
292
+ */
293
+ set dir(dir: number[]);
294
+
295
+ /**
296
+ * Gets the direction of this ````ImagePlane```` as a direction vector.
297
+ *
298
+ * @returns {Number[]} value Current direction.
299
+ */
300
+ get dir(): number[];
301
+
302
+ /**
303
+ * Sets if this ````ImagePlane```` is included in boundary calculations.
304
+ *
305
+ * Default is ````true````.
306
+ *
307
+ * @type {Boolean}
308
+ */
309
+ set collidable(value: boolean);
310
+
311
+ /**
312
+ * Gets if this ````ImagePlane```` is included in boundary calculations.
313
+ *
314
+ * Default is ````true````.
315
+ *
316
+ * @type {Boolean}
317
+ */
318
+ get collidable(): boolean;
319
+
320
+ /**
321
+ * Sets if this ````ImagePlane```` is clippable.
322
+ *
323
+ * Clipping is done by the {@link SectionPlane}s in {@link Scene#sectionPlanes}.
324
+ *
325
+ * Default is ````true````.
326
+ *
327
+ * @type {Boolean}
328
+ */
329
+ set clippable(value: boolean);
330
+
331
+ /**
332
+ * Gets if this ````ImagePlane```` is clippable.
333
+ *
334
+ * Clipping is done by the {@link SectionPlane}s in {@link Scene#sectionPlanes}.
335
+ *
336
+ * Default is ````true````.
337
+ *
338
+ * @type {Boolean}
339
+ */
340
+ get clippable(): boolean;
341
+
342
+ /**
343
+ * Sets if this ````ImagePlane```` is pickable.
344
+ *
345
+ * Default is ````true````.
346
+ *
347
+ * @type {Boolean}
348
+ */
349
+ set pickable(value: boolean);
350
+
351
+ /**
352
+ * Gets if this ````ImagePlane```` is pickable.
353
+ *
354
+ * Default is ````true````.
355
+ *
356
+ * @type {Boolean}
357
+ */
358
+ get pickable(): boolean;
359
+
360
+ /**
361
+ * Sets the opacity factor for this ````ImagePlane````.
362
+ *
363
+ * This is a factor in range ````[0..1]```` which multiplies by the rendered fragment alphas.
364
+ *
365
+ * @type {Number}
366
+ */
367
+ set opacity(opacity: number);
368
+
369
+ /**
370
+ * Gets this ````ImagePlane````'s opacity factor.
371
+ *
372
+ * This is a factor in range ````[0..1]```` which multiplies by the rendered fragment alphas.
373
+ *
374
+ * @type {Number}
375
+ */
376
+ get opacity(): number;
377
+
378
+ /**
379
+ * @destroy
380
+ */
381
+ destroy(): void;
382
+
383
+ protected _node: Node;
384
+ protected _plane: Mesh;
385
+ protected _grid: Mesh;
386
+ protected _texture: Texture;
387
+ protected _src: string | null;
388
+ protected _image: HTMLImageElement | null;
389
+ protected _pos: Float32Array;
390
+ protected _origin: Float32Array;
391
+ protected _rtcPos: Float32Array;
392
+ protected _dir: Float32Array;
393
+ protected _size: number;
394
+ protected _imageSize: Float32Array;
395
+ protected _gridVisible: boolean;
396
+ protected _updatePlaneSizeFromImage(): void;
397
+ }
@@ -0,0 +1 @@
1
+ export * from "./ImagePlane";
@@ -3,6 +3,7 @@ export * from "./buildBoxLinesGeometry";
3
3
  export * from "./buildCylinderGeometry";
4
4
  export * from "./buildGridGeometry";
5
5
  export * from "./buildPlaneGeometry";
6
+ export * from "./buildPolylineGeometry";
6
7
  export * from "./buildSphereGeometry";
7
8
  export * from "./buildTorusGeometry";
8
9
  export * from "./buildVectorTextGeometry";
@@ -18,3 +18,4 @@ export * from "./sectionPlane";
18
18
  export * from "./stats";
19
19
  export * from "./viewport";
20
20
  export * from "./webgl";
21
+ export * from "./ImagePlane";