@xeokit/xeokit-sdk 2.4.2-beta-22 → 2.4.2-beta-23

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.4.2-beta-22",
3
+ "version": "2.4.2-beta-23",
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",
@@ -57,7 +57,7 @@ class Viewer {
57
57
  * store geometry on the GPU for triangle meshes that don't have textures. This gives a much lower memory footprint for these types of model element. This mode may not perform well on low-end GPUs that are optimized
58
58
  * to use textures to hold geometry data. Works great on most medium/high-end GPUs found in desktop computers, including the nVIDIA and Intel HD chipsets. Set this false to use the default vertex buffer object (VBO)
59
59
  * mode for storing geometry, which is the standard technique used in most graphics engines, and will work adequately on most low-end GPUs.
60
- * @param {number} [cfg.numPreallocatedSectionPlanes=0] Enhances the efficiency of SectionPlane creation by proactively allocating Viewer resources for a specified quantity
60
+ * @param {number} [cfg.numCachedSectionPlanes=0] Enhances the efficiency of SectionPlane creation by proactively allocating Viewer resources for a specified quantity
61
61
  * of SectionPlanes. Introducing this parameter streamlines the initial creation speed of SectionPlanes, particularly up to the designated quantity. This parameter internally
62
62
  * configures renderer logic for the specified number of SectionPlanes, eliminating the need for setting up logic with each SectionPlane creation and thereby enhancing
63
63
  * responsiveness. It is important to consider that each SectionPlane impacts rendering performance, so it is recommended to set this value to a quantity that aligns with
@@ -120,7 +120,7 @@ class Viewer {
120
120
  pbrEnabled: (!!cfg.pbrEnabled),
121
121
  colorTextureEnabled: (cfg.colorTextureEnabled !== false),
122
122
  dtxEnabled: (!!cfg.dtxEnabled),
123
- numPreallocatedSectionPlanes: cfg.numPreallocatedSectionPlanes
123
+ numCachedSectionPlanes: cfg.numCachedSectionPlanes
124
124
  });
125
125
 
126
126
  /**
@@ -185,7 +185,7 @@ export class TrianglesDataTextureDepthRenderer {
185
185
  this._uProjMatrix = program.getLocation("projMatrix");
186
186
  this._uSectionPlanes = [];
187
187
 
188
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
188
+ for (let i = 0, len = scene.getMaxSectionPlanes(); i < len; i++) {
189
189
  this._uSectionPlanes.push({
190
190
  active: program.getLocation("sectionPlaneActive" + i),
191
191
  pos: program.getLocation("sectionPlanePos" + i),
@@ -86,7 +86,7 @@ export class TrianglesDataTextureEdgesColorRenderer {
86
86
  gl.uniformMatrix4fv(this._uViewMatrix, false, rtcViewMatrix);
87
87
  gl.uniformMatrix4fv(this._uProjMatrix, false, camera.projMatrix);
88
88
 
89
- const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
89
+ const numSectionPlanes = scene.getMaxSectionPlanes();
90
90
  if (numSectionPlanes > 0) {
91
91
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
92
92
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
@@ -193,7 +193,7 @@ export class TrianglesDataTextureEdgesRenderer {
193
193
  this._uViewMatrix = program.getLocation("viewMatrix");
194
194
  this._uProjMatrix = program.getLocation("projMatrix");
195
195
  this._uSectionPlanes = [];
196
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
196
+ for (let i = 0, len = scene.getMaxSectionPlanes(); i < len; i++) {
197
197
  this._uSectionPlanes.push({
198
198
  active: program.getLocation("sectionPlaneActive" + i),
199
199
  pos: program.getLocation("sectionPlanePos" + i),
@@ -166,7 +166,7 @@ export class TrianglesDataTexturePickMeshRenderer {
166
166
  this._uViewMatrix = program.getLocation("viewMatrix");
167
167
  this._uProjMatrix = program.getLocation("projMatrix");
168
168
  this._uSectionPlanes = [];
169
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
169
+ for (let i = 0, len = scene.getMaxSectionPlanes(); i < len; i++) {
170
170
  this._uSectionPlanes.push({
171
171
  active: program.getLocation("sectionPlaneActive" + i),
172
172
  pos: program.getLocation("sectionPlanePos" + i),
@@ -182,7 +182,7 @@ export class TrianglesDataTexturePickNormalsFlatRenderer {
182
182
  this._uViewMatrix = program.getLocation("viewMatrix");
183
183
  this._uProjMatrix = program.getLocation("projMatrix");
184
184
  this._uSectionPlanes = [];
185
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
185
+ for (let i = 0, len = scene.getMaxSectionPlanes(); i < len; i++) {
186
186
  this._uSectionPlanes.push({
187
187
  active: program.getLocation("sectionPlaneActive" + i),
188
188
  pos: program.getLocation("sectionPlanePos" + i),
@@ -203,7 +203,7 @@ export class TrianglesDataTextureSilhouetteRenderer {
203
203
  this._uViewMatrix = program.getLocation("viewMatrix");
204
204
  this._uProjMatrix = program.getLocation("projMatrix");
205
205
  this._uSectionPlanes = [];
206
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
206
+ for (let i = 0, len = scene.getMaxSectionPlanes(); i < len; i++) {
207
207
  this._uSectionPlanes.push({
208
208
  active: program.getLocation("sectionPlaneActive" + i),
209
209
  pos: program.getLocation("sectionPlanePos" + i),
@@ -190,7 +190,7 @@ export class TrianglesDataTextureSnapDepthBufInitRenderer {
190
190
  this._uViewMatrix = program.getLocation("viewMatrix");
191
191
  this._uProjMatrix = program.getLocation("projMatrix");
192
192
  this._uSectionPlanes = [];
193
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
193
+ for (let i = 0, len = scene.getMaxSectionPlanes(); i < len; i++) {
194
194
  this._uSectionPlanes.push({
195
195
  active: program.getLocation("sectionPlaneActive" + i),
196
196
  pos: program.getLocation("sectionPlanePos" + i),
@@ -196,7 +196,7 @@ export class TrianglesDataTextureSnapDepthRenderer {
196
196
  this._uViewMatrix = program.getLocation("viewMatrix");
197
197
  this._uProjMatrix = program.getLocation("projMatrix");
198
198
  this._uSectionPlanes = [];
199
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
199
+ for (let i = 0, len = scene.getMaxSectionPlanes(); i < len; i++) {
200
200
  this._uSectionPlanes.push({
201
201
  active: program.getLocation("sectionPlaneActive" + i),
202
202
  pos: program.getLocation("sectionPlanePos" + i),
@@ -340,7 +340,7 @@ class Scene extends Component {
340
340
  * @param {String} [cfg.canvasId] ID of an existing HTML canvas for the {@link Scene#canvas} - either this or canvasElement is mandatory. When both values are given, the element reference is always preferred to the ID.
341
341
  * @param {HTMLCanvasElement} [cfg.canvasElement] Reference of an existing HTML canvas for the {@link Scene#canvas} - either this or canvasId is mandatory. When both values are given, the element reference is always preferred to the ID.
342
342
  * @param {HTMLElement} [cfg.keyboardEventsElement] Optional reference to HTML element on which key events should be handled. Defaults to the HTML Document.
343
- * @param {number} [cfg.numPreallocatedSectionPlanes=0] Enhances the efficiency of SectionPlane creation by proactively allocating Viewer resources for a specified quantity
343
+ * @param {number} [cfg.numCachedSectionPlanes=0] Enhances the efficiency of SectionPlane creation by proactively allocating Viewer resources for a specified quantity
344
344
  * of SectionPlanes. Introducing this parameter streamlines the initial creation speed of SectionPlanes, particularly up to the designated quantity. This parameter internally
345
345
  * configures renderer logic for the specified number of SectionPlanes, eliminating the need for setting up logic with each SectionPlane creation and thereby enhancing
346
346
  * responsiveness. It is important to consider that each SectionPlane imposes rendering performance, so it is recommended to set this value to a quantity that aligns with
@@ -367,7 +367,7 @@ class Scene extends Component {
367
367
 
368
368
  this._aabbDirty = true;
369
369
 
370
- this._numPreallocatedSectionPlanes = cfg.numPreallocatedSectionPlanes || 0;
370
+ this._numCachedSectionPlanes = cfg.numCachedSectionPlanes || 0;
371
371
 
372
372
  /**
373
373
  * The {@link Viewer} this Scene belongs to.
@@ -631,7 +631,7 @@ class Scene extends Component {
631
631
  alphaDepthMask: alphaDepthMask
632
632
  });
633
633
 
634
- const numPreallocatedSectionPlanes = this._numPreallocatedSectionPlanes;
634
+ const numCachedSectionPlanes = this._numCachedSectionPlanes;
635
635
 
636
636
  this._sectionPlanesState = new (function () {
637
637
 
@@ -679,7 +679,7 @@ class Scene extends Component {
679
679
 
680
680
  this.getNumAllocatedSectionPlanes = function () {
681
681
  const num = this.sectionPlanes.length;
682
- return (num > numPreallocatedSectionPlanes) ? num : numPreallocatedSectionPlanes;
682
+ return (num > numCachedSectionPlanes) ? num : numCachedSectionPlanes;
683
683
  };
684
684
  })();
685
685
 
@@ -1258,12 +1258,43 @@ class Scene extends Component {
1258
1258
  return this._logarithmicDepthBufferEnabled;
1259
1259
  }
1260
1260
 
1261
+ /**
1262
+ * Sets the number of {@link SectionPlane}s for which this Scene pre-caches resources.
1263
+ *
1264
+ * This property enhances the efficiency of SectionPlane creation by proactively allocating and caching Viewer resources for a specified quantity
1265
+ * of SectionPlanes. Introducing this parameter streamlines the initial creation speed of SectionPlanes, particularly up to the designated quantity. This parameter internally
1266
+ * configures renderer logic for the specified number of SectionPlanes, eliminating the need for setting up logic with each SectionPlane creation and thereby enhancing
1267
+ * responsiveness. It is important to consider that each SectionPlane impacts rendering performance, so it is recommended to set this value to a quantity that aligns with
1268
+ * your expected usage.
1269
+ *
1270
+ * Default is ````0````.
1271
+ */
1272
+ set numCachedSectionPlanes(numCachedSectionPlanes) {
1273
+ this._numCachedSectionPlanes = numCachedSectionPlanes;
1274
+ this._recompile();
1275
+ }
1276
+
1277
+ /**
1278
+ * Gets the number of {@link SectionPlane}s for which this Scene pre-caches resources.
1279
+ *
1280
+ * This property enhances the efficiency of SectionPlane creation by proactively allocating and caching Viewer resources for a specified quantity
1281
+ * of SectionPlanes. Introducing this parameter streamlines the initial creation speed of SectionPlanes, particularly up to the designated quantity. This parameter internally
1282
+ * configures renderer logic for the specified number of SectionPlanes, eliminating the need for setting up logic with each SectionPlane creation and thereby enhancing
1283
+ * responsiveness. It is important to consider that each SectionPlane impacts rendering performance, so it is recommended to set this value to a quantity that aligns with
1284
+ * your expected usage.
1285
+ *
1286
+ * Default is ````0````.
1287
+ *
1288
+ * @returns {number} The number of {@link SectionPlane}s for which this Scene pre-caches resources.
1289
+ */
1290
+ get numCachedSectionPlanes() {
1291
+ return this._numCachedSectionPlanes;
1292
+ }
1293
+
1261
1294
  /**
1262
1295
  * Sets whether physically-based rendering is enabled.
1263
1296
  *
1264
1297
  * Default is ````false````.
1265
- *
1266
- * @returns {Boolean} True if quality rendering is enabled.
1267
1298
  */
1268
1299
  set pbrEnabled(pbrEnabled) {
1269
1300
  this._pbrEnabled = !!pbrEnabled;