@xeokit/xeokit-sdk 2.5.2-beta-25 → 2.5.2-beta-27

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xeokit/xeokit-sdk",
3
- "version": "2.5.2-beta-25",
3
+ "version": "2.5.2-beta-27",
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",
@@ -42,7 +42,7 @@ class Ortho extends Component {
42
42
  inverseMatrix: math.mat4(),
43
43
  transposedMatrix: math.mat4(),
44
44
  near: 0.1,
45
- far: 2000.0
45
+ far: 10000.0
46
46
  });
47
47
 
48
48
  this._inverseMatrixDirty = true;
@@ -168,12 +168,12 @@ class Ortho extends Component {
168
168
  *
169
169
  * Fires a "far" event on change.
170
170
  *
171
- * Default value is ````2000.0````.
171
+ * Default value is ````10000.0````.
172
172
  *
173
173
  * @param {Number} value New far ortho plane position.
174
174
  */
175
175
  set far(value) {
176
- const far = (value !== undefined && value !== null) ? value : 2000.0;
176
+ const far = (value !== undefined && value !== null) ? value : 10000.0;
177
177
  if (this._state.far === far) {
178
178
  return;
179
179
  }
@@ -40,7 +40,7 @@ class Perspective extends Component {
40
40
  inverseMatrix: math.mat4(),
41
41
  transposedMatrix: math.mat4(),
42
42
  near: 0.1,
43
- far: 2000.0
43
+ far: 10000.0
44
44
  });
45
45
 
46
46
  this._inverseMatrixDirty = true;
@@ -190,10 +190,12 @@ class Perspective extends Component {
190
190
  *
191
191
  * Fires a "far" event on change.
192
192
  *
193
+ * Default value is ````10000.0````.
194
+ *
193
195
  * @param {Number} value New Perspective far plane position.
194
196
  */
195
197
  set far(value) {
196
- const far = (value !== undefined && value !== null) ? value : 2000.0;
198
+ const far = (value !== undefined && value !== null) ? value : 10000.0;
197
199
  if (this._state.far === far) {
198
200
  return;
199
201
  }
@@ -205,6 +207,8 @@ class Perspective extends Component {
205
207
  /**
206
208
  * Gets the position of this Perspective's far plane on the positive View-space Z-axis.
207
209
  *
210
+ * Default value is ````10000.0````.
211
+ *
208
212
  * @return {Number} The Perspective's far plane position.
209
213
  */
210
214
  get far() {
@@ -2334,6 +2334,10 @@ export class SceneModel extends Component {
2334
2334
  this.error("[createGeometry] Param expected: `uvDecodeMatrix` (required for `uvCompressed')");
2335
2335
  return null;
2336
2336
  }
2337
+ if (!cfg.buckets && !cfg.indices && (cfg.primitive === "triangles" || cfg.primitive === "solid" || cfg.primitive === "surface")) {
2338
+ const numPositions = (cfg.positions || cfg.positionsCompressed).length / 3;
2339
+ cfg.indices = this._createDefaultIndices(numPositions);
2340
+ }
2337
2341
  if (!cfg.buckets && !cfg.indices && cfg.primitive !== "points") {
2338
2342
  this.error(`[createGeometry] Param expected: indices (required for '${cfg.primitive}' primitive type)`);
2339
2343
  return null;
@@ -2768,7 +2772,12 @@ export class SceneModel extends Component {
2768
2772
  this.error("Param expected: 'uvCompressed' should be accompanied by `uvDecodeMatrix` ('geometryId' is absent)");
2769
2773
  return false;
2770
2774
  }
2775
+ if (!cfg.buckets && !cfg.indices && (cfg.primitive === "triangles" || cfg.primitive === "solid" || cfg.primitive === "surface")) {
2776
+ const numPositions = (cfg.positions || cfg.positionsCompressed).length / 3;
2777
+ cfg.indices = this._createDefaultIndices(numPositions);
2778
+ }
2771
2779
  if (!cfg.buckets && !cfg.indices && cfg.primitive !== "points") {
2780
+ cfg.indices = this._createDefaultIndices(numIndices)
2772
2781
  this.error(`Param expected: indices (required for '${cfg.primitive}' primitive type)`);
2773
2782
  return false;
2774
2783
  }
@@ -2778,9 +2787,9 @@ export class SceneModel extends Component {
2778
2787
  }
2779
2788
 
2780
2789
  const useDTX = (!!this._dtxEnabled && (cfg.primitive === "triangles"
2781
- || cfg.primitive === "solid"
2782
- || cfg.primitive === "surface"))
2783
- && (!cfg.textureSetId);
2790
+ || cfg.primitive === "solid"
2791
+ || cfg.primitive === "surface"))
2792
+ && (!cfg.textureSetId);
2784
2793
 
2785
2794
  cfg.origin = cfg.origin ? math.addVec3(this._origin, cfg.origin, math.vec3()) : this._origin;
2786
2795
 
@@ -2996,9 +3005,9 @@ export class SceneModel extends Component {
2996
3005
  }
2997
3006
 
2998
3007
  const useDTX = (!!this._dtxEnabled
2999
- && (cfg.geometry.primitive === "triangles"
3000
- || cfg.geometry.primitive === "solid"
3001
- || cfg.geometry.primitive === "surface"))
3008
+ && (cfg.geometry.primitive === "triangles"
3009
+ || cfg.geometry.primitive === "solid"
3010
+ || cfg.geometry.primitive === "surface"))
3002
3011
  && (!cfg.textureSetId);
3003
3012
 
3004
3013
  if (useDTX) {
@@ -3053,6 +3062,14 @@ export class SceneModel extends Component {
3053
3062
  return true;
3054
3063
  }
3055
3064
 
3065
+ _createDefaultIndices(numIndices) {
3066
+ const indices = [];
3067
+ for (let i = 0; i < numIndices; i++) {
3068
+ indices.push(i);
3069
+ }
3070
+ return indices;
3071
+ }
3072
+
3056
3073
  _createMesh(cfg) {
3057
3074
  const mesh = new SceneModelMesh(this, cfg.id, cfg.color, cfg.opacity, cfg.transform, cfg.textureSet);
3058
3075
  mesh.pickId = this.scene._renderer.getPickID(mesh);
@@ -3655,7 +3672,7 @@ export class SceneModel extends Component {
3655
3672
  for (let i = 0, len = renderFlags.visibleLayers.length; i < len; i++) {
3656
3673
  const layerIndex = renderFlags.visibleLayers[i];
3657
3674
  this.layerList[layerIndex].drawColorOpaque(renderFlags, frameCtx);
3658
- }
3675
+ }
3659
3676
  }
3660
3677
 
3661
3678
  /** @private */
@@ -324,11 +324,6 @@ export class DTXTrianglesPickMeshRenderer {
324
324
  // get color
325
325
  src.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);");
326
326
 
327
- src.push(`if (color.a == 0u) {`);
328
- src.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"); // Cull vertex
329
- src.push(" return;");
330
- src.push("};");
331
-
332
327
  // get pick-color
333
328
  src.push("vPickColor = vec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+1, objectIndexCoords.y), 0)) / 255.0;");
334
329
 
@@ -7,10 +7,27 @@ export declare type buildPolylineGeometryConfiguration = {
7
7
  points?: number[];
8
8
  };
9
9
 
10
+ export declare type buildPolylineGeometryFromCurveConfiguration = {
11
+ /* Optional ID for the {@link Geometry}, unique among all components in the parent {@link Scene}, generated automatically when omitted. */
12
+ id?: string;
13
+ /* Curve for which polyline will be created. */
14
+ curve?: Object;
15
+ /* The number of divisions. */
16
+ divisions?: number;
17
+ };
18
+
10
19
  /**
11
20
  * @desc Creates a 3D polyline {@link Geometry}.
12
21
  *
13
22
  * @param {buildBoxLinesGeometryConfiguration} [cfg] Configs
14
23
  * @returns {Object} Configuration for a {@link Geometry} subtype.
15
24
  */
16
- export function buildPolylineGeometry(cfg: buildPolylineGeometryConfiguration): Geometry;
25
+ export function buildPolylineGeometry(cfg: buildPolylineGeometryConfiguration): Geometry;
26
+
27
+ /**
28
+ * @desc Creates a 3D polyline from curve {@link Geometry}.
29
+ *
30
+ * @param {buildBoxLinesGeometryConfiguration} [cfg] Configs
31
+ * @returns {Object} Configuration for a {@link Geometry} subtype.
32
+ */
33
+ export function buildPolylineGeometryFromCurve(cfg: buildPolylineGeometryFromCurveConfiguration): Geometry;