@xeokit/xeokit-sdk 2.6.65 → 2.6.67

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/{LICENSE.txt → LICENSE} +30 -27
  2. package/README.md +13 -6
  3. package/dist/xeokit-sdk.cjs.js +50322 -25848
  4. package/dist/xeokit-sdk.es.js +50322 -25848
  5. package/dist/xeokit-sdk.es5.js +7982 -4807
  6. package/dist/xeokit-sdk.min.cjs.js +5 -5
  7. package/dist/xeokit-sdk.min.es.js +5 -5
  8. package/dist/xeokit-sdk.min.es5.js +4 -4
  9. package/package.json +34 -32
  10. package/src/extras/PointerCircle/PointerCircle.js +1 -1
  11. package/src/plugins/AnnotationsPlugin/Annotation.js +45 -5
  12. package/src/plugins/CityJSONLoaderPlugin/CityJSONLoaderPlugin.js +1 -1
  13. package/src/plugins/GLTFLoaderPlugin/GLTFSceneModelLoader.js +3 -2
  14. package/src/plugins/LASLoaderPlugin/LASLoaderPlugin.js +1 -1
  15. package/src/plugins/SectionPlanesPlugin/Control.js +11 -12
  16. package/src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js +57 -2
  17. package/src/plugins/XKTLoaderPlugin/parsers/ParserV10.js +6 -0
  18. package/src/plugins/XKTLoaderPlugin/parsers/ParserV11.js +6 -0
  19. package/src/plugins/XKTLoaderPlugin/parsers/ParserV12.js +822 -0
  20. package/src/plugins/XKTLoaderPlugin/parsers/ParserV6.js +6 -0
  21. package/src/plugins/XKTLoaderPlugin/parsers/ParserV7.js +6 -0
  22. package/src/plugins/XKTLoaderPlugin/parsers/ParserV8.js +6 -0
  23. package/src/plugins/XKTLoaderPlugin/parsers/ParserV9.js +6 -0
  24. package/src/{plugins/lib → viewer/scene/libs}/earcut.js +194 -189
  25. package/src/viewer/scene/materials/EmphasisMaterial.js +5 -1
  26. package/src/viewer/scene/math/math.js +6 -2
  27. package/src/viewer/scene/model/SceneModel.js +1 -0
  28. package/src/viewer/scene/model/SceneModelEntity.js +26 -0
  29. package/src/viewer/scene/model/SceneModelMesh.js +4 -0
  30. package/src/viewer/scene/model/dtx/triangles/DTXTrianglesLayer.js +1 -1
  31. package/src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js +1 -1
  32. package/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesColorRenderer.js +4 -1
  33. package/src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js +1 -1
  34. package/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesColorRenderer.js +4 -1
  35. package/src/viewer/scene/scene/Scene.js +50 -6
  36. package/src/viewer/scene/sectionCaps/SectionCaps.js +774 -0
  37. package/src/viewer/scene/sectionCaps/index.js +1 -0
  38. package/src/viewer/scene/sectionPlane/SectionPlane.js +79 -1
  39. package/src/viewer/scene/webgl/Renderer.js +19 -10
  40. package/types/extras/PointerCircle/PointerCircle.d.ts +50 -0
  41. package/types/extras/PointerCircle/index.d.ts +1 -0
  42. package/types/plugins/WebIFCLoaderPlugin/WebIFCLoaderPlugin.d.ts +2 -1
  43. package/types/plugins/XKTLoaderPlugin/XKTLoaderPlugin.d.ts +28 -0
  44. package/types/plugins/index.d.ts +1 -0
  45. package/types/plugins/lib/ui/index.d.ts +12 -0
  46. package/types/viewer/scene/models/SceneModelMesh.d.ts +7 -0
@@ -0,0 +1 @@
1
+ export * from "./SectionCaps.js";
@@ -3,6 +3,11 @@ import {RenderState} from '../webgl/RenderState.js';
3
3
  import {math} from "../math/math.js";
4
4
 
5
5
  const tempVec3a = math.vec3();
6
+ const tempVec3b = math.vec3();
7
+ const tempVec4a = math.vec4();
8
+ const front = math.vec3([0, 0, -1]);
9
+ const back = math.vec3([0, 0, 1]);
10
+ const up = math.vec3([0, 1, 0]);
6
11
 
7
12
  /**
8
13
  * @desc An arbitrarily-aligned World-space clipping plane.
@@ -74,6 +79,8 @@ class SectionPlane extends Component {
74
79
  this._state = new RenderState({
75
80
  active: true,
76
81
  pos: math.vec3(),
82
+ quaternion: math.vec4(),
83
+ roll: 0,
77
84
  dir: math.vec3(),
78
85
  dist: 0
79
86
  });
@@ -135,6 +142,59 @@ class SectionPlane extends Component {
135
142
  return this._state.pos;
136
143
  }
137
144
 
145
+ /**
146
+ * Sets the quaternion of this SectionPlane's plane.
147
+ *
148
+ * Default value is ````[0, -1, 0, 0]````.
149
+ *
150
+ * @param {Number[]} value New quaternion.
151
+ */
152
+ set quaternion(value) {
153
+ this._state.quaternion.set(value || [0, 0, 0, -1]);
154
+ math.vec3ApplyQuaternion(this._state.quaternion, back, this._state.dir);
155
+ const quatUp = math.vec3ApplyQuaternion(this._state.quaternion, up, tempVec3a);
156
+ const dirOnlyQ = math.vec3PairToQuaternion(back, this._state.dir, tempVec4a);
157
+ const dirOnlyUp = math.vec3ApplyQuaternion(dirOnlyQ, up, tempVec3b);
158
+ const angle = Math.acos(Math.min(1, math.dotVec3(quatUp, dirOnlyUp)));
159
+ const sign = Math.sign(math.dotVec3(this._state.dir, math.cross3Vec3(quatUp, dirOnlyUp, tempVec3b)));
160
+ this._state.roll = sign * angle;
161
+ this._onDirUpdated();
162
+ }
163
+
164
+ /**
165
+ * Gets the quaternion of this SectionPlane's plane.
166
+ *
167
+ * Default value is ````[0, -1, 0, 0]````.
168
+ *
169
+ * @returns {Number[]} value Current quaternion.
170
+ */
171
+ get quaternion() {
172
+ return this._state.quaternion;
173
+ }
174
+
175
+ /**
176
+ * Sets the roll of this SectionPlane's plane.
177
+ *
178
+ * Default value is ````0````.
179
+ *
180
+ * @param {Number[]} value New roll.
181
+ */
182
+ set roll(value) {
183
+ this._state.roll = value || 0;
184
+ this._onDirRollUpdated();
185
+ }
186
+
187
+ /**
188
+ * Gets the roll of this SectionPlane's plane.
189
+ *
190
+ * Default value is ````0````.
191
+ *
192
+ * @returns {Number[]} value Current roll.
193
+ */
194
+ get roll() {
195
+ return this._state.roll;
196
+ }
197
+
138
198
  /**
139
199
  * Sets the direction of this SectionPlane's plane.
140
200
  *
@@ -143,7 +203,25 @@ class SectionPlane extends Component {
143
203
  * @param {Number[]} value New direction.
144
204
  */
145
205
  set dir(value) {
146
- this._state.dir.set(value || [0, 0, -1]);
206
+ this._state.dir.set(value || front);
207
+ this._onDirRollUpdated();
208
+ }
209
+
210
+ _onDirRollUpdated() {
211
+ math.vec3PairToQuaternion(back, this._state.dir, this._state.quaternion);
212
+
213
+ tempVec4a[0] = 0;
214
+ tempVec4a[1] = 0;
215
+ tempVec4a[2] = -1;
216
+ tempVec4a[3] = this._state.roll;
217
+ math.angleAxisToQuaternion(tempVec4a, tempVec4a);
218
+
219
+ math.mulQuaternions(this._state.quaternion, tempVec4a, this._state.quaternion);
220
+
221
+ this._onDirUpdated();
222
+ }
223
+
224
+ _onDirUpdated() {
147
225
  this._state.dist = (-math.dotVec3(this._state.pos, this._state.dir));
148
226
  this.glRedraw();
149
227
  this.fire("dir", this._state.dir);
@@ -935,6 +935,9 @@ const Renderer = function (scene, options) {
935
935
  pickProjMatrix = scene.camera.projMatrix;
936
936
  projection = scene.camera.projection;
937
937
 
938
+ nearAndFar[0] = scene.camera.project.near;
939
+ nearAndFar[1] = scene.camera.project.far;
940
+
938
941
  pickResult.canvasPos = params.canvasPos;
939
942
 
940
943
  } else {
@@ -948,6 +951,9 @@ const Renderer = function (scene, options) {
948
951
  pickProjMatrix = scene.camera.projMatrix;
949
952
  projection = scene.camera.projection;
950
953
 
954
+ nearAndFar[0] = scene.camera.project.near;
955
+ nearAndFar[1] = scene.camera.project.far;
956
+
951
957
  } else {
952
958
 
953
959
  worldRayOrigin.set(params.origin || [0, 0, 0]);
@@ -967,6 +973,9 @@ const Renderer = function (scene, options) {
967
973
  pickProjMatrix = scene.camera.ortho.matrix;
968
974
  projection = "ortho";
969
975
 
976
+ nearAndFar[0] = scene.camera.ortho.near;
977
+ nearAndFar[1] = scene.camera.ortho.far;
978
+
970
979
  pickResult.origin = worldRayOrigin;
971
980
  pickResult.direction = worldRayDir;
972
981
  }
@@ -1021,9 +1030,6 @@ const Renderer = function (scene, options) {
1021
1030
 
1022
1031
  if (pickable.canPickWorldPos && pickable.canPickWorldPos()) {
1023
1032
 
1024
- nearAndFar[0] = scene.camera.project.near;
1025
- nearAndFar[1] = scene.camera.project.far;
1026
-
1027
1033
  gpuPickWorldPos(pickBuffer, pickable, canvasPos, pickViewMatrix, pickProjMatrix, nearAndFar, pickResult);
1028
1034
 
1029
1035
  if (params.pickSurfaceNormal !== false) {
@@ -1296,13 +1302,16 @@ const Renderer = function (scene, options) {
1296
1302
 
1297
1303
  const snapRadiusInPixels = snapRadius || 30;
1298
1304
 
1299
- const vertexPickBuffer = renderBufferManager.getRenderBuffer("uniquePickColors-aabs", {
1300
- depthTexture: true,
1301
- size: [
1302
- 2 * snapRadiusInPixels + 1,
1303
- 2 * snapRadiusInPixels + 1,
1304
- ]
1305
- });
1305
+ const vertexPickBuffer = renderBufferManager.getRenderBuffer(
1306
+ `uniquePickColors-aabs-${snapRadiusInPixels}`,
1307
+ {
1308
+ depthTexture: true,
1309
+ size: [
1310
+ 2 * snapRadiusInPixels + 1,
1311
+ 2 * snapRadiusInPixels + 1,
1312
+ ]
1313
+ }
1314
+ );
1306
1315
 
1307
1316
  frameCtx.snapVectorA = [
1308
1317
  canvasPos ? getClipPosX(canvasPos[0] * resolutionScale, gl.drawingBufferWidth) : 0,
@@ -0,0 +1,50 @@
1
+ import {Viewer} from "../../viewer";
2
+
3
+ /**
4
+ * A PointerCircle shows a circle, centered at the position of the
5
+ * mouse or touch pointer.
6
+ */
7
+ export class PointerCircle {
8
+ /**
9
+ * Constructs a new PointerCircle.
10
+ * @param {Viewer} viewer The Viewer
11
+ * @param {Object} [cfg] PointerCircle configuration.
12
+ * @param {boolean} [cfg.active=true] Whether PointerCircle is active. The PointerCircle can only be shown when this is `true` (default).
13
+ */
14
+ constructor(viewer: Viewer, cfg?: {
15
+ active?: boolean;
16
+ });
17
+
18
+ /**
19
+ * Show the circle at the given canvas coordinates and begin shrinking it.
20
+ */
21
+ start(circlePos: number[]): void;
22
+
23
+ /**
24
+ * Stop the shrinking circle and hide it.
25
+ */
26
+ stop(): void;
27
+
28
+ /**
29
+ * Sets the zoom factor for the lens.
30
+ *
31
+ * This is `2` by default.
32
+ *
33
+ * @param {number} durationMs
34
+ */
35
+ set durationMs(durationMs: number);
36
+
37
+ /**
38
+ * Gets the zoom factor for the lens.
39
+ *
40
+ * This is `2` by default.
41
+ *
42
+ * @returns {number} Number
43
+ */
44
+ get durationMs(): number;
45
+
46
+ /**
47
+ * Destroys this PointerCircle.
48
+ */
49
+ destroy(): void;
50
+ }
@@ -0,0 +1 @@
1
+ export * from "./PointerCircle";
@@ -21,12 +21,13 @@ import { ModelStats } from "../index";
21
21
 
22
22
  export declare type WebIFCLoaderPluginConfiguration = {
23
23
  id?: string;
24
- wasmPath: string;
25
24
  objectDefaults?: any;
26
25
  dataSource?: IWebIFCDefaultDataSource;
27
26
  includeTypes?: string[];
28
27
  excludeTypes?: string[];
29
28
  excludeUnclassifiedObjects?: boolean;
29
+ WebIFC: any;
30
+ IfcAPI: any;
30
31
  };
31
32
 
32
33
  export declare type LoadWebIFCModel = {
@@ -11,6 +11,8 @@ export declare type XKTLoaderPluginConfiguration = {
11
11
  includeTypes?: string[];
12
12
  /** When loading metadata, never loads objects that have {@link MetaObject}s with {@link MetaObject.type} values in this list. */
13
13
  excludeTypes?: string[];
14
+ /** When loading metadata, only loads objects that have {@link MetaObject}s with {@link MetaObject.id} values in this list. */
15
+ includeIds?: string[];
14
16
  /** When loading metadata and this is ````true````, will only load {@link Entity}s that have {@link MetaObject}s (that are not excluded). This is useful when we don't want Entitys in the Scene that are not represented within IFC navigation components, such as {@link TreeViewPlugin}. */
15
17
  excludeUnclassifiedObjects?: boolean;
16
18
  /** Indicates whether to enable geometry reuse */
@@ -40,6 +42,8 @@ export declare type LoadXKTModel = {
40
42
  includeTypes?: string[]
41
43
  /** When loading metadata, never loads objects that have {@link MetaObject}s with {@link MetaObject.type} values in this list. */
42
44
  excludeTypes?: string[];
45
+ /** When loading metadata, only loads objects that have {@link MetaObject}s with {@link MetaObject.id} values in this list. */
46
+ includeIds?: string[]
43
47
  /** Whether or not xeokit renders the model with edges emphasized. */
44
48
  edges?: boolean;
45
49
  /** The model's World-space double-precision 3D origin. Use this to position the model within xeokit's World coordinate system, using double-precision coordinates. */
@@ -198,6 +202,30 @@ export declare class XKTLoaderPlugin extends Plugin {
198
202
  */
199
203
  get excludeTypes(): string[];
200
204
 
205
+ /**
206
+ * Sets the whitelist of the specified elements by this XKTLoaderPlugin.
207
+ *
208
+ * When loading models with metadata, causes this XKTLoaderPlugin to only load objects whose ids are in this
209
+ * list. An object's id is indicated by its {@link MetaObject}'s {@link MetaObject#id}.
210
+ *
211
+ * Default value is ````undefined````.
212
+ *
213
+ * @type {String[]}
214
+ */
215
+ set includeIds(arg: string[]);
216
+
217
+ /**
218
+ * Gets the whitelist of the specified elements loaded by this XKTLoaderPlugin.
219
+ *
220
+ * When loading models with metadata, causes this XKTLoaderPlugin to only load objects whose ids are in this
221
+ * list. An object's id is indicated by its {@link MetaObject}'s {@link MetaObject#id}.
222
+ *
223
+ * Default value is ````undefined````.
224
+ *
225
+ * @type {String[]}
226
+ */
227
+ get includeIds(): string[];
228
+
201
229
  /**
202
230
  * Sets whether we load objects that don't have IFC types.
203
231
  *
@@ -19,6 +19,7 @@ export * from "./ViewCullPlugin";
19
19
  export * from "./XKTLoaderPlugin";
20
20
  export * from "./WebIFCLoaderPlugin";
21
21
  export * from "./XML3DLoaderPlugin";
22
+ export * from "./lib/ui";
22
23
 
23
24
  export declare type ModelStats = {
24
25
  sourceFormat: string;
@@ -0,0 +1,12 @@
1
+ import { Viewer } from "../../../viewer";
2
+ import { PointerCircle } from "../../../extras/PointerCircle";
3
+
4
+ type Cleanup = () => void;
5
+
6
+ type OnCancel = () => void;
7
+ type OnChange = () => void;
8
+ type OnCommit = () => void;
9
+
10
+ type Ray2WorldPos = (origin: number[], direction: number[]) => boolean | number[];
11
+
12
+ declare function touchPointSelector(viewer: Viewer, pointerCircle: PointerCircle, ray2WorldPos: Ray2WorldPos): (onCancel: OnCancel, onChange: OnChange, onCommit: OnCommit) => Cleanup;
@@ -65,4 +65,11 @@ export declare class SceneModelMesh {
65
65
  */
66
66
  entity: SceneModelEntity;
67
67
 
68
+ /**
69
+ * Tells whether this SceneModelMesh is a solid or not
70
+ *
71
+ * @type {Boolean}
72
+ */
73
+ isSolid(): boolean;
74
+
68
75
  }