@xeokit/xeokit-sdk 2.4.2-beta-21 → 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.
Files changed (90) hide show
  1. package/dist/xeokit-sdk.cjs.js +750 -598
  2. package/dist/xeokit-sdk.es.js +750 -598
  3. package/dist/xeokit-sdk.es5.js +227 -198
  4. package/dist/xeokit-sdk.min.cjs.js +4 -4
  5. package/dist/xeokit-sdk.min.es.js +4 -4
  6. package/dist/xeokit-sdk.min.es5.js +3 -3
  7. package/package.json +1 -1
  8. package/src/viewer/Viewer.js +7 -1
  9. package/src/viewer/scene/mesh/draw/DrawRenderer.js +18 -8
  10. package/src/viewer/scene/mesh/draw/DrawShaderSource.js +8 -8
  11. package/src/viewer/scene/mesh/emphasis/EmphasisEdgesRenderer.js +19 -9
  12. package/src/viewer/scene/mesh/emphasis/EmphasisEdgesShaderSource.js +3 -3
  13. package/src/viewer/scene/mesh/emphasis/EmphasisFillRenderer.js +19 -9
  14. package/src/viewer/scene/mesh/emphasis/EmphasisFillShaderSource.js +3 -3
  15. package/src/viewer/scene/mesh/occlusion/OcclusionRenderer.js +18 -8
  16. package/src/viewer/scene/mesh/occlusion/OcclusionShaderSource.js +3 -3
  17. package/src/viewer/scene/mesh/pick/PickMeshRenderer.js +18 -8
  18. package/src/viewer/scene/mesh/pick/PickMeshShaderSource.js +3 -3
  19. package/src/viewer/scene/mesh/pick/PickTriangleRenderer.js +18 -8
  20. package/src/viewer/scene/mesh/pick/PickTriangleShaderSource.js +3 -3
  21. package/src/viewer/scene/mesh/shadow/ShadowRenderer.js +1 -1
  22. package/src/viewer/scene/mesh/shadow/ShadowShaderSource.js +3 -3
  23. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureColorRenderer.js +22 -17
  24. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureDepthRenderer.js +22 -21
  25. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureEdgesColorRenderer.js +7 -10
  26. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureEdgesRenderer.js +22 -19
  27. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureNormalsRenderer.js +22 -18
  28. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureOcclusionRenderer.js +22 -17
  29. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTexturePickDepthRenderer.js +22 -18
  30. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTexturePickMeshRenderer.js +59 -55
  31. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTexturePickNormalsFlatRenderer.js +22 -20
  32. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTexturePickNormalsRenderer.js +22 -18
  33. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureSilhouetteRenderer.js +22 -19
  34. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureSnapDepthBufInitRenderer.js +22 -19
  35. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureSnapDepthRenderer.js +22 -19
  36. package/src/viewer/scene/model/vbo/VBOSceneModelRenderers.js +21 -16
  37. package/src/viewer/scene/model/vbo/linesBatching/renderers/LinesBatchingColorRenderer.js +4 -4
  38. package/src/viewer/scene/model/vbo/linesBatching/renderers/LinesBatchingSilhouetteRenderer.js +4 -4
  39. package/src/viewer/scene/model/vbo/linesInstancing/renderers/LinesInstancingColorRenderer.js +4 -4
  40. package/src/viewer/scene/model/vbo/linesInstancing/renderers/LinesInstancingSilhouetteRenderer.js +4 -4
  41. package/src/viewer/scene/model/vbo/pointsBatching/renderers/PointsBatchingColorRenderer.js +4 -4
  42. package/src/viewer/scene/model/vbo/pointsBatching/renderers/PointsBatchingOcclusionRenderer.js +4 -4
  43. package/src/viewer/scene/model/vbo/pointsBatching/renderers/PointsBatchingPickDepthRenderer.js +4 -4
  44. package/src/viewer/scene/model/vbo/pointsBatching/renderers/PointsBatchingPickMeshRenderer.js +4 -4
  45. package/src/viewer/scene/model/vbo/pointsBatching/renderers/PointsBatchingShadowRenderer.js +4 -4
  46. package/src/viewer/scene/model/vbo/pointsBatching/renderers/PointsBatchingSilhouetteRenderer.js +4 -4
  47. package/src/viewer/scene/model/vbo/pointsInstancing/renderers/PointsInstancingColorRenderer.js +4 -4
  48. package/src/viewer/scene/model/vbo/pointsInstancing/renderers/PointsInstancingDepthRenderer.js +4 -4
  49. package/src/viewer/scene/model/vbo/pointsInstancing/renderers/PointsInstancingOcclusionRenderer.js +4 -4
  50. package/src/viewer/scene/model/vbo/pointsInstancing/renderers/PointsInstancingPickDepthRenderer.js +4 -4
  51. package/src/viewer/scene/model/vbo/pointsInstancing/renderers/PointsInstancingPickMeshRenderer.js +4 -4
  52. package/src/viewer/scene/model/vbo/pointsInstancing/renderers/PointsInstancingShadowRenderer.js +4 -4
  53. package/src/viewer/scene/model/vbo/pointsInstancing/renderers/PointsInstancingSilhouetteRenderer.js +4 -4
  54. package/src/viewer/scene/model/vbo/snapBatching/SnapBatchingDepthBufInitRenderer.js +4 -4
  55. package/src/viewer/scene/model/vbo/snapBatching/SnapBatchingDepthRenderer.js +4 -4
  56. package/src/viewer/scene/model/vbo/snapInstancing/SnapInstancingDepthBufInitRenderer.js +4 -4
  57. package/src/viewer/scene/model/vbo/snapInstancing/SnapInstancingDepthRenderer.js +4 -4
  58. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingColorRenderer.js +4 -4
  59. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingColorTextureRenderer.js +4 -4
  60. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingDepthRenderer.js +4 -4
  61. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingEdgesColorRenderer.js +4 -4
  62. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingEdgesRenderer.js +4 -4
  63. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingFlatColorRenderer.js +4 -4
  64. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingNormalsRenderer.js +4 -4
  65. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingOcclusionRenderer.js +4 -4
  66. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingPBRRenderer.js +4 -4
  67. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingPickDepthRenderer.js +4 -4
  68. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingPickMeshRenderer.js +4 -4
  69. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingPickNormalsFlatRenderer.js +4 -4
  70. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingPickNormalsRenderer.js +4 -4
  71. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingShadowRenderer.js +4 -4
  72. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingSilhouetteRenderer.js +4 -4
  73. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingColorRenderer.js +4 -4
  74. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingColorTextureRenderer.js +4 -4
  75. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingDepthRenderer.js +4 -4
  76. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingEdgesColorRenderer.js +4 -4
  77. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingEdgesRenderer.js +4 -4
  78. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingFlatColorRenderer.js +4 -4
  79. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingFlatNormalsRenderer.js +4 -4
  80. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingNormalsRenderer.js +4 -4
  81. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingOcclusionRenderer.js +4 -4
  82. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingPBRRenderer.js +4 -4
  83. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingPickDepthRenderer.js +4 -4
  84. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingPickMeshRenderer.js +4 -4
  85. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingPickNormalsFlatRenderer.js +4 -4
  86. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingPickNormalsRenderer.js +4 -4
  87. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingShadowRenderer.js +4 -4
  88. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingSilhouetteRenderer.js +4 -4
  89. package/src/viewer/scene/scene/Scene.js +57 -11
  90. package/src/viewer/scene/sectionPlane/SectionPlaneCache.js +101 -0
@@ -21572,8 +21572,8 @@ class CustomProjection extends Component {
21572
21572
  const tempVec3$6 = math.vec3();
21573
21573
  const tempVec3b$q = math.vec3();
21574
21574
  const tempVec3c$n = math.vec3();
21575
- const tempVec3d$h = math.vec3();
21576
- const tempVec3e$4 = math.vec3();
21575
+ const tempVec3d$9 = math.vec3();
21576
+ const tempVec3e$2 = math.vec3();
21577
21577
  const tempVec3f$2 = math.vec3();
21578
21578
  const tempVec4a$d = math.vec4();
21579
21579
  const tempVec4b$c = math.vec4();
@@ -21885,7 +21885,7 @@ class Camera extends Component {
21885
21885
  math.rotationMat4v(angleInc * 0.0174532925, this._gimbalLock ? this._worldUp : this._up, tempMat);
21886
21886
  lookEyeVec = math.transformPoint3(tempMat, lookEyeVec, tempVec3b$q);
21887
21887
  this.eye = math.addVec3(this._look, lookEyeVec, tempVec3c$n); // Set eye position as 'look' plus 'eye' vector
21888
- this.up = math.transformPoint3(tempMat, this._up, tempVec3d$h); // Rotate 'up' vector
21888
+ this.up = math.transformPoint3(tempMat, this._up, tempVec3d$9); // Rotate 'up' vector
21889
21889
  }
21890
21890
 
21891
21891
  /**
@@ -21903,8 +21903,8 @@ class Camera extends Component {
21903
21903
  let eye2 = math.subVec3(this._eye, this._look, tempVec3$6);
21904
21904
  const left = math.cross3Vec3(math.normalizeVec3(eye2, tempVec3b$q), math.normalizeVec3(this._up, tempVec3c$n));
21905
21905
  math.rotationMat4v(angleInc * 0.0174532925, left, tempMat);
21906
- eye2 = math.transformPoint3(tempMat, eye2, tempVec3d$h);
21907
- this.up = math.transformPoint3(tempMat, this._up, tempVec3e$4);
21906
+ eye2 = math.transformPoint3(tempMat, eye2, tempVec3d$9);
21907
+ this.up = math.transformPoint3(tempMat, this._up, tempVec3e$2);
21908
21908
  this.eye = math.addVec3(eye2, this._look, tempVec3f$2);
21909
21909
  }
21910
21910
 
@@ -21919,7 +21919,7 @@ class Camera extends Component {
21919
21919
  look2 = math.transformPoint3(tempMat, look2, tempVec3b$q);
21920
21920
  this.look = math.addVec3(look2, this._eye, tempVec3c$n);
21921
21921
  if (this._gimbalLock) {
21922
- this.up = math.transformPoint3(tempMat, this._up, tempVec3d$h);
21922
+ this.up = math.transformPoint3(tempMat, this._up, tempVec3d$9);
21923
21923
  }
21924
21924
  }
21925
21925
 
@@ -21939,8 +21939,8 @@ class Camera extends Component {
21939
21939
  const left = math.cross3Vec3(math.normalizeVec3(look2, tempVec3b$q), math.normalizeVec3(this._up, tempVec3c$n));
21940
21940
  math.rotationMat4v(angleInc * 0.0174532925, left, tempMat);
21941
21941
  this.up = math.transformPoint3(tempMat, this._up, tempVec3f$2);
21942
- look2 = math.transformPoint3(tempMat, look2, tempVec3d$h);
21943
- this.look = math.addVec3(look2, this._eye, tempVec3e$4);
21942
+ look2 = math.transformPoint3(tempMat, look2, tempVec3d$9);
21943
+ this.look = math.addVec3(look2, this._eye, tempVec3e$2);
21944
21944
  }
21945
21945
 
21946
21946
  /**
@@ -21966,12 +21966,12 @@ class Camera extends Component {
21966
21966
  vec[2] += v[2];
21967
21967
  }
21968
21968
  if (pan[2] !== 0) {
21969
- v = math.mulVec3Scalar(math.normalizeVec3(eye2, tempVec3d$h), pan[2]);
21969
+ v = math.mulVec3Scalar(math.normalizeVec3(eye2, tempVec3d$9), pan[2]);
21970
21970
  vec[0] += v[0];
21971
21971
  vec[1] += v[1];
21972
21972
  vec[2] += v[2];
21973
21973
  }
21974
- this.eye = math.addVec3(this._eye, vec, tempVec3e$4);
21974
+ this.eye = math.addVec3(this._eye, vec, tempVec3e$2);
21975
21975
  this.look = math.addVec3(this._look, vec, tempVec3f$2);
21976
21976
  }
21977
21977
 
@@ -21988,7 +21988,7 @@ class Camera extends Component {
21988
21988
  return;
21989
21989
  }
21990
21990
  const dir = math.normalizeVec3(vec, tempVec3c$n);
21991
- this.eye = math.addVec3(this._look, math.mulVec3Scalar(dir, newLenLook), tempVec3d$h);
21991
+ this.eye = math.addVec3(this._look, math.mulVec3Scalar(dir, newLenLook), tempVec3d$9);
21992
21992
  }
21993
21993
 
21994
21994
  /**
@@ -27967,8 +27967,13 @@ class Scene extends Component {
27967
27967
  * @param {Viewer} viewer The Viewer this Scene belongs to.
27968
27968
  * @param {Object} cfg Scene configuration.
27969
27969
  * @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.
27970
- * @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.
27970
+ * @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.
27971
27971
  * @param {HTMLElement} [cfg.keyboardEventsElement] Optional reference to HTML element on which key events should be handled. Defaults to the HTML Document.
27972
+ * @param {number} [cfg.numCachedSectionPlanes=0] Enhances the efficiency of SectionPlane creation by proactively allocating Viewer resources for a specified quantity
27973
+ * of SectionPlanes. Introducing this parameter streamlines the initial creation speed of SectionPlanes, particularly up to the designated quantity. This parameter internally
27974
+ * configures renderer logic for the specified number of SectionPlanes, eliminating the need for setting up logic with each SectionPlane creation and thereby enhancing
27975
+ * 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
27976
+ * your expected usage.
27972
27977
  * @throws {String} Throws an exception when both canvasId or canvasElement are missing or they aren't pointing to a valid HTMLCanvasElement.
27973
27978
  */
27974
27979
  constructor(viewer, cfg = {}) {
@@ -27991,6 +27996,8 @@ class Scene extends Component {
27991
27996
 
27992
27997
  this._aabbDirty = true;
27993
27998
 
27999
+ this._numCachedSectionPlanes = cfg.numCachedSectionPlanes || 0;
28000
+
27994
28001
  /**
27995
28002
  * The {@link Viewer} this Scene belongs to.
27996
28003
  * @type {Viewer}
@@ -28253,6 +28260,8 @@ class Scene extends Component {
28253
28260
  alphaDepthMask: alphaDepthMask
28254
28261
  });
28255
28262
 
28263
+ const numCachedSectionPlanes = this._numCachedSectionPlanes;
28264
+
28256
28265
  this._sectionPlanesState = new (function () {
28257
28266
 
28258
28267
  this.sectionPlanes = [];
@@ -28265,13 +28274,14 @@ class Scene extends Component {
28265
28274
  if (hash) {
28266
28275
  return hash;
28267
28276
  }
28268
- const sectionPlanes = this.sectionPlanes;
28269
- if (sectionPlanes.length === 0) {
28277
+ const numAllocatedSectionPlanes = this.getNumAllocatedSectionPlanes();
28278
+ this.sectionPlanes;
28279
+ if (numAllocatedSectionPlanes === 0) {
28270
28280
  return this.hash = ";";
28271
28281
  }
28272
28282
 
28273
28283
  const hashParts = [];
28274
- for (let i = 0, len = sectionPlanes.length; i < len; i++) {
28284
+ for (let i = 0, len = numAllocatedSectionPlanes; i < len; i++) {
28275
28285
  hashParts.push("cp");
28276
28286
  }
28277
28287
  hashParts.push(";");
@@ -28293,6 +28303,11 @@ class Scene extends Component {
28293
28303
  }
28294
28304
  }
28295
28305
  };
28306
+
28307
+ this.getNumAllocatedSectionPlanes = function () {
28308
+ const num = this.sectionPlanes.length;
28309
+ return (num > numCachedSectionPlanes) ? num : numCachedSectionPlanes;
28310
+ };
28296
28311
  })();
28297
28312
 
28298
28313
  this._lightsState = new (function () {
@@ -28827,12 +28842,43 @@ class Scene extends Component {
28827
28842
  return this._logarithmicDepthBufferEnabled;
28828
28843
  }
28829
28844
 
28845
+ /**
28846
+ * Sets the number of {@link SectionPlane}s for which this Scene pre-caches resources.
28847
+ *
28848
+ * This property enhances the efficiency of SectionPlane creation by proactively allocating and caching Viewer resources for a specified quantity
28849
+ * of SectionPlanes. Introducing this parameter streamlines the initial creation speed of SectionPlanes, particularly up to the designated quantity. This parameter internally
28850
+ * configures renderer logic for the specified number of SectionPlanes, eliminating the need for setting up logic with each SectionPlane creation and thereby enhancing
28851
+ * 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
28852
+ * your expected usage.
28853
+ *
28854
+ * Default is ````0````.
28855
+ */
28856
+ set numCachedSectionPlanes(numCachedSectionPlanes) {
28857
+ this._numCachedSectionPlanes = numCachedSectionPlanes;
28858
+ this._recompile();
28859
+ }
28860
+
28861
+ /**
28862
+ * Gets the number of {@link SectionPlane}s for which this Scene pre-caches resources.
28863
+ *
28864
+ * This property enhances the efficiency of SectionPlane creation by proactively allocating and caching Viewer resources for a specified quantity
28865
+ * of SectionPlanes. Introducing this parameter streamlines the initial creation speed of SectionPlanes, particularly up to the designated quantity. This parameter internally
28866
+ * configures renderer logic for the specified number of SectionPlanes, eliminating the need for setting up logic with each SectionPlane creation and thereby enhancing
28867
+ * 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
28868
+ * your expected usage.
28869
+ *
28870
+ * Default is ````0````.
28871
+ *
28872
+ * @returns {number} The number of {@link SectionPlane}s for which this Scene pre-caches resources.
28873
+ */
28874
+ get numCachedSectionPlanes() {
28875
+ return this._numCachedSectionPlanes;
28876
+ }
28877
+
28830
28878
  /**
28831
28879
  * Sets whether physically-based rendering is enabled.
28832
28880
  *
28833
28881
  * Default is ````false````.
28834
- *
28835
- * @returns {Boolean} True if quality rendering is enabled.
28836
28882
  */
28837
28883
  set pbrEnabled(pbrEnabled) {
28838
28884
  this._pbrEnabled = !!pbrEnabled;
@@ -30169,12 +30215,12 @@ class Scene extends Component {
30169
30215
 
30170
30216
  /**
30171
30217
  * This method will "tickify" the provided `cb` function.
30172
- *
30218
+ *
30173
30219
  * This means, the function will be wrapped so:
30174
- *
30220
+ *
30175
30221
  * - it runs time-aligned to scene ticks
30176
30222
  * - it runs maximum once per scene-tick
30177
- *
30223
+ *
30178
30224
  * @param {Function} cb The function to tickify
30179
30225
  * @returns {Function)}
30180
30226
  */
@@ -30195,7 +30241,7 @@ class Scene extends Component {
30195
30241
 
30196
30242
  /**
30197
30243
  * The provided `cb` function is replaced with a "set-dirty" function
30198
- *
30244
+ *
30199
30245
  * @type {Function}
30200
30246
  */
30201
30247
  const wrapperFunc = function (...args) {
@@ -30205,7 +30251,7 @@ class Scene extends Component {
30205
30251
 
30206
30252
  /**
30207
30253
  * An each scene tick, if the "dirty-flag" is set, run the `cb` function.
30208
- *
30254
+ *
30209
30255
  * This will make it run time-aligned to the scene tick.
30210
30256
  */
30211
30257
  const tickSubId = this.on("tick", () => {
@@ -30219,7 +30265,7 @@ class Scene extends Component {
30219
30265
  /**
30220
30266
  * And, store the list of subscribers.
30221
30267
  */
30222
- this._tickifiedFunctions[cbString] = { tickSubId, wrapperFunc };
30268
+ this._tickifiedFunctions[cbString] = {tickSubId, wrapperFunc};
30223
30269
 
30224
30270
  return wrapperFunc;
30225
30271
  }
@@ -30712,7 +30758,7 @@ function buildVertexLambert(mesh) {
30712
30758
  const geometryState = mesh._geometry._state;
30713
30759
  const billboard = mesh._state.billboard;
30714
30760
  const stationary = mesh._state.stationary;
30715
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
30761
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
30716
30762
  const quantizedGeometry = !!geometryState.compressGeometry;
30717
30763
 
30718
30764
  const src = [];
@@ -30889,7 +30935,7 @@ function buildFragmentLambert(mesh) {
30889
30935
  const sectionPlanesState = scene._sectionPlanesState;
30890
30936
  mesh._material._state;
30891
30937
  const geometryState = mesh._geometry._state;
30892
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
30938
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
30893
30939
  const gammaOutput = scene.gammaOutput; // If set, then it expects that all textures and colors need to be outputted in premultiplied gamma. Default is false.
30894
30940
  const src = [];
30895
30941
  src.push("#version 300 es");
@@ -30909,7 +30955,7 @@ function buildFragmentLambert(mesh) {
30909
30955
  if (clipping) {
30910
30956
  src.push("in vec4 vWorldPosition;");
30911
30957
  src.push("uniform bool clippable;");
30912
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
30958
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
30913
30959
  src.push("uniform bool sectionPlaneActive" + i + ";");
30914
30960
  src.push("uniform vec3 sectionPlanePos" + i + ";");
30915
30961
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -30927,7 +30973,7 @@ function buildFragmentLambert(mesh) {
30927
30973
  if (clipping) {
30928
30974
  src.push("if (clippable) {");
30929
30975
  src.push(" float dist = 0.0;");
30930
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
30976
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
30931
30977
  src.push("if (sectionPlaneActive" + i + ") {");
30932
30978
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
30933
30979
  src.push("}");
@@ -30968,7 +31014,7 @@ function buildVertexDraw(mesh) {
30968
31014
  const stationary = meshState.stationary;
30969
31015
  const texturing = hasTextures(mesh);
30970
31016
  const normals = hasNormals$1(mesh);
30971
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
31017
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
30972
31018
  const receivesShadow = getReceivesShadow(mesh);
30973
31019
  const quantizedGeometry = !!geometryState.compressGeometry;
30974
31020
  const src = [];
@@ -31190,7 +31236,7 @@ function buildFragmentDraw(mesh) {
31190
31236
  const sectionPlanesState = mesh.scene._sectionPlanesState;
31191
31237
  const lightsState = mesh.scene._lightsState;
31192
31238
  const materialState = mesh._material._state;
31193
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
31239
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
31194
31240
  const normals = hasNormals$1(mesh);
31195
31241
  const uvs = geometryState.uvBuf;
31196
31242
  const phongMaterial = (materialState.type === "PhongMaterial");
@@ -31251,7 +31297,7 @@ function buildFragmentDraw(mesh) {
31251
31297
  if (clipping) {
31252
31298
  src.push("in vec4 vWorldPosition;");
31253
31299
  src.push("uniform bool clippable;");
31254
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
31300
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
31255
31301
  src.push("uniform bool sectionPlaneActive" + i + ";");
31256
31302
  src.push("uniform vec3 sectionPlanePos" + i + ";");
31257
31303
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -31741,7 +31787,7 @@ function buildFragmentDraw(mesh) {
31741
31787
  if (clipping) {
31742
31788
  src.push("if (clippable) {");
31743
31789
  src.push(" float dist = 0.0;");
31744
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
31790
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
31745
31791
  src.push("if (sectionPlaneActive" + i + ") {");
31746
31792
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
31747
31793
  src.push("}");
@@ -32275,19 +32321,29 @@ DrawRenderer.prototype.drawMesh = function (frameCtx, mesh) {
32275
32321
  gl.uniformMatrix4fv(this._uViewNormalMatrix, false, camera.viewNormalMatrix);
32276
32322
 
32277
32323
  if (meshState.clippable) {
32324
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
32278
32325
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
32279
- if (numSectionPlanes > 0) {
32326
+ if (numAllocatedSectionPlanes > 0) {
32280
32327
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
32281
32328
  const renderFlags = mesh.renderFlags;
32282
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
32329
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
32283
32330
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
32284
32331
  if (sectionPlaneUniforms) {
32285
- const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];
32286
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
32287
- if (active) {
32288
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
32289
- gl.uniform3fv(sectionPlaneUniforms.pos, origin ? getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$A) : sectionPlane.pos);
32290
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
32332
+ if (sectionPlaneIndex < numSectionPlanes) {
32333
+ const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];
32334
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
32335
+ if (active) {
32336
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
32337
+ if (origin) {
32338
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$A);
32339
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
32340
+ } else {
32341
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
32342
+ }
32343
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
32344
+ }
32345
+ } else {
32346
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
32291
32347
  }
32292
32348
  }
32293
32349
  }
@@ -33352,7 +33408,7 @@ function buildFragment$5(mesh) {
33352
33408
  const scene = mesh.scene;
33353
33409
  const sectionPlanesState = mesh.scene._sectionPlanesState;
33354
33410
  const gammaOutput = mesh.scene.gammaOutput;
33355
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
33411
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
33356
33412
  const src = [];
33357
33413
  src.push("#version 300 es");
33358
33414
  src.push("// Lambertian drawing fragment shader");
@@ -33379,7 +33435,7 @@ function buildFragment$5(mesh) {
33379
33435
  if (clipping) {
33380
33436
  src.push("in vec4 vWorldPosition;");
33381
33437
  src.push("uniform bool clippable;");
33382
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
33438
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
33383
33439
  src.push("uniform bool sectionPlaneActive" + i + ";");
33384
33440
  src.push("uniform vec3 sectionPlanePos" + i + ";");
33385
33441
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -33391,7 +33447,7 @@ function buildFragment$5(mesh) {
33391
33447
  if (clipping) {
33392
33448
  src.push("if (clippable) {");
33393
33449
  src.push(" float dist = 0.0;");
33394
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
33450
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
33395
33451
  src.push("if (sectionPlaneActive" + i + ") {");
33396
33452
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
33397
33453
  src.push("}");
@@ -33497,19 +33553,29 @@ EmphasisFillRenderer.prototype.drawMesh = function (frameCtx, mesh, mode) {
33497
33553
  gl.uniformMatrix4fv(this._uViewNormalMatrix, false, camera.viewNormalMatrix);
33498
33554
 
33499
33555
  if (meshState.clippable) {
33556
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
33500
33557
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
33501
- if (numSectionPlanes > 0) {
33558
+ if (numAllocatedSectionPlanes > 0) {
33502
33559
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
33503
33560
  const renderFlags = mesh.renderFlags;
33504
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
33561
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
33505
33562
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
33506
33563
  if (sectionPlaneUniforms) {
33507
- const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];
33508
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
33509
- if (active) {
33510
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
33511
- gl.uniform3fv(sectionPlaneUniforms.pos, origin ? getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$z) : sectionPlane.pos);
33512
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
33564
+ if (sectionPlaneIndex < numSectionPlanes) {
33565
+ const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];
33566
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
33567
+ if (active) {
33568
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
33569
+ if (origin) {
33570
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$z);
33571
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
33572
+ } else {
33573
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
33574
+ }
33575
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
33576
+ }
33577
+ } else {
33578
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
33513
33579
  }
33514
33580
  }
33515
33581
  }
@@ -33618,7 +33684,7 @@ EmphasisFillRenderer.prototype._allocate = function (mesh) {
33618
33684
  }
33619
33685
  }
33620
33686
  this._uSectionPlanes = [];
33621
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
33687
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
33622
33688
  this._uSectionPlanes.push({
33623
33689
  active: program.getLocation("sectionPlaneActive" + i),
33624
33690
  pos: program.getLocation("sectionPlanePos" + i),
@@ -33781,7 +33847,7 @@ function buildFragment$4(mesh) {
33781
33847
  const scene = mesh.scene;
33782
33848
  const sectionPlanesState = mesh.scene._sectionPlanesState;
33783
33849
  const gammaOutput = mesh.scene.gammaOutput;
33784
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
33850
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
33785
33851
  const src = [];
33786
33852
  src.push("#version 300 es");
33787
33853
  src.push("// Edges drawing fragment shader");
@@ -33806,7 +33872,7 @@ function buildFragment$4(mesh) {
33806
33872
  if (clipping) {
33807
33873
  src.push("in vec4 vWorldPosition;");
33808
33874
  src.push("uniform bool clippable;");
33809
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
33875
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
33810
33876
  src.push("uniform bool sectionPlaneActive" + i + ";");
33811
33877
  src.push("uniform vec3 sectionPlanePos" + i + ";");
33812
33878
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -33818,7 +33884,7 @@ function buildFragment$4(mesh) {
33818
33884
  if (clipping) {
33819
33885
  src.push("if (clippable) {");
33820
33886
  src.push(" float dist = 0.0;");
33821
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
33887
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
33822
33888
  src.push("if (sectionPlaneActive" + i + ") {");
33823
33889
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
33824
33890
  src.push("}");
@@ -33916,19 +33982,29 @@ EmphasisEdgesRenderer.prototype.drawMesh = function (frameCtx, mesh, mode) {
33916
33982
  gl.uniformMatrix4fv(this._uViewMatrix, false, origin ? frameCtx.getRTCViewMatrix(meshState.originHash, origin) : camera.viewMatrix);
33917
33983
 
33918
33984
  if (meshState.clippable) {
33985
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
33919
33986
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
33920
- if (numSectionPlanes > 0) {
33987
+ if (numAllocatedSectionPlanes > 0) {
33921
33988
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
33922
33989
  const renderFlags = mesh.renderFlags;
33923
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
33990
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
33924
33991
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
33925
33992
  if (sectionPlaneUniforms) {
33926
- const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];
33927
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
33928
- if (active) {
33929
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
33930
- gl.uniform3fv(sectionPlaneUniforms.pos, origin ? getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$y) : sectionPlane.pos);
33931
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
33993
+ if (sectionPlaneIndex < numSectionPlanes) {
33994
+ const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];
33995
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
33996
+ if (active) {
33997
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
33998
+ if (origin) {
33999
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$y);
34000
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
34001
+ } else {
34002
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
34003
+ }
34004
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
34005
+ }
34006
+ } else {
34007
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
33932
34008
  }
33933
34009
  }
33934
34010
  }
@@ -34029,7 +34105,7 @@ EmphasisEdgesRenderer.prototype._allocate = function (mesh) {
34029
34105
  this._uViewMatrix = program.getLocation("viewMatrix");
34030
34106
  this._uProjMatrix = program.getLocation("projMatrix");
34031
34107
  this._uSectionPlanes = [];
34032
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
34108
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
34033
34109
  this._uSectionPlanes.push({
34034
34110
  active: program.getLocation("sectionPlaneActive" + i),
34035
34111
  pos: program.getLocation("sectionPlanePos" + i),
@@ -34181,7 +34257,7 @@ function buildVertex$3(mesh) {
34181
34257
  function buildFragment$3(mesh) {
34182
34258
  const scene = mesh.scene;
34183
34259
  const sectionPlanesState = scene._sectionPlanesState;
34184
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
34260
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
34185
34261
  const src = [];
34186
34262
  src.push('#version 300 es');
34187
34263
  src.push("// Mesh picking fragment shader");
@@ -34201,7 +34277,7 @@ function buildFragment$3(mesh) {
34201
34277
  if (clipping) {
34202
34278
  src.push("uniform bool clippable;");
34203
34279
  src.push("in vec4 vWorldPosition;");
34204
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
34280
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
34205
34281
  src.push("uniform bool sectionPlaneActive" + i + ";");
34206
34282
  src.push("uniform vec3 sectionPlanePos" + i + ";");
34207
34283
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -34212,7 +34288,7 @@ function buildFragment$3(mesh) {
34212
34288
  if (clipping) {
34213
34289
  src.push("if (clippable) {");
34214
34290
  src.push(" float dist = 0.0;");
34215
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
34291
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
34216
34292
  src.push("if (sectionPlaneActive" + i + ") {");
34217
34293
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
34218
34294
  src.push("}");
@@ -34305,19 +34381,29 @@ PickMeshRenderer.prototype.drawMesh = function (frameCtx, mesh) {
34305
34381
  gl.uniformMatrix4fv(this._uViewMatrix, false, origin ? frameCtx.getRTCPickViewMatrix(meshState.originHash, origin) : frameCtx.pickViewMatrix);
34306
34382
 
34307
34383
  if (meshState.clippable) {
34384
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
34308
34385
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
34309
- if (numSectionPlanes > 0) {
34386
+ if (numAllocatedSectionPlanes > 0) {
34310
34387
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
34311
34388
  const renderFlags = mesh.renderFlags;
34312
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
34389
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
34313
34390
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
34314
34391
  if (sectionPlaneUniforms) {
34315
- const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];
34316
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
34317
- if (active) {
34318
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
34319
- gl.uniform3fv(sectionPlaneUniforms.pos, origin ? getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$x) : sectionPlane.pos);
34320
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
34392
+ if (sectionPlaneIndex < numSectionPlanes) {
34393
+ const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];
34394
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
34395
+ if (active) {
34396
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
34397
+ if (origin) {
34398
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$x);
34399
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
34400
+ } else {
34401
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
34402
+ }
34403
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
34404
+ }
34405
+ } else {
34406
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
34321
34407
  }
34322
34408
  }
34323
34409
  }
@@ -34509,7 +34595,7 @@ function buildVertex$2(mesh) {
34509
34595
  function buildFragment$2(mesh) {
34510
34596
  const scene = mesh.scene;
34511
34597
  const sectionPlanesState = scene._sectionPlanesState;
34512
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
34598
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
34513
34599
  const src = [];
34514
34600
  src.push('#version 300 es');
34515
34601
  src.push("// Surface picking fragment shader");
@@ -34529,7 +34615,7 @@ function buildFragment$2(mesh) {
34529
34615
  if (clipping) {
34530
34616
  src.push("uniform bool clippable;");
34531
34617
  src.push("in vec4 vWorldPosition;");
34532
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
34618
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
34533
34619
  src.push("uniform bool sectionPlaneActive" + i + ";");
34534
34620
  src.push("uniform vec3 sectionPlanePos" + i + ";");
34535
34621
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -34540,7 +34626,7 @@ function buildFragment$2(mesh) {
34540
34626
  if (clipping) {
34541
34627
  src.push("if (clippable) {");
34542
34628
  src.push(" float dist = 0.0;");
34543
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
34629
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
34544
34630
  src.push("if (sectionPlaneActive" + i + ") {");
34545
34631
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
34546
34632
  src.push("}");
@@ -34641,19 +34727,29 @@ PickTriangleRenderer.prototype.drawMesh = function (frameCtx, mesh) {
34641
34727
  gl.uniformMatrix4fv(this._uViewMatrix, false, origin ? frameCtx.getRTCPickViewMatrix(meshState.originHash, origin) : frameCtx.pickViewMatrix);
34642
34728
 
34643
34729
  if (meshState.clippable) {
34730
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
34644
34731
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
34645
- if (numSectionPlanes > 0) {
34732
+ if (numAllocatedSectionPlanes > 0) {
34646
34733
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
34647
34734
  const renderFlags = mesh.renderFlags;
34648
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
34735
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
34649
34736
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
34650
34737
  if (sectionPlaneUniforms) {
34651
- const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];
34652
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
34653
- if (active) {
34654
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
34655
- gl.uniform3fv(sectionPlaneUniforms.pos, origin ? getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$w) : sectionPlane.pos);
34656
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
34738
+ if (sectionPlaneIndex < numSectionPlanes) {
34739
+ const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];
34740
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
34741
+ if (active) {
34742
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
34743
+ if (origin) {
34744
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$w);
34745
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
34746
+ } else {
34747
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
34748
+ }
34749
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
34750
+ }
34751
+ } else {
34752
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
34657
34753
  }
34658
34754
  }
34659
34755
  }
@@ -34834,7 +34930,7 @@ function buildFragment$1(mesh) {
34834
34930
 
34835
34931
  const scene = mesh.scene;
34836
34932
  const sectionPlanesState = scene._sectionPlanesState;
34837
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
34933
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
34838
34934
  const src = [];
34839
34935
  src.push('#version 300 es');
34840
34936
  src.push("// Mesh occlusion fragment shader");
@@ -34855,7 +34951,7 @@ function buildFragment$1(mesh) {
34855
34951
  if (clipping) {
34856
34952
  src.push("uniform bool clippable;");
34857
34953
  src.push("in vec4 vWorldPosition;");
34858
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
34954
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
34859
34955
  src.push("uniform bool sectionPlaneActive" + i + ";");
34860
34956
  src.push("uniform vec3 sectionPlanePos" + i + ";");
34861
34957
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -34869,7 +34965,7 @@ function buildFragment$1(mesh) {
34869
34965
  if (clipping) {
34870
34966
  src.push("if (clippable) {");
34871
34967
  src.push(" float dist = 0.0;");
34872
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
34968
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
34873
34969
  src.push("if (sectionPlaneActive" + i + ") {");
34874
34970
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
34875
34971
  src.push("}");
@@ -34990,19 +35086,29 @@ OcclusionRenderer.prototype.drawMesh = function (frameCtx, mesh) {
34990
35086
  gl.uniformMatrix4fv(this._uViewMatrix, false, origin ? frameCtx.getRTCViewMatrix(meshState.originHash, origin) : camera.viewMatrix);
34991
35087
 
34992
35088
  if (meshState.clippable) {
35089
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
34993
35090
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
34994
- if (numSectionPlanes > 0) {
35091
+ if (numAllocatedSectionPlanes > 0) {
34995
35092
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
34996
35093
  const renderFlags = mesh.renderFlags;
34997
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
35094
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
34998
35095
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
34999
35096
  if (sectionPlaneUniforms) {
35000
- const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];
35001
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
35002
- if (active) {
35003
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
35004
- gl.uniform3fv(sectionPlaneUniforms.pos, origin ? getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$v) : sectionPlane.pos);
35005
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
35097
+ if (sectionPlaneIndex < numSectionPlanes) {
35098
+ const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];
35099
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
35100
+ if (active) {
35101
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
35102
+ if (origin) {
35103
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$v);
35104
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
35105
+ } else {
35106
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
35107
+ }
35108
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
35109
+ }
35110
+ } else {
35111
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
35006
35112
  }
35007
35113
  }
35008
35114
  }
@@ -35137,7 +35243,7 @@ function buildFragment(mesh) {
35137
35243
  const scene = mesh.scene;
35138
35244
  scene.canvas.gl;
35139
35245
  const sectionPlanesState = scene._sectionPlanesState;
35140
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
35246
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
35141
35247
  const src = [];
35142
35248
  src.push("// Mesh shadow fragment shader");
35143
35249
 
@@ -35152,7 +35258,7 @@ function buildFragment(mesh) {
35152
35258
  if (clipping) {
35153
35259
  src.push("uniform bool clippable;");
35154
35260
  src.push("in vec4 vWorldPosition;");
35155
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
35261
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
35156
35262
  src.push("uniform bool sectionPlaneActive" + i + ";");
35157
35263
  src.push("uniform vec3 sectionPlanePos" + i + ";");
35158
35264
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -35173,7 +35279,7 @@ function buildFragment(mesh) {
35173
35279
  if (clipping) {
35174
35280
  src.push("if (clippable) {");
35175
35281
  src.push(" float dist = 0.0;");
35176
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
35282
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
35177
35283
  src.push("if (sectionPlaneActive" + i + ") {");
35178
35284
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
35179
35285
  src.push("}");
@@ -35368,7 +35474,7 @@ ShadowRenderer.prototype._bindProgram = function (frame) {
35368
35474
  this._lastMaterialId = null;
35369
35475
  this._lastVertexBufsId = null;
35370
35476
  this._lastGeometryId = null;
35371
- if (sectionPlanesState.sectionPlanes.length > 0) {
35477
+ if (sectionPlanesState.getNumAllocatedSectionPlanes() > 0) {
35372
35478
  let sectionPlaneUniforms;
35373
35479
  let uSectionPlaneActive;
35374
35480
  let sectionPlane;
@@ -56585,32 +56691,38 @@ class VBOSceneModelRenderer {
56585
56691
  const {gl} = scene.canvas;
56586
56692
  const {model, layerIndex} = layer;
56587
56693
 
56694
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
56588
56695
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
56589
- if (numSectionPlanes > 0) {
56696
+ if (numAllocatedSectionPlanes > 0) {
56590
56697
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
56591
56698
  const baseIndex = layerIndex * numSectionPlanes;
56592
56699
  const renderFlags = model.renderFlags;
56593
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
56700
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
56594
56701
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
56595
56702
  if (sectionPlaneUniforms) {
56596
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
56597
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
56598
- if (active) {
56599
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
56600
- const origin = layer._state.origin;
56601
- if (origin) {
56602
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$s);
56603
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
56604
- } else {
56605
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
56703
+ if (sectionPlaneIndex < numSectionPlanes) {
56704
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
56705
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
56706
+ if (active) {
56707
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
56708
+ const origin = layer._state.origin;
56709
+ if (origin) {
56710
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$s);
56711
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
56712
+ } else {
56713
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
56714
+ }
56715
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
56606
56716
  }
56607
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
56717
+ } else {
56718
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
56608
56719
  }
56609
56720
  }
56610
56721
  }
56611
56722
  }
56612
56723
  }
56613
56724
 
56725
+
56614
56726
  _allocate() {
56615
56727
  const scene = this._scene;
56616
56728
  const gl = scene.canvas.gl;
@@ -56691,7 +56803,7 @@ class VBOSceneModelRenderer {
56691
56803
 
56692
56804
  this._uSectionPlanes = [];
56693
56805
 
56694
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
56806
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
56695
56807
  this._uSectionPlanes.push({
56696
56808
  active: program.getLocation("sectionPlaneActive" + i),
56697
56809
  pos: program.getLocation("sectionPlanePos" + i),
@@ -57157,12 +57269,11 @@ class VBOSceneModelTriangleBatchingEdgesRenderer extends VBOSceneModelTriangleBa
57157
57269
  }
57158
57270
 
57159
57271
 
57160
-
57161
57272
  /**
57162
57273
  * @private
57163
57274
  */
57164
57275
  class VBOSceneModelTriangleInstancingRenderer extends VBOSceneModelRenderer {
57165
- constructor(scene, withSAO, { edges = false} = {}) {
57276
+ constructor(scene, withSAO, {edges = false} = {}) {
57166
57277
  super(scene, withSAO, {instancing: true, edges});
57167
57278
  }
57168
57279
 
@@ -57309,7 +57420,7 @@ class TrianglesBatchingColorRenderer extends VBOSceneModelTriangleBatchingRender
57309
57420
  const scene = this._scene;
57310
57421
  const sectionPlanesState = scene._sectionPlanesState;
57311
57422
  const lightsState = scene._lightsState;
57312
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
57423
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57313
57424
  let light;
57314
57425
  const src = [];
57315
57426
  src.push("#version 300 es");
@@ -57448,7 +57559,7 @@ class TrianglesBatchingColorRenderer extends VBOSceneModelTriangleBatchingRender
57448
57559
  _buildFragmentShader() {
57449
57560
  const scene = this._scene;
57450
57561
  const sectionPlanesState = scene._sectionPlanesState;
57451
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
57562
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57452
57563
  const src = [];
57453
57564
  src.push("#version 300 es");
57454
57565
  src.push("// Triangles batching draw fragment shader");
@@ -57481,7 +57592,7 @@ class TrianglesBatchingColorRenderer extends VBOSceneModelTriangleBatchingRender
57481
57592
  if (clipping) {
57482
57593
  src.push("in vec4 vWorldPosition;");
57483
57594
  src.push("in float vFlags;");
57484
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
57595
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
57485
57596
  src.push("uniform bool sectionPlaneActive" + i + ";");
57486
57597
  src.push("uniform vec3 sectionPlanePos" + i + ";");
57487
57598
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -57495,7 +57606,7 @@ class TrianglesBatchingColorRenderer extends VBOSceneModelTriangleBatchingRender
57495
57606
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
57496
57607
  src.push(" if (clippable) {");
57497
57608
  src.push(" float dist = 0.0;");
57498
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
57609
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
57499
57610
  src.push("if (sectionPlaneActive" + i + ") {");
57500
57611
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
57501
57612
  src.push("}");
@@ -57541,7 +57652,7 @@ class TrianglesBatchingFlatColorRenderer extends VBOSceneModelTriangleBatchingRe
57541
57652
  _buildVertexShader() {
57542
57653
  const scene = this._scene;
57543
57654
  const sectionPlanesState = scene._sectionPlanesState;
57544
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
57655
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57545
57656
  const src = [];
57546
57657
  src.push("#version 300 es");
57547
57658
  src.push("// Triangles batching flat-shading draw vertex shader");
@@ -57613,7 +57724,7 @@ class TrianglesBatchingFlatColorRenderer extends VBOSceneModelTriangleBatchingRe
57613
57724
  const scene = this._scene;
57614
57725
  const lightsState = scene._lightsState;
57615
57726
  const sectionPlanesState = scene._sectionPlanesState;
57616
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
57727
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57617
57728
  const src = [];
57618
57729
  src.push("#version 300 es");
57619
57730
  src.push("// Triangles batching flat-shading draw fragment shader");
@@ -57649,7 +57760,7 @@ class TrianglesBatchingFlatColorRenderer extends VBOSceneModelTriangleBatchingRe
57649
57760
  if (clipping) {
57650
57761
  src.push("in vec4 vWorldPosition;");
57651
57762
  src.push("in float vFlags;");
57652
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
57763
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
57653
57764
  src.push("uniform bool sectionPlaneActive" + i + ";");
57654
57765
  src.push("uniform vec3 sectionPlanePos" + i + ";");
57655
57766
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -57687,7 +57798,7 @@ class TrianglesBatchingFlatColorRenderer extends VBOSceneModelTriangleBatchingRe
57687
57798
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
57688
57799
  src.push(" if (clippable) {");
57689
57800
  src.push(" float dist = 0.0;");
57690
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
57801
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
57691
57802
  src.push("if (sectionPlaneActive" + i + ") {");
57692
57803
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
57693
57804
  src.push("}");
@@ -57776,7 +57887,7 @@ class TrianglesBatchingSilhouetteRenderer extends VBOSceneModelTriangleBatchingR
57776
57887
 
57777
57888
  const scene = this._scene;
57778
57889
  const sectionPlanesState = scene._sectionPlanesState;
57779
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
57890
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57780
57891
 
57781
57892
  const src = [];
57782
57893
  src.push("#version 300 es");
@@ -57847,7 +57958,7 @@ class TrianglesBatchingSilhouetteRenderer extends VBOSceneModelTriangleBatchingR
57847
57958
  const sectionPlanesState = scene._sectionPlanesState;
57848
57959
  let i;
57849
57960
  let len;
57850
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
57961
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57851
57962
  const src = [];
57852
57963
  src.push("#version 300 es");
57853
57964
  src.push("// Triangles batching silhouette fragment shader");
@@ -57867,7 +57978,7 @@ class TrianglesBatchingSilhouetteRenderer extends VBOSceneModelTriangleBatchingR
57867
57978
  if (clipping) {
57868
57979
  src.push("in vec4 vWorldPosition;");
57869
57980
  src.push("in float vFlags;");
57870
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
57981
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
57871
57982
  src.push("uniform bool sectionPlaneActive" + i + ";");
57872
57983
  src.push("uniform vec3 sectionPlanePos" + i + ";");
57873
57984
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -57880,7 +57991,7 @@ class TrianglesBatchingSilhouetteRenderer extends VBOSceneModelTriangleBatchingR
57880
57991
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
57881
57992
  src.push(" if (clippable) {");
57882
57993
  src.push(" float dist = 0.0;");
57883
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
57994
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
57884
57995
  src.push("if (sectionPlaneActive" + i + ") {");
57885
57996
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
57886
57997
  src.push("}");
@@ -57909,7 +58020,7 @@ class TrianglesBatchingEdgesRenderer extends VBOSceneModelTriangleBatchingEdgesR
57909
58020
  _buildVertexShader() {
57910
58021
  const scene = this._scene;
57911
58022
  const sectionPlanesState = scene._sectionPlanesState;
57912
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
58023
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57913
58024
  const src = [];
57914
58025
 
57915
58026
  src.push("#version 300 es");
@@ -57978,7 +58089,7 @@ class TrianglesBatchingEdgesRenderer extends VBOSceneModelTriangleBatchingEdgesR
57978
58089
  _buildFragmentShader() {
57979
58090
  const scene = this._scene;
57980
58091
  const sectionPlanesState = scene._sectionPlanesState;
57981
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
58092
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57982
58093
  const src = [];
57983
58094
  src.push("#version 300 es");
57984
58095
  src.push("// Batched geometry edges drawing fragment shader");
@@ -57998,7 +58109,7 @@ class TrianglesBatchingEdgesRenderer extends VBOSceneModelTriangleBatchingEdgesR
57998
58109
  if (clipping) {
57999
58110
  src.push("in vec4 vWorldPosition;");
58000
58111
  src.push("in float vFlags;");
58001
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
58112
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
58002
58113
  src.push("uniform bool sectionPlaneActive" + i + ";");
58003
58114
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58004
58115
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58011,7 +58122,7 @@ class TrianglesBatchingEdgesRenderer extends VBOSceneModelTriangleBatchingEdgesR
58011
58122
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58012
58123
  src.push(" if (clippable) {");
58013
58124
  src.push(" float dist = 0.0;");
58014
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
58125
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
58015
58126
  src.push("if (sectionPlaneActive" + i + ") {");
58016
58127
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58017
58128
  src.push("}");
@@ -58036,7 +58147,7 @@ class TrianglesBatchingEdgesColorRenderer extends VBOSceneModelTriangleBatchingE
58036
58147
  _buildVertexShader() {
58037
58148
  const scene = this._scene;
58038
58149
  const sectionPlanesState = scene._sectionPlanesState;
58039
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
58150
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58040
58151
  const src = [];
58041
58152
  src.push("#version 300 es");
58042
58153
  src.push("// Batched geometry edges drawing vertex shader");
@@ -58105,7 +58216,7 @@ class TrianglesBatchingEdgesColorRenderer extends VBOSceneModelTriangleBatchingE
58105
58216
  _buildFragmentShader() {
58106
58217
  const scene = this._scene;
58107
58218
  const sectionPlanesState = scene._sectionPlanesState;
58108
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
58219
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58109
58220
  const src = [];
58110
58221
  src.push("#version 300 es");
58111
58222
  src.push("// Batched geometry edges drawing fragment shader");
@@ -58124,7 +58235,7 @@ class TrianglesBatchingEdgesColorRenderer extends VBOSceneModelTriangleBatchingE
58124
58235
  if (clipping) {
58125
58236
  src.push("in vec4 vWorldPosition;");
58126
58237
  src.push("in float vFlags;");
58127
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
58238
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
58128
58239
  src.push("uniform bool sectionPlaneActive" + i + ";");
58129
58240
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58130
58241
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58137,7 +58248,7 @@ class TrianglesBatchingEdgesColorRenderer extends VBOSceneModelTriangleBatchingE
58137
58248
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58138
58249
  src.push(" if (clippable) {");
58139
58250
  src.push(" float dist = 0.0;");
58140
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
58251
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
58141
58252
  src.push("if (sectionPlaneActive" + i + ") {");
58142
58253
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58143
58254
  src.push("}");
@@ -58161,7 +58272,7 @@ class TrianglesBatchingPickMeshRenderer extends VBOSceneModelTriangleBatchingRen
58161
58272
 
58162
58273
  _buildVertexShader() {
58163
58274
  const scene = this._scene;
58164
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
58275
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58165
58276
  const src = [];
58166
58277
  src.push("#version 300 es");
58167
58278
  src.push("// Batched geometry picking vertex shader");
@@ -58233,7 +58344,7 @@ class TrianglesBatchingPickMeshRenderer extends VBOSceneModelTriangleBatchingRen
58233
58344
  _buildFragmentShader() {
58234
58345
  const scene = this._scene;
58235
58346
  const sectionPlanesState = scene._sectionPlanesState;
58236
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
58347
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58237
58348
  const src = [];
58238
58349
  src.push("#version 300 es");
58239
58350
  src.push("// Batched geometry picking fragment shader");
@@ -58253,7 +58364,7 @@ class TrianglesBatchingPickMeshRenderer extends VBOSceneModelTriangleBatchingRen
58253
58364
  if (clipping) {
58254
58365
  src.push("in vec4 vWorldPosition;");
58255
58366
  src.push("in float vFlags;");
58256
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58367
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58257
58368
  src.push("uniform bool sectionPlaneActive" + i + ";");
58258
58369
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58259
58370
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58266,7 +58377,7 @@ class TrianglesBatchingPickMeshRenderer extends VBOSceneModelTriangleBatchingRen
58266
58377
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58267
58378
  src.push(" if (clippable) {");
58268
58379
  src.push(" float dist = 0.0;");
58269
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58380
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58270
58381
  src.push(" if (sectionPlaneActive" + i + ") {");
58271
58382
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58272
58383
  src.push(" }");
@@ -58291,7 +58402,7 @@ class TrianglesBatchingPickDepthRenderer extends VBOSceneModelTriangleBatchingRe
58291
58402
  _buildVertexShader() {
58292
58403
 
58293
58404
  const scene = this._scene;
58294
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
58405
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58295
58406
  const src = [];
58296
58407
  src.push("#version 300 es");
58297
58408
  src.push("// Triangles batching pick depth vertex shader");
@@ -58361,7 +58472,7 @@ class TrianglesBatchingPickDepthRenderer extends VBOSceneModelTriangleBatchingRe
58361
58472
 
58362
58473
  const scene = this._scene;
58363
58474
  const sectionPlanesState = scene._sectionPlanesState;
58364
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
58475
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58365
58476
  const src = [];
58366
58477
  src.push("#version 300 es");
58367
58478
  src.push("// Triangles batching pick depth fragment shader");
@@ -58388,7 +58499,7 @@ class TrianglesBatchingPickDepthRenderer extends VBOSceneModelTriangleBatchingRe
58388
58499
  if (clipping) {
58389
58500
  src.push("in vec4 vWorldPosition;");
58390
58501
  src.push("in float vFlags;");
58391
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58502
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58392
58503
  src.push("uniform bool sectionPlaneActive" + i + ";");
58393
58504
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58394
58505
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58408,7 +58519,7 @@ class TrianglesBatchingPickDepthRenderer extends VBOSceneModelTriangleBatchingRe
58408
58519
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58409
58520
  src.push(" if (clippable) {");
58410
58521
  src.push(" float dist = 0.0;");
58411
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58522
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58412
58523
  src.push(" if (sectionPlaneActive" + i + ") {");
58413
58524
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58414
58525
  src.push(" }");
@@ -58433,7 +58544,7 @@ class TrianglesBatchingPickNormalsRenderer extends VBOSceneModelTriangleBatching
58433
58544
 
58434
58545
  _buildVertexShader() {
58435
58546
  const scene = this._scene;
58436
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
58547
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58437
58548
  const src = [];
58438
58549
  src.push("#version 300 es");
58439
58550
  src.push("// Triangles batching pick normals vertex shader");
@@ -58504,7 +58615,7 @@ class TrianglesBatchingPickNormalsRenderer extends VBOSceneModelTriangleBatching
58504
58615
  _buildFragmentShader() {
58505
58616
  const scene = this._scene;
58506
58617
  const sectionPlanesState = scene._sectionPlanesState;
58507
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
58618
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58508
58619
  const src = [];
58509
58620
  src.push("#version 300 es");
58510
58621
  src.push("// Triangles batching pick normals fragment shader");
@@ -58524,7 +58635,7 @@ class TrianglesBatchingPickNormalsRenderer extends VBOSceneModelTriangleBatching
58524
58635
  if (clipping) {
58525
58636
  src.push("in vec4 vWorldPosition;");
58526
58637
  src.push("in float vFlags;");
58527
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58638
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58528
58639
  src.push("uniform bool sectionPlaneActive" + i + ";");
58529
58640
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58530
58641
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58537,7 +58648,7 @@ class TrianglesBatchingPickNormalsRenderer extends VBOSceneModelTriangleBatching
58537
58648
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58538
58649
  src.push(" if (clippable) {");
58539
58650
  src.push(" float dist = 0.0;");
58540
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58651
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58541
58652
  src.push(" if (sectionPlaneActive" + i + ") {");
58542
58653
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58543
58654
  src.push(" }");
@@ -58561,7 +58672,7 @@ class TrianglesBatchingOcclusionRenderer extends VBOSceneModelTriangleBatchingRe
58561
58672
 
58562
58673
  _buildVertexShader() {
58563
58674
  const scene = this._scene;
58564
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
58675
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58565
58676
  const src = [];
58566
58677
  src.push("#version 300 es");
58567
58678
  src.push("// Triangles batching occlusion vertex shader");
@@ -58610,7 +58721,7 @@ class TrianglesBatchingOcclusionRenderer extends VBOSceneModelTriangleBatchingRe
58610
58721
  _buildFragmentShader() {
58611
58722
  const scene = this._scene;
58612
58723
  const sectionPlanesState = scene._sectionPlanesState;
58613
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
58724
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58614
58725
  const src = [];
58615
58726
  src.push("#version 300 es");
58616
58727
  src.push("// Triangles batching occlusion fragment shader");
@@ -58625,7 +58736,7 @@ class TrianglesBatchingOcclusionRenderer extends VBOSceneModelTriangleBatchingRe
58625
58736
  if (clipping) {
58626
58737
  src.push("in vec4 vWorldPosition;");
58627
58738
  src.push("in float vFlags;");
58628
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58739
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58629
58740
  src.push("uniform bool sectionPlaneActive" + i + ";");
58630
58741
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58631
58742
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58637,7 +58748,7 @@ class TrianglesBatchingOcclusionRenderer extends VBOSceneModelTriangleBatchingRe
58637
58748
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58638
58749
  src.push(" if (clippable) {");
58639
58750
  src.push(" float dist = 0.0;");
58640
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58751
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58641
58752
  src.push(" if (sectionPlaneActive" + i + ") {");
58642
58753
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58643
58754
  src.push(" }");
@@ -58658,7 +58769,7 @@ class TrianglesBatchingDepthRenderer extends VBOSceneModelTriangleBatchingRender
58658
58769
 
58659
58770
  _buildVertexShader() {
58660
58771
  const scene = this._scene;
58661
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
58772
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58662
58773
  const src = [];
58663
58774
  src.push("#version 300 es");
58664
58775
  src.push("// Triangles batching depth vertex shader");
@@ -58718,7 +58829,7 @@ class TrianglesBatchingDepthRenderer extends VBOSceneModelTriangleBatchingRender
58718
58829
  _buildFragmentShader() {
58719
58830
  const scene = this._scene;
58720
58831
  const sectionPlanesState = scene._sectionPlanesState;
58721
- const clipping = (sectionPlanesState.sectionPlanes.length > 0);
58832
+ const clipping = (sectionPlanesState.getNumAllocatedSectionPlanes() > 0);
58722
58833
  const src = [];
58723
58834
  src.push("#version 300 es");
58724
58835
  src.push("// Triangles batching depth fragment shader");
@@ -58733,7 +58844,7 @@ class TrianglesBatchingDepthRenderer extends VBOSceneModelTriangleBatchingRender
58733
58844
  if (clipping) {
58734
58845
  src.push("in vec4 vWorldPosition;");
58735
58846
  src.push("in float vFlags;");
58736
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58847
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58737
58848
  src.push("uniform bool sectionPlaneActive" + i + ";");
58738
58849
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58739
58850
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58757,7 +58868,7 @@ class TrianglesBatchingDepthRenderer extends VBOSceneModelTriangleBatchingRender
58757
58868
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58758
58869
  src.push(" if (clippable) {");
58759
58870
  src.push(" float dist = 0.0;");
58760
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58871
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58761
58872
  src.push(" if (sectionPlaneActive" + i + ") {");
58762
58873
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58763
58874
  src.push(" }");
@@ -58782,7 +58893,7 @@ class TrianglesBatchingNormalsRenderer extends VBOSceneModelTriangleBatchingRend
58782
58893
 
58783
58894
  _buildVertexShader() {
58784
58895
  const scene = this._scene;
58785
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
58896
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58786
58897
  const src = [];
58787
58898
  src.push("#version 300 es");
58788
58899
  src.push("// Batched geometry normals vertex shader");
@@ -58853,7 +58964,7 @@ class TrianglesBatchingNormalsRenderer extends VBOSceneModelTriangleBatchingRend
58853
58964
  _buildFragmentShader() {
58854
58965
  const scene = this._scene;
58855
58966
  const sectionPlanesState = scene._sectionPlanesState;
58856
- const clipping = (sectionPlanesState.sectionPlanes.length > 0);
58967
+ const clipping = (sectionPlanesState.getNumAllocatedSectionPlanes() > 0);
58857
58968
  const src = [];
58858
58969
  src.push("#version 300 es");
58859
58970
  src.push("// Batched geometry normals fragment shader");
@@ -58877,7 +58988,7 @@ class TrianglesBatchingNormalsRenderer extends VBOSceneModelTriangleBatchingRend
58877
58988
  if (clipping) {
58878
58989
  src.push("in vec4 vWorldPosition;");
58879
58990
  src.push("in float vFlags;");
58880
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58991
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58881
58992
  src.push("uniform bool sectionPlaneActive" + i + ";");
58882
58993
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58883
58994
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58894,7 +59005,7 @@ class TrianglesBatchingNormalsRenderer extends VBOSceneModelTriangleBatchingRend
58894
59005
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58895
59006
  src.push(" if (clippable) {");
58896
59007
  src.push(" float dist = 0.0;");
58897
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
59008
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58898
59009
  src.push(" if (sectionPlaneActive" + i + ") {");
58899
59010
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58900
59011
  src.push(" }");
@@ -58920,7 +59031,7 @@ class TrianglesBatchingShadowRenderer extends VBOSceneModelTriangleBatchingRende
58920
59031
 
58921
59032
  _buildVertexShader() {
58922
59033
  const scene = this._scene;
58923
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
59034
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58924
59035
  const src = [];
58925
59036
  src.push("#version 300 es");
58926
59037
  src.push("// Batched geometry shadow vertex shader");
@@ -58967,7 +59078,7 @@ class TrianglesBatchingShadowRenderer extends VBOSceneModelTriangleBatchingRende
58967
59078
  _buildFragmentShader() {
58968
59079
  const scene = this._scene;
58969
59080
  const sectionPlanesState = scene._sectionPlanesState;
58970
- const clipping = (sectionPlanesState.sectionPlanes.length > 0);
59081
+ const clipping = (sectionPlanesState.getNumAllocatedSectionPlanes() > 0);
58971
59082
  const src = [];
58972
59083
  src.push("#version 300 es");
58973
59084
  src.push("// Batched geometry shadow fragment shader");
@@ -58981,7 +59092,7 @@ class TrianglesBatchingShadowRenderer extends VBOSceneModelTriangleBatchingRende
58981
59092
  if (clipping) {
58982
59093
  src.push("in vec4 vWorldPosition;");
58983
59094
  src.push("in float vFlags;");
58984
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
59095
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58985
59096
  src.push("uniform bool sectionPlaneActive" + i + ";");
58986
59097
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58987
59098
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -59002,7 +59113,7 @@ class TrianglesBatchingShadowRenderer extends VBOSceneModelTriangleBatchingRende
59002
59113
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
59003
59114
  src.push(" if (clippable) {");
59004
59115
  src.push(" float dist = 0.0;");
59005
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
59116
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
59006
59117
  src.push(" if (sectionPlaneActive" + i + ") {");
59007
59118
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
59008
59119
  src.push(" }");
@@ -59038,7 +59149,7 @@ class TrianglesBatchingPBRRenderer extends VBOSceneModelTriangleBatchingRenderer
59038
59149
  const scene = this._scene;
59039
59150
  const sectionPlanesState = scene._sectionPlanesState;
59040
59151
  const lightsState = scene._lightsState;
59041
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
59152
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
59042
59153
  const clippingCaps = sectionPlanesState.clippingCaps;
59043
59154
 
59044
59155
  const src = [];
@@ -59168,7 +59279,7 @@ class TrianglesBatchingPBRRenderer extends VBOSceneModelTriangleBatchingRenderer
59168
59279
  const gammaOutput = scene.gammaOutput; // If set, then it expects that all textures and colors need to be outputted in premultiplied gamma. Default is false.
59169
59280
  const sectionPlanesState = scene._sectionPlanesState;
59170
59281
  const lightsState = scene._lightsState;
59171
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
59282
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
59172
59283
  const clippingCaps = sectionPlanesState.clippingCaps;
59173
59284
  const src = [];
59174
59285
 
@@ -59272,7 +59383,7 @@ class TrianglesBatchingPBRRenderer extends VBOSceneModelTriangleBatchingRenderer
59272
59383
  if (clippingCaps) {
59273
59384
  src.push("in vec4 vClipPosition;");
59274
59385
  }
59275
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
59386
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
59276
59387
  src.push("uniform bool sectionPlaneActive" + i + ";");
59277
59388
  src.push("uniform vec3 sectionPlanePos" + i + ";");
59278
59389
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -59445,7 +59556,7 @@ class TrianglesBatchingPBRRenderer extends VBOSceneModelTriangleBatchingRenderer
59445
59556
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
59446
59557
  src.push(" if (clippable) {");
59447
59558
  src.push(" float dist = 0.0;");
59448
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
59559
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
59449
59560
  src.push("if (sectionPlaneActive" + i + ") {");
59450
59561
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
59451
59562
  src.push("}");
@@ -59583,7 +59694,7 @@ class TrianglesBatchingPickNormalsFlatRenderer extends VBOSceneModelTriangleBatc
59583
59694
 
59584
59695
  _buildVertexShader() {
59585
59696
  const scene = this._scene;
59586
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
59697
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
59587
59698
  const src = [];
59588
59699
  src.push("#version 300 es");
59589
59700
  src.push("// Triangles batching pick flat normals vertex shader");
@@ -59642,7 +59753,7 @@ class TrianglesBatchingPickNormalsFlatRenderer extends VBOSceneModelTriangleBatc
59642
59753
  _buildFragmentShader() {
59643
59754
  const scene = this._scene;
59644
59755
  const sectionPlanesState = scene._sectionPlanesState;
59645
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
59756
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
59646
59757
  const src = [];
59647
59758
  src.push("#version 300 es");
59648
59759
  src.push("// Triangles batching pick flat normals fragment shader");
@@ -59662,7 +59773,7 @@ class TrianglesBatchingPickNormalsFlatRenderer extends VBOSceneModelTriangleBatc
59662
59773
  src.push("in vec4 vWorldPosition;");
59663
59774
  if (clipping) {
59664
59775
  src.push("in float vFlags;");
59665
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
59776
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
59666
59777
  src.push("uniform bool sectionPlaneActive" + i + ";");
59667
59778
  src.push("uniform vec3 sectionPlanePos" + i + ";");
59668
59779
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -59674,7 +59785,7 @@ class TrianglesBatchingPickNormalsFlatRenderer extends VBOSceneModelTriangleBatc
59674
59785
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
59675
59786
  src.push(" if (clippable) {");
59676
59787
  src.push(" float dist = 0.0;");
59677
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
59788
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
59678
59789
  src.push(" if (sectionPlaneActive" + i + ") {");
59679
59790
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
59680
59791
  src.push(" }");
@@ -59711,7 +59822,7 @@ class TrianglesBatchingColorTextureRenderer extends VBOSceneModelTriangleBatchin
59711
59822
 
59712
59823
  const scene = this._scene;
59713
59824
  const sectionPlanesState = scene._sectionPlanesState;
59714
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
59825
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
59715
59826
  const src = [];
59716
59827
  src.push("#version 300 es");
59717
59828
  src.push("// Triangles batching color texture vertex shader");
@@ -59788,7 +59899,7 @@ class TrianglesBatchingColorTextureRenderer extends VBOSceneModelTriangleBatchin
59788
59899
  const gammaOutput = scene.gammaOutput; // If set, then it expects that all textures and colors need to be outputted in premultiplied gamma. Default is false.
59789
59900
  const lightsState = scene._lightsState;
59790
59901
  const sectionPlanesState = scene._sectionPlanesState;
59791
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
59902
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
59792
59903
  const src = [];
59793
59904
  src.push("#version 300 es");
59794
59905
  src.push("// Triangles batching color texture fragment shader");
@@ -59838,7 +59949,7 @@ class TrianglesBatchingColorTextureRenderer extends VBOSceneModelTriangleBatchin
59838
59949
  if (clipping) {
59839
59950
  src.push("in vec4 vWorldPosition;");
59840
59951
  src.push("in float vFlags;");
59841
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
59952
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
59842
59953
  src.push("uniform bool sectionPlaneActive" + i + ";");
59843
59954
  src.push("uniform vec3 sectionPlanePos" + i + ";");
59844
59955
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -59875,7 +59986,7 @@ class TrianglesBatchingColorTextureRenderer extends VBOSceneModelTriangleBatchin
59875
59986
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
59876
59987
  src.push(" if (clippable) {");
59877
59988
  src.push(" float dist = 0.0;");
59878
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
59989
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
59879
59990
  src.push("if (sectionPlaneActive" + i + ") {");
59880
59991
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
59881
59992
  src.push("}");
@@ -60465,7 +60576,7 @@ function octDecodeVec2(oct) { // Decode an oct-encoded normal
60465
60576
  const tempVec3a$r = math.vec3();
60466
60577
  const tempVec3b$n = math.vec3();
60467
60578
  const tempVec3c$k = math.vec3();
60468
- const tempVec3d$g = math.vec3();
60579
+ const tempVec3d$8 = math.vec3();
60469
60580
  const tempMat4a$g = math.mat4();
60470
60581
 
60471
60582
  /**
@@ -60531,7 +60642,7 @@ class SnapBatchingDepthBufInitRenderer extends VBOSceneModelRenderer {
60531
60642
  rtcOrigin[1] += position[1];
60532
60643
  rtcOrigin[2] += position[2];
60533
60644
  rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a$g);
60534
- rtcCameraEye = tempVec3d$g;
60645
+ rtcCameraEye = tempVec3d$8;
60535
60646
  rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];
60536
60647
  rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];
60537
60648
  rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];
@@ -60606,7 +60717,7 @@ class SnapBatchingDepthBufInitRenderer extends VBOSceneModelRenderer {
60606
60717
 
60607
60718
  _buildVertexShader() {
60608
60719
  const scene = this._scene;
60609
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
60720
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
60610
60721
  const src = [];
60611
60722
  src.push ('#version 300 es');
60612
60723
  src.push("// VBO SnapBatchingDepthBufInitRenderer vertex shader");
@@ -60693,7 +60804,7 @@ class SnapBatchingDepthBufInitRenderer extends VBOSceneModelRenderer {
60693
60804
  _buildFragmentShader() {
60694
60805
  const scene = this._scene;
60695
60806
  const sectionPlanesState = scene._sectionPlanesState;
60696
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
60807
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
60697
60808
  const src = [];
60698
60809
  src.push ('#version 300 es');
60699
60810
  src.push("// VBO SnapBatchingDepthBufInitRenderer fragment shader");
@@ -60715,7 +60826,7 @@ class SnapBatchingDepthBufInitRenderer extends VBOSceneModelRenderer {
60715
60826
  src.push("flat in vec4 vPickColor;");
60716
60827
  if (clipping) {
60717
60828
  src.push("in float vFlags;");
60718
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
60829
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
60719
60830
  src.push("uniform bool sectionPlaneActive" + i + ";");
60720
60831
  src.push("uniform vec3 sectionPlanePos" + i + ";");
60721
60832
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -60730,7 +60841,7 @@ class SnapBatchingDepthBufInitRenderer extends VBOSceneModelRenderer {
60730
60841
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
60731
60842
  src.push(" if (clippable) {");
60732
60843
  src.push(" float dist = 0.0;");
60733
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
60844
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
60734
60845
  src.push(" if (sectionPlaneActive" + i + ") {");
60735
60846
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
60736
60847
  src.push(" }");
@@ -60770,7 +60881,7 @@ class SnapBatchingDepthBufInitRenderer extends VBOSceneModelRenderer {
60770
60881
  const tempVec3a$q = math.vec3();
60771
60882
  const tempVec3b$m = math.vec3();
60772
60883
  const tempVec3c$j = math.vec3();
60773
- const tempVec3d$f = math.vec3();
60884
+ const tempVec3d$7 = math.vec3();
60774
60885
  const tempMat4a$f = math.mat4();
60775
60886
 
60776
60887
  /**
@@ -60840,7 +60951,7 @@ class SnapBatchingDepthRenderer extends VBOSceneModelRenderer{
60840
60951
  rtcOrigin[1] += position[1];
60841
60952
  rtcOrigin[2] += position[2];
60842
60953
  rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a$f);
60843
- rtcCameraEye = tempVec3d$f;
60954
+ rtcCameraEye = tempVec3d$7;
60844
60955
  rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];
60845
60956
  rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];
60846
60957
  rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];
@@ -60921,7 +61032,7 @@ class SnapBatchingDepthRenderer extends VBOSceneModelRenderer{
60921
61032
 
60922
61033
  _buildVertexShader() {
60923
61034
  const scene = this._scene;
60924
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
61035
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
60925
61036
  scene.pointsMaterial._state;
60926
61037
  const src = [];
60927
61038
  src.push ('#version 300 es');
@@ -61008,7 +61119,7 @@ class SnapBatchingDepthRenderer extends VBOSceneModelRenderer{
61008
61119
  _buildFragmentShader() {
61009
61120
  const scene = this._scene;
61010
61121
  const sectionPlanesState = scene._sectionPlanesState;
61011
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
61122
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
61012
61123
  const src = [];
61013
61124
  src.push ('#version 300 es');
61014
61125
  src.push("// SnapBatchingDepthRenderer fragment shader");
@@ -61029,7 +61140,7 @@ class SnapBatchingDepthRenderer extends VBOSceneModelRenderer{
61029
61140
  if (clipping) {
61030
61141
  src.push("in vec4 vWorldPosition;");
61031
61142
  src.push("in float vFlags;");
61032
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
61143
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
61033
61144
  src.push("uniform bool sectionPlaneActive" + i + ";");
61034
61145
  src.push("uniform vec3 sectionPlanePos" + i + ";");
61035
61146
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -61042,7 +61153,7 @@ class SnapBatchingDepthRenderer extends VBOSceneModelRenderer{
61042
61153
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
61043
61154
  src.push(" if (clippable) {");
61044
61155
  src.push(" float dist = 0.0;");
61045
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
61156
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
61046
61157
  src.push(" if (sectionPlaneActive" + i + ") {");
61047
61158
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
61048
61159
  src.push(" }");
@@ -61163,8 +61274,8 @@ math.OBB3();
61163
61274
  const tempVec3a$p = math.vec3();
61164
61275
  const tempVec3b$l = math.vec3();
61165
61276
  const tempVec3c$i = math.vec3();
61166
- const tempVec3d$e = math.vec3();
61167
- const tempVec3e$3 = math.vec3();
61277
+ const tempVec3d$6 = math.vec3();
61278
+ const tempVec3e$1 = math.vec3();
61168
61279
  const tempVec3f$1 = math.vec3();
61169
61280
  const tempVec3g$1 = math.vec3();
61170
61281
 
@@ -62355,8 +62466,8 @@ class TrianglesBatchingLayer {
62355
62466
 
62356
62467
  math.transformRay(this.model.worldNormalMatrix, rtcRayOrigin, rtcRayDir, rtcRayOrigin, rtcRayDir); // RTC -> local
62357
62468
 
62358
- const a = tempVec3d$e;
62359
- const b = tempVec3e$3;
62469
+ const a = tempVec3d$6;
62470
+ const b = tempVec3e$1;
62360
62471
  const c = tempVec3f$1;
62361
62472
 
62362
62473
  let gotIntersect = false;
@@ -62479,7 +62590,7 @@ class TrianglesInstancingColorRenderer extends VBOSceneModelTriangleInstancingRe
62479
62590
  const scene = this._scene;
62480
62591
  const sectionPlanesState = scene._sectionPlanesState;
62481
62592
  const lightsState = scene._lightsState;
62482
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
62593
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
62483
62594
  let i;
62484
62595
  let len;
62485
62596
  let light;
@@ -62631,7 +62742,7 @@ class TrianglesInstancingColorRenderer extends VBOSceneModelTriangleInstancingRe
62631
62742
  _buildFragmentShader() {
62632
62743
  const scene = this._scene;
62633
62744
  const sectionPlanesState = scene._sectionPlanesState;
62634
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
62745
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
62635
62746
  const src = [];
62636
62747
  src.push("#version 300 es");
62637
62748
  src.push("// Instancing geometry drawing fragment shader");
@@ -62664,7 +62775,7 @@ class TrianglesInstancingColorRenderer extends VBOSceneModelTriangleInstancingRe
62664
62775
  if (clipping) {
62665
62776
  src.push("in vec4 vWorldPosition;");
62666
62777
  src.push("in float vFlags;");
62667
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
62778
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
62668
62779
  src.push("uniform bool sectionPlaneActive" + i + ";");
62669
62780
  src.push("uniform vec3 sectionPlanePos" + i + ";");
62670
62781
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -62678,7 +62789,7 @@ class TrianglesInstancingColorRenderer extends VBOSceneModelTriangleInstancingRe
62678
62789
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
62679
62790
  src.push(" if (clippable) {");
62680
62791
  src.push(" float dist = 0.0;");
62681
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
62792
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
62682
62793
  src.push("if (sectionPlaneActive" + i + ") {");
62683
62794
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
62684
62795
  src.push("}");
@@ -62724,7 +62835,7 @@ class TrianglesInstancingFlatColorRenderer extends VBOSceneModelTriangleInstanci
62724
62835
  _buildVertexShader() {
62725
62836
  const scene = this._scene;
62726
62837
  const sectionPlanesState = scene._sectionPlanesState;
62727
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
62838
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
62728
62839
  const src = [];
62729
62840
  src.push("#version 300 es");
62730
62841
  src.push("// Instancing geometry flat-shading drawing vertex shader");
@@ -62806,7 +62917,7 @@ class TrianglesInstancingFlatColorRenderer extends VBOSceneModelTriangleInstanci
62806
62917
  const lightsState = scene._lightsState;
62807
62918
  let i;
62808
62919
  let len;
62809
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
62920
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
62810
62921
  const src = [];
62811
62922
  src.push("#version 300 es");
62812
62923
  src.push("// Instancing geometry flat-shading drawing fragment shader");
@@ -62839,7 +62950,7 @@ class TrianglesInstancingFlatColorRenderer extends VBOSceneModelTriangleInstanci
62839
62950
  if (clipping) {
62840
62951
  src.push("in vec4 vWorldPosition;");
62841
62952
  src.push("in float vFlags;");
62842
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
62953
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
62843
62954
  src.push("uniform bool sectionPlaneActive" + i + ";");
62844
62955
  src.push("uniform vec3 sectionPlanePos" + i + ";");
62845
62956
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -62878,7 +62989,7 @@ class TrianglesInstancingFlatColorRenderer extends VBOSceneModelTriangleInstanci
62878
62989
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
62879
62990
  src.push(" if (clippable) {");
62880
62991
  src.push(" float dist = 0.0;");
62881
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
62992
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
62882
62993
  src.push("if (sectionPlaneActive" + i + ") {");
62883
62994
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
62884
62995
  src.push("}");
@@ -62966,7 +63077,7 @@ class TrianglesInstancingSilhouetteRenderer extends VBOSceneModelTriangleInstanc
62966
63077
  _buildVertexShader() {
62967
63078
  const scene = this._scene;
62968
63079
  const sectionPlanesState = scene._sectionPlanesState;
62969
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63080
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
62970
63081
  const src = [];
62971
63082
  src.push("#version 300 es");
62972
63083
  src.push("// Instancing silhouette vertex shader");
@@ -63041,7 +63152,7 @@ class TrianglesInstancingSilhouetteRenderer extends VBOSceneModelTriangleInstanc
63041
63152
  _buildFragmentShader() {
63042
63153
  const scene = this._scene;
63043
63154
  const sectionPlanesState = scene._sectionPlanesState;
63044
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63155
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63045
63156
  const src = [];
63046
63157
  src.push("#version 300 es");
63047
63158
  src.push("// Instancing fill fragment shader");
@@ -63061,7 +63172,7 @@ class TrianglesInstancingSilhouetteRenderer extends VBOSceneModelTriangleInstanc
63061
63172
  if (clipping) {
63062
63173
  src.push("in vec4 vWorldPosition;");
63063
63174
  src.push("in float vFlags;");
63064
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
63175
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63065
63176
  src.push("uniform bool sectionPlaneActive" + i + ";");
63066
63177
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63067
63178
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63074,7 +63185,7 @@ class TrianglesInstancingSilhouetteRenderer extends VBOSceneModelTriangleInstanc
63074
63185
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63075
63186
  src.push(" if (clippable) {");
63076
63187
  src.push(" float dist = 0.0;");
63077
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
63188
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63078
63189
  src.push("if (sectionPlaneActive" + i + ") {");
63079
63190
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63080
63191
  src.push("}");
@@ -63103,7 +63214,7 @@ class TrianglesInstancingEdgesRenderer extends VBOSceneModelTriangleInstancingEd
63103
63214
  _buildVertexShader() {
63104
63215
  const scene = this._scene;
63105
63216
  const sectionPlanesState = scene._sectionPlanesState;
63106
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63217
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63107
63218
  const src = [];
63108
63219
  src.push("#version 300 es");
63109
63220
  src.push("// Triangles instancing edges vertex shader");
@@ -63172,7 +63283,7 @@ class TrianglesInstancingEdgesRenderer extends VBOSceneModelTriangleInstancingEd
63172
63283
  _buildFragmentShader() {
63173
63284
  const scene = this._scene;
63174
63285
  const sectionPlanesState = scene._sectionPlanesState;
63175
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63286
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63176
63287
  const src = [];
63177
63288
  src.push("#version 300 es");
63178
63289
  src.push("// Batched geometry edges drawing fragment shader");
@@ -63192,7 +63303,7 @@ class TrianglesInstancingEdgesRenderer extends VBOSceneModelTriangleInstancingEd
63192
63303
  if (clipping) {
63193
63304
  src.push("in vec4 vWorldPosition;");
63194
63305
  src.push("in float vFlags;");
63195
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
63306
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63196
63307
  src.push("uniform bool sectionPlaneActive" + i + ";");
63197
63308
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63198
63309
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63205,7 +63316,7 @@ class TrianglesInstancingEdgesRenderer extends VBOSceneModelTriangleInstancingEd
63205
63316
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63206
63317
  src.push(" if (clippable) {");
63207
63318
  src.push(" float dist = 0.0;");
63208
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
63319
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63209
63320
  src.push("if (sectionPlaneActive" + i + ") {");
63210
63321
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63211
63322
  src.push("}");
@@ -63230,7 +63341,7 @@ class TrianglesInstancingEdgesColorRenderer extends VBOSceneModelTriangleInstanc
63230
63341
  _buildVertexShader() {
63231
63342
  const scene = this._scene;
63232
63343
  const sectionPlanesState = scene._sectionPlanesState;
63233
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63344
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63234
63345
  const src = [];
63235
63346
  src.push("#version 300 es");
63236
63347
  src.push("// Triangles instancing edges vertex shader");
@@ -63300,7 +63411,7 @@ class TrianglesInstancingEdgesColorRenderer extends VBOSceneModelTriangleInstanc
63300
63411
  _buildFragmentShader() {
63301
63412
  const scene = this._scene;
63302
63413
  const sectionPlanesState = scene._sectionPlanesState;
63303
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63414
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63304
63415
  const src = [];
63305
63416
  src.push("#version 300 es");
63306
63417
  src.push("// Batched geometry edges drawing fragment shader");
@@ -63320,7 +63431,7 @@ class TrianglesInstancingEdgesColorRenderer extends VBOSceneModelTriangleInstanc
63320
63431
  if (clipping) {
63321
63432
  src.push("in vec4 vWorldPosition;");
63322
63433
  src.push("in float vFlags;");
63323
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
63434
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63324
63435
  src.push("uniform bool sectionPlaneActive" + i + ";");
63325
63436
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63326
63437
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63333,7 +63444,7 @@ class TrianglesInstancingEdgesColorRenderer extends VBOSceneModelTriangleInstanc
63333
63444
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63334
63445
  src.push(" if (clippable) {");
63335
63446
  src.push(" float dist = 0.0;");
63336
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
63447
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63337
63448
  src.push("if (sectionPlaneActive" + i + ") {");
63338
63449
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63339
63450
  src.push("}");
@@ -63358,7 +63469,7 @@ class TrianglesInstancingPickMeshRenderer extends VBOSceneModelTriangleInstancin
63358
63469
  _buildVertexShader() {
63359
63470
  const scene = this._scene;
63360
63471
  const sectionPlanesState = scene._sectionPlanesState;
63361
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63472
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63362
63473
  const src = [];
63363
63474
  src.push("#version 300 es");
63364
63475
  src.push("// Instancing geometry picking vertex shader");
@@ -63434,7 +63545,7 @@ class TrianglesInstancingPickMeshRenderer extends VBOSceneModelTriangleInstancin
63434
63545
  _buildFragmentShader() {
63435
63546
  const scene = this._scene;
63436
63547
  const sectionPlanesState = scene._sectionPlanesState;
63437
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63548
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63438
63549
  const src = [];
63439
63550
  src.push("#version 300 es");
63440
63551
  src.push("// Batched geometry picking fragment shader");
@@ -63454,7 +63565,7 @@ class TrianglesInstancingPickMeshRenderer extends VBOSceneModelTriangleInstancin
63454
63565
  if (clipping) {
63455
63566
  src.push("in vec4 vWorldPosition;");
63456
63567
  src.push("in float vFlags;");
63457
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63568
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63458
63569
  src.push("uniform bool sectionPlaneActive" + i + ";");
63459
63570
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63460
63571
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63467,7 +63578,7 @@ class TrianglesInstancingPickMeshRenderer extends VBOSceneModelTriangleInstancin
63467
63578
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63468
63579
  src.push(" if (clippable) {");
63469
63580
  src.push(" float dist = 0.0;");
63470
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63581
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63471
63582
  src.push("if (sectionPlaneActive" + i + ") {");
63472
63583
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63473
63584
  src.push("}");
@@ -63492,7 +63603,7 @@ class TrianglesInstancingPickDepthRenderer extends VBOSceneModelTriangleInstanci
63492
63603
  _buildVertexShader() {
63493
63604
  const scene = this._scene;
63494
63605
  const sectionPlanesState = scene._sectionPlanesState;
63495
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63606
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63496
63607
  const src = [];
63497
63608
  src.push("#version 300 es");
63498
63609
  src.push("// Instancing geometry depth vertex shader");
@@ -63568,7 +63679,7 @@ class TrianglesInstancingPickDepthRenderer extends VBOSceneModelTriangleInstanci
63568
63679
  _buildFragmentShader() {
63569
63680
  const scene = this._scene;
63570
63681
  const sectionPlanesState = scene._sectionPlanesState;
63571
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63682
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63572
63683
  const src = [];
63573
63684
  src.push("#version 300 es");
63574
63685
  src.push("// Batched geometry depth fragment shader");
@@ -63594,7 +63705,7 @@ class TrianglesInstancingPickDepthRenderer extends VBOSceneModelTriangleInstanci
63594
63705
  if (clipping) {
63595
63706
  src.push("in vec4 vWorldPosition;");
63596
63707
  src.push("in float vFlags;");
63597
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63708
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63598
63709
  src.push("uniform bool sectionPlaneActive" + i + ";");
63599
63710
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63600
63711
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63614,7 +63725,7 @@ class TrianglesInstancingPickDepthRenderer extends VBOSceneModelTriangleInstanci
63614
63725
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63615
63726
  src.push(" if (clippable) {");
63616
63727
  src.push(" float dist = 0.0;");
63617
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63728
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63618
63729
  src.push("if (sectionPlaneActive" + i + ") {");
63619
63730
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63620
63731
  src.push("}");
@@ -63640,7 +63751,7 @@ class TrianglesInstancingPickNormalsRenderer extends VBOSceneModelTriangleInstan
63640
63751
  _buildVertexShader() {
63641
63752
  const scene = this._scene;
63642
63753
  const sectionPlanesState = scene._sectionPlanesState;
63643
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63754
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63644
63755
  const src = [];
63645
63756
  src.push("#version 300 es");
63646
63757
  src.push("// Instancing geometry normals vertex shader");
@@ -63721,7 +63832,7 @@ class TrianglesInstancingPickNormalsRenderer extends VBOSceneModelTriangleInstan
63721
63832
  _buildFragmentShader() {
63722
63833
  const scene = this._scene;
63723
63834
  const sectionPlanesState = scene._sectionPlanesState;
63724
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63835
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63725
63836
  const src = [];
63726
63837
  src.push("#version 300 es");
63727
63838
  src.push("// Batched geometry normals fragment shader");
@@ -63745,7 +63856,7 @@ class TrianglesInstancingPickNormalsRenderer extends VBOSceneModelTriangleInstan
63745
63856
  if (clipping) {
63746
63857
  src.push("in vec4 vWorldPosition;");
63747
63858
  src.push("in float vFlags;");
63748
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63859
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63749
63860
  src.push("uniform bool sectionPlaneActive" + i + ";");
63750
63861
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63751
63862
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63758,7 +63869,7 @@ class TrianglesInstancingPickNormalsRenderer extends VBOSceneModelTriangleInstan
63758
63869
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63759
63870
  src.push(" if (clippable) {");
63760
63871
  src.push(" float dist = 0.0;");
63761
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63872
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63762
63873
  src.push("if (sectionPlaneActive" + i + ") {");
63763
63874
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63764
63875
  src.push("}");
@@ -63783,7 +63894,7 @@ class TrianglesInstancingOcclusionRenderer extends VBOSceneModelTriangleInstanci
63783
63894
  _buildVertexShader() {
63784
63895
  const scene = this._scene;
63785
63896
  const sectionPlanesState = scene._sectionPlanesState;
63786
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63897
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63787
63898
  const src = [];
63788
63899
  src.push("#version 300 es");
63789
63900
  src.push("// TrianglesInstancingOcclusionRenderer vertex shader");
@@ -63834,7 +63945,7 @@ class TrianglesInstancingOcclusionRenderer extends VBOSceneModelTriangleInstanci
63834
63945
  _buildFragmentShader() {
63835
63946
  const scene = this._scene;
63836
63947
  const sectionPlanesState = scene._sectionPlanesState;
63837
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63948
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63838
63949
  const src = [];
63839
63950
  src.push("#version 300 es");
63840
63951
  src.push("// TrianglesInstancingOcclusionRenderer fragment shader");
@@ -63849,7 +63960,7 @@ class TrianglesInstancingOcclusionRenderer extends VBOSceneModelTriangleInstanci
63849
63960
  if (clipping) {
63850
63961
  src.push("in vec4 vWorldPosition;");
63851
63962
  src.push("in float vFlags;");
63852
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63963
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63853
63964
  src.push("uniform bool sectionPlaneActive" + i + ";");
63854
63965
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63855
63966
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63861,7 +63972,7 @@ class TrianglesInstancingOcclusionRenderer extends VBOSceneModelTriangleInstanci
63861
63972
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63862
63973
  src.push(" if (clippable) {");
63863
63974
  src.push(" float dist = 0.0;");
63864
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63975
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63865
63976
  src.push("if (sectionPlaneActive" + i + ") {");
63866
63977
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63867
63978
  src.push("}");
@@ -63883,7 +63994,7 @@ class TrianglesInstancingDepthRenderer extends VBOSceneModelTriangleInstancingRe
63883
63994
  _buildVertexShader() {
63884
63995
  const scene = this._scene;
63885
63996
  const sectionPlanesState = scene._sectionPlanesState;
63886
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63997
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63887
63998
  const src = [];
63888
63999
  src.push("#version 300 es");
63889
64000
  src.push("// Instancing geometry depth drawing vertex shader");
@@ -63951,7 +64062,7 @@ class TrianglesInstancingDepthRenderer extends VBOSceneModelTriangleInstancingRe
63951
64062
  const sectionPlanesState = scene._sectionPlanesState;
63952
64063
  let i;
63953
64064
  let len;
63954
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64065
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63955
64066
  const src = [];
63956
64067
  src.push("#version 300 es");
63957
64068
  src.push("// Instancing geometry depth drawing fragment shader");
@@ -63966,7 +64077,7 @@ class TrianglesInstancingDepthRenderer extends VBOSceneModelTriangleInstancingRe
63966
64077
  if (clipping) {
63967
64078
  src.push("in vec4 vWorldPosition;");
63968
64079
  src.push("in float vFlags;");
63969
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64080
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63970
64081
  src.push("uniform bool sectionPlaneActive" + i + ";");
63971
64082
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63972
64083
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63979,7 +64090,7 @@ class TrianglesInstancingDepthRenderer extends VBOSceneModelTriangleInstancingRe
63979
64090
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63980
64091
  src.push(" if (clippable) {");
63981
64092
  src.push(" float dist = 0.0;");
63982
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64093
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63983
64094
  src.push("if (sectionPlaneActive" + i + ") {");
63984
64095
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63985
64096
  src.push("}");
@@ -64005,7 +64116,7 @@ class TrianglesInstancingNormalsRenderer extends VBOSceneModelTriangleInstancing
64005
64116
  _buildVertexShader() {
64006
64117
  const scene = this._scene;
64007
64118
  const sectionPlanesState = scene._sectionPlanesState;
64008
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64119
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64009
64120
  const src = [];
64010
64121
  src.push("#version 300 es");
64011
64122
  src.push("// Instancing geometry normals drawing vertex shader");
@@ -64081,7 +64192,7 @@ class TrianglesInstancingNormalsRenderer extends VBOSceneModelTriangleInstancing
64081
64192
  _buildFragmentShader() {
64082
64193
  const scene = this._scene;
64083
64194
  const sectionPlanesState = scene._sectionPlanesState;
64084
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64195
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64085
64196
  const src = [];
64086
64197
  src.push("#version 300 es");
64087
64198
  src.push("// Instancing geometry depth drawing fragment shader");
@@ -64101,7 +64212,7 @@ class TrianglesInstancingNormalsRenderer extends VBOSceneModelTriangleInstancing
64101
64212
  if (clipping) {
64102
64213
  src.push("in vec4 vWorldPosition;");
64103
64214
  src.push("in float vFlags;");
64104
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64215
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
64105
64216
  src.push("uniform bool sectionPlaneActive" + i + ";");
64106
64217
  src.push("uniform vec3 sectionPlanePos" + i + ";");
64107
64218
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -64117,7 +64228,7 @@ class TrianglesInstancingNormalsRenderer extends VBOSceneModelTriangleInstancing
64117
64228
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
64118
64229
  src.push(" if (clippable) {");
64119
64230
  src.push(" float dist = 0.0;");
64120
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64231
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
64121
64232
  src.push("if (sectionPlaneActive" + i + ") {");
64122
64233
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
64123
64234
  src.push("}");
@@ -64144,7 +64255,7 @@ class TrianglesInstancingShadowRenderer extends VBOSceneModelTriangleInstancingR
64144
64255
  _buildVertexShader() {
64145
64256
  const scene = this._scene;
64146
64257
  const sectionPlanesState = scene._sectionPlanesState;
64147
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64258
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64148
64259
  const src = [];
64149
64260
  src.push("#version 300 es");
64150
64261
  src.push("// Instancing geometry shadow drawing vertex shader");
@@ -64193,7 +64304,7 @@ class TrianglesInstancingShadowRenderer extends VBOSceneModelTriangleInstancingR
64193
64304
  _buildFragmentShader() {
64194
64305
  const scene = this._scene;
64195
64306
  const sectionPlanesState = scene._sectionPlanesState;
64196
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64307
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64197
64308
  const src = [];
64198
64309
  src.push("#version 300 es");
64199
64310
  src.push("// Instancing geometry depth drawing fragment shader");
@@ -64212,7 +64323,7 @@ class TrianglesInstancingShadowRenderer extends VBOSceneModelTriangleInstancingR
64212
64323
  if (clipping) {
64213
64324
  src.push("in vec4 vWorldPosition;");
64214
64325
  src.push("in float vFlags;");
64215
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64326
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
64216
64327
  src.push("uniform bool sectionPlaneActive" + i + ";");
64217
64328
  src.push("uniform vec3 sectionPlanePos" + i + ";");
64218
64329
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -64228,7 +64339,7 @@ class TrianglesInstancingShadowRenderer extends VBOSceneModelTriangleInstancingR
64228
64339
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
64229
64340
  src.push(" if (clippable) {");
64230
64341
  src.push(" float dist = 0.0;");
64231
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64342
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
64232
64343
  src.push("if (sectionPlaneActive" + i + ") {");
64233
64344
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
64234
64345
  src.push("}");
@@ -64267,7 +64378,7 @@ class TrianglesInstancingPBRRenderer extends VBOSceneModelTriangleInstancingRend
64267
64378
  const scene = this._scene;
64268
64379
  const sectionPlanesState = scene._sectionPlanesState;
64269
64380
  const lightsState = scene._lightsState;
64270
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64381
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64271
64382
  const clippingCaps = sectionPlanesState.clippingCaps;
64272
64383
  const src = [];
64273
64384
  src.push("#version 300 es");
@@ -64393,7 +64504,7 @@ class TrianglesInstancingPBRRenderer extends VBOSceneModelTriangleInstancingRend
64393
64504
  const gammaOutput = scene.gammaOutput; // If set, then it expects that all textures and colors need to be outputted in premultiplied gamma. Default is false.
64394
64505
  const sectionPlanesState = scene._sectionPlanesState;
64395
64506
  const lightsState = scene._lightsState;
64396
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64507
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64397
64508
  const clippingCaps = sectionPlanesState.clippingCaps;
64398
64509
  const src = [];
64399
64510
  src.push("#version 300 es");
@@ -64483,7 +64594,7 @@ class TrianglesInstancingPBRRenderer extends VBOSceneModelTriangleInstancingRend
64483
64594
  if (clippingCaps) {
64484
64595
  src.push("in vec4 vClipPosition;");
64485
64596
  }
64486
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64597
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
64487
64598
  src.push("uniform bool sectionPlaneActive" + i + ";");
64488
64599
  src.push("uniform vec3 sectionPlanePos" + i + ";");
64489
64600
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -64672,7 +64783,7 @@ class TrianglesInstancingPBRRenderer extends VBOSceneModelTriangleInstancingRend
64672
64783
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
64673
64784
  src.push(" if (clippable) {");
64674
64785
  src.push(" float dist = 0.0;");
64675
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64786
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
64676
64787
  src.push("if (sectionPlaneActive" + i + ") {");
64677
64788
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
64678
64789
  src.push("}");
@@ -64812,7 +64923,7 @@ class TrianglesInstancingPickNormalsFlatRenderer extends VBOSceneModelTriangleIn
64812
64923
  _buildVertexShader() {
64813
64924
  const scene = this._scene;
64814
64925
  const sectionPlanesState = scene._sectionPlanesState;
64815
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64926
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64816
64927
  const src = [];
64817
64928
  src.push("#version 300 es");
64818
64929
  src.push("// Instancing geometry normals vertex shader");
@@ -64879,7 +64990,7 @@ class TrianglesInstancingPickNormalsFlatRenderer extends VBOSceneModelTriangleIn
64879
64990
  _buildFragmentShader() {
64880
64991
  const scene = this._scene;
64881
64992
  const sectionPlanesState = scene._sectionPlanesState;
64882
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64993
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64883
64994
  const src = [];
64884
64995
  src.push("#version 300 es");
64885
64996
  src.push("// Batched geometry normals fragment shader");
@@ -64900,7 +65011,7 @@ class TrianglesInstancingPickNormalsFlatRenderer extends VBOSceneModelTriangleIn
64900
65011
  src.push("in vec4 vWorldPosition;");
64901
65012
  if (clipping) {
64902
65013
  src.push("in float vFlags;");
64903
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
65014
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
64904
65015
  src.push("uniform bool sectionPlaneActive" + i + ";");
64905
65016
  src.push("uniform vec3 sectionPlanePos" + i + ";");
64906
65017
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -64912,7 +65023,7 @@ class TrianglesInstancingPickNormalsFlatRenderer extends VBOSceneModelTriangleIn
64912
65023
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
64913
65024
  src.push(" if (clippable) {");
64914
65025
  src.push(" float dist = 0.0;");
64915
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
65026
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
64916
65027
  src.push("if (sectionPlaneActive" + i + ") {");
64917
65028
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
64918
65029
  src.push("}");
@@ -64948,7 +65059,7 @@ class TrianglesInstancingColorTextureRenderer extends VBOSceneModelTriangleInsta
64948
65059
  _buildVertexShader() {
64949
65060
  const scene = this._scene;
64950
65061
  const sectionPlanesState = scene._sectionPlanesState;
64951
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
65062
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64952
65063
  const src = [];
64953
65064
  src.push("#version 300 es");
64954
65065
  src.push("// Instancing geometry drawing vertex shader");
@@ -65035,7 +65146,7 @@ class TrianglesInstancingColorTextureRenderer extends VBOSceneModelTriangleInsta
65035
65146
  const lightsState = scene._lightsState;
65036
65147
  let i;
65037
65148
  let len;
65038
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
65149
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
65039
65150
  const src = [];
65040
65151
  src.push("#version 300 es");
65041
65152
  src.push("// Instancing geometry drawing fragment shader");
@@ -65084,7 +65195,7 @@ class TrianglesInstancingColorTextureRenderer extends VBOSceneModelTriangleInsta
65084
65195
  if (clipping) {
65085
65196
  src.push("in vec4 vWorldPosition;");
65086
65197
  src.push("in float vFlags;");
65087
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
65198
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
65088
65199
  src.push("uniform bool sectionPlaneActive" + i + ";");
65089
65200
  src.push("uniform vec3 sectionPlanePos" + i + ";");
65090
65201
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -65122,7 +65233,7 @@ class TrianglesInstancingColorTextureRenderer extends VBOSceneModelTriangleInsta
65122
65233
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
65123
65234
  src.push(" if (clippable) {");
65124
65235
  src.push(" float dist = 0.0;");
65125
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
65236
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
65126
65237
  src.push("if (sectionPlaneActive" + i + ") {");
65127
65238
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
65128
65239
  src.push("}");
@@ -65534,7 +65645,7 @@ function getInstancingRenderers$1(scene) {
65534
65645
  const tempVec3a$o = math.vec3();
65535
65646
  const tempVec3b$k = math.vec3();
65536
65647
  const tempVec3c$h = math.vec3();
65537
- const tempVec3d$d = math.vec3();
65648
+ const tempVec3d$5 = math.vec3();
65538
65649
  const tempMat4a$e = math.mat4();
65539
65650
 
65540
65651
  /**
@@ -65603,7 +65714,7 @@ class SnapInstancingDepthBufInitRenderer extends VBOSceneModelRenderer {
65603
65714
  rtcOrigin[1] += position[1];
65604
65715
  rtcOrigin[2] += position[2];
65605
65716
  rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a$e);
65606
- rtcCameraEye = tempVec3d$d;
65717
+ rtcCameraEye = tempVec3d$5;
65607
65718
  rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];
65608
65719
  rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];
65609
65720
  rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];
@@ -65703,7 +65814,7 @@ class SnapInstancingDepthBufInitRenderer extends VBOSceneModelRenderer {
65703
65814
  _buildVertexShader() {
65704
65815
  const scene = this._scene;
65705
65816
  const sectionPlanesState = scene._sectionPlanesState;
65706
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
65817
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
65707
65818
  const src = [];
65708
65819
  src.push ('#version 300 es');
65709
65820
  src.push("// SnapInstancingDepthBufInitRenderer vertex shader");
@@ -65793,7 +65904,7 @@ class SnapInstancingDepthBufInitRenderer extends VBOSceneModelRenderer {
65793
65904
  _buildFragmentShader() {
65794
65905
  const scene = this._scene;
65795
65906
  const sectionPlanesState = scene._sectionPlanesState;
65796
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
65907
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
65797
65908
  const src = [];
65798
65909
  src.push ('#version 300 es');
65799
65910
  src.push("// Points instancing pick depth fragment shader");
@@ -65815,7 +65926,7 @@ class SnapInstancingDepthBufInitRenderer extends VBOSceneModelRenderer {
65815
65926
  src.push("flat in vec4 vPickColor;");
65816
65927
  if (clipping) {
65817
65928
  src.push("in float vFlags;");
65818
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
65929
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
65819
65930
  src.push("uniform bool sectionPlaneActive" + i + ";");
65820
65931
  src.push("uniform vec3 sectionPlanePos" + i + ";");
65821
65932
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -65830,7 +65941,7 @@ class SnapInstancingDepthBufInitRenderer extends VBOSceneModelRenderer {
65830
65941
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
65831
65942
  src.push(" if (clippable) {");
65832
65943
  src.push(" float dist = 0.0;");
65833
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
65944
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
65834
65945
  src.push("if (sectionPlaneActive" + i + ") {");
65835
65946
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
65836
65947
  src.push("}");
@@ -65870,7 +65981,7 @@ class SnapInstancingDepthBufInitRenderer extends VBOSceneModelRenderer {
65870
65981
  const tempVec3a$n = math.vec3();
65871
65982
  const tempVec3b$j = math.vec3();
65872
65983
  const tempVec3c$g = math.vec3();
65873
- const tempVec3d$c = math.vec3();
65984
+ const tempVec3d$4 = math.vec3();
65874
65985
  const tempMat4a$d = math.mat4();
65875
65986
 
65876
65987
  /**
@@ -65940,7 +66051,7 @@ class SnapInstancingDepthRenderer extends VBOSceneModelRenderer {
65940
66051
  rtcOrigin[1] += position[1];
65941
66052
  rtcOrigin[2] += position[2];
65942
66053
  rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a$d);
65943
- rtcCameraEye = tempVec3d$c;
66054
+ rtcCameraEye = tempVec3d$4;
65944
66055
  rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];
65945
66056
  rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];
65946
66057
  rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];
@@ -66037,7 +66148,7 @@ class SnapInstancingDepthRenderer extends VBOSceneModelRenderer {
66037
66148
  _buildVertexShader() {
66038
66149
  const scene = this._scene;
66039
66150
  const sectionPlanesState = scene._sectionPlanesState;
66040
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
66151
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
66041
66152
  const src = [];
66042
66153
  src.push ('#version 300 es');
66043
66154
  src.push("// SnapInstancingDepthRenderer vertex shader");
@@ -66125,7 +66236,7 @@ class SnapInstancingDepthRenderer extends VBOSceneModelRenderer {
66125
66236
  _buildFragmentShader() {
66126
66237
  const scene = this._scene;
66127
66238
  const sectionPlanesState = scene._sectionPlanesState;
66128
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
66239
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
66129
66240
  const src = [];
66130
66241
  src.push ('#version 300 es');
66131
66242
  src.push("// SnapInstancingDepthRenderer fragment shader");
@@ -66146,7 +66257,7 @@ class SnapInstancingDepthRenderer extends VBOSceneModelRenderer {
66146
66257
  if (clipping) {
66147
66258
  src.push("in vec4 vWorldPosition;");
66148
66259
  src.push("in float vFlags;");
66149
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
66260
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
66150
66261
  src.push("uniform bool sectionPlaneActive" + i + ";");
66151
66262
  src.push("uniform vec3 sectionPlanePos" + i + ";");
66152
66263
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -66159,7 +66270,7 @@ class SnapInstancingDepthRenderer extends VBOSceneModelRenderer {
66159
66270
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
66160
66271
  src.push(" if (clippable) {");
66161
66272
  src.push(" float dist = 0.0;");
66162
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
66273
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
66163
66274
  src.push("if (sectionPlaneActive" + i + ") {");
66164
66275
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
66165
66276
  src.push("}");
@@ -66280,8 +66391,8 @@ const tempVec3fa$2 = new Float32Array(3);
66280
66391
  const tempVec3a$m = math.vec3();
66281
66392
  const tempVec3b$i = math.vec3();
66282
66393
  const tempVec3c$f = math.vec3();
66283
- const tempVec3d$b = math.vec3();
66284
- const tempVec3e$2 = math.vec3();
66394
+ const tempVec3d$3 = math.vec3();
66395
+ const tempVec3e = math.vec3();
66285
66396
  const tempVec3f = math.vec3();
66286
66397
  const tempVec3g = math.vec3();
66287
66398
 
@@ -67357,8 +67468,8 @@ class TrianglesInstancingLayer {
67357
67468
 
67358
67469
  math.transformRay(portion.inverseMatrix, rtcRayOrigin, rtcRayDir, rtcRayOrigin, rtcRayDir);
67359
67470
 
67360
- const a = tempVec3d$b;
67361
- const b = tempVec3e$2;
67471
+ const a = tempVec3d$3;
67472
+ const b = tempVec3e;
67362
67473
  const c = tempVec3f;
67363
67474
 
67364
67475
  let gotIntersect = false;
@@ -67488,7 +67599,7 @@ class LinesBatchingColorRenderer extends VBOSceneModelLineBatchingRenderer {
67488
67599
  _buildVertexShader() {
67489
67600
  const scene = this._scene;
67490
67601
  const sectionPlanesState = scene._sectionPlanesState;
67491
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
67602
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
67492
67603
  const src = [];
67493
67604
  src.push('#version 300 es');
67494
67605
  src.push("// Lines batching color vertex shader");
@@ -67541,7 +67652,7 @@ class LinesBatchingColorRenderer extends VBOSceneModelLineBatchingRenderer {
67541
67652
  _buildFragmentShader() {
67542
67653
  const scene = this._scene;
67543
67654
  const sectionPlanesState = scene._sectionPlanesState;
67544
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
67655
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
67545
67656
  const src = [];
67546
67657
  src.push('#version 300 es');
67547
67658
  src.push("// Lines batching color fragment shader");
@@ -67559,7 +67670,7 @@ class LinesBatchingColorRenderer extends VBOSceneModelLineBatchingRenderer {
67559
67670
  if (clipping) {
67560
67671
  src.push("in vec4 vWorldPosition;");
67561
67672
  src.push("in float vFlags;");
67562
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
67673
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
67563
67674
  src.push("uniform bool sectionPlaneActive" + i + ";");
67564
67675
  src.push("uniform vec3 sectionPlanePos" + i + ";");
67565
67676
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -67572,7 +67683,7 @@ class LinesBatchingColorRenderer extends VBOSceneModelLineBatchingRenderer {
67572
67683
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
67573
67684
  src.push(" if (clippable) {");
67574
67685
  src.push(" float dist = 0.0;");
67575
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
67686
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
67576
67687
  src.push("if (sectionPlaneActive" + i + ") {");
67577
67688
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
67578
67689
  src.push("}");
@@ -67602,7 +67713,7 @@ class LinesBatchingSilhouetteRenderer extends VBOSceneModelLineBatchingRenderer
67602
67713
 
67603
67714
  const scene = this._scene;
67604
67715
  const sectionPlanesState = scene._sectionPlanesState;
67605
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
67716
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
67606
67717
 
67607
67718
  const src = [];
67608
67719
  src.push('#version 300 es');
@@ -67663,7 +67774,7 @@ class LinesBatchingSilhouetteRenderer extends VBOSceneModelLineBatchingRenderer
67663
67774
 
67664
67775
  const scene = this._scene;
67665
67776
  const sectionPlanesState = scene._sectionPlanesState;
67666
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
67777
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
67667
67778
  const src = [];
67668
67779
  src.push('#version 300 es');
67669
67780
  src.push("// Lines batching silhouette fragment shader");
@@ -67682,7 +67793,7 @@ class LinesBatchingSilhouetteRenderer extends VBOSceneModelLineBatchingRenderer
67682
67793
  if (clipping) {
67683
67794
  src.push("in vec4 vWorldPosition;");
67684
67795
  src.push("in float vFlags;");
67685
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
67796
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
67686
67797
  src.push("uniform bool sectionPlaneActive" + i + ";");
67687
67798
  src.push("uniform vec3 sectionPlanePos" + i + ";");
67688
67799
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -67695,7 +67806,7 @@ class LinesBatchingSilhouetteRenderer extends VBOSceneModelLineBatchingRenderer
67695
67806
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
67696
67807
  src.push(" if (clippable) {");
67697
67808
  src.push(" float dist = 0.0;");
67698
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
67809
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
67699
67810
  src.push("if (sectionPlaneActive" + i + ") {");
67700
67811
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
67701
67812
  src.push("}");
@@ -68543,7 +68654,7 @@ class LinesInstancingColorRenderer extends VBOSceneModelLineInstancingRenderer {
68543
68654
  _buildVertexShader() {
68544
68655
  const scene = this._scene;
68545
68656
  const sectionPlanesState = scene._sectionPlanesState;
68546
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
68657
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
68547
68658
  const src = [];
68548
68659
  src.push('#version 300 es');
68549
68660
  src.push("// Lines instancing color vertex shader");
@@ -68616,7 +68727,7 @@ class LinesInstancingColorRenderer extends VBOSceneModelLineInstancingRenderer {
68616
68727
  const sectionPlanesState = scene._sectionPlanesState;
68617
68728
  let i;
68618
68729
  let len;
68619
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
68730
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
68620
68731
  const src = [];
68621
68732
  src.push('#version 300 es');
68622
68733
  src.push("// Lines instancing color fragment shader");
@@ -68634,7 +68745,7 @@ class LinesInstancingColorRenderer extends VBOSceneModelLineInstancingRenderer {
68634
68745
  if (clipping) {
68635
68746
  src.push("in vec4 vWorldPosition;");
68636
68747
  src.push("in float vFlags;");
68637
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
68748
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
68638
68749
  src.push("uniform bool sectionPlaneActive" + i + ";");
68639
68750
  src.push("uniform vec3 sectionPlanePos" + i + ";");
68640
68751
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -68647,7 +68758,7 @@ class LinesInstancingColorRenderer extends VBOSceneModelLineInstancingRenderer {
68647
68758
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
68648
68759
  src.push(" if (clippable) {");
68649
68760
  src.push(" float dist = 0.0;");
68650
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
68761
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
68651
68762
  src.push("if (sectionPlaneActive" + i + ") {");
68652
68763
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
68653
68764
  src.push("}");
@@ -68690,7 +68801,7 @@ class LinesInstancingSilhouetteRenderer extends VBOSceneModelLineInstancingRende
68690
68801
  _buildVertexShader() {
68691
68802
  const scene = this._scene;
68692
68803
  const sectionPlanesState = scene._sectionPlanesState;
68693
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
68804
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
68694
68805
  const src = [];
68695
68806
  src.push('#version 300 es');
68696
68807
  src.push("// Lines instancing silhouette vertex shader");
@@ -68755,7 +68866,7 @@ class LinesInstancingSilhouetteRenderer extends VBOSceneModelLineInstancingRende
68755
68866
  _buildFragmentShader() {
68756
68867
  const scene = this._scene;
68757
68868
  const sectionPlanesState = scene._sectionPlanesState;
68758
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
68869
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
68759
68870
  const src = [];
68760
68871
  src.push('#version 300 es');
68761
68872
  src.push("// Lines instancing silhouette fragment shader");
@@ -68773,7 +68884,7 @@ class LinesInstancingSilhouetteRenderer extends VBOSceneModelLineInstancingRende
68773
68884
  if (clipping) {
68774
68885
  src.push("in vec4 vWorldPosition;");
68775
68886
  src.push("in float vFlags;");
68776
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
68887
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
68777
68888
  src.push("uniform bool sectionPlaneActive" + i + ";");
68778
68889
  src.push("uniform vec3 sectionPlanePos" + i + ";");
68779
68890
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -68786,7 +68897,7 @@ class LinesInstancingSilhouetteRenderer extends VBOSceneModelLineInstancingRende
68786
68897
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
68787
68898
  src.push(" if (clippable) {");
68788
68899
  src.push(" float dist = 0.0;");
68789
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
68900
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
68790
68901
  src.push("if (sectionPlaneActive" + i + ") {");
68791
68902
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
68792
68903
  src.push("}");
@@ -69565,7 +69676,7 @@ class PointsBatchingColorRenderer extends VBOSceneModelPointBatchingRenderer {
69565
69676
 
69566
69677
  const scene = this._scene;
69567
69678
  const sectionPlanesState = scene._sectionPlanesState;
69568
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
69679
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
69569
69680
  const pointsMaterial = scene.pointsMaterial;
69570
69681
  const src = [];
69571
69682
  src.push('#version 300 es');
@@ -69658,7 +69769,7 @@ class PointsBatchingColorRenderer extends VBOSceneModelPointBatchingRenderer {
69658
69769
 
69659
69770
  const scene = this._scene;
69660
69771
  const sectionPlanesState = scene._sectionPlanesState;
69661
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
69772
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
69662
69773
  const src = [];
69663
69774
  src.push('#version 300 es');
69664
69775
  src.push("// Points batching color fragment shader");
@@ -69677,7 +69788,7 @@ class PointsBatchingColorRenderer extends VBOSceneModelPointBatchingRenderer {
69677
69788
  if (clipping) {
69678
69789
  src.push("in vec4 vWorldPosition;");
69679
69790
  src.push("in float vFlags;");
69680
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
69791
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
69681
69792
  src.push("uniform bool sectionPlaneActive" + i + ";");
69682
69793
  src.push("uniform vec3 sectionPlanePos" + i + ";");
69683
69794
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -69697,7 +69808,7 @@ class PointsBatchingColorRenderer extends VBOSceneModelPointBatchingRenderer {
69697
69808
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
69698
69809
  src.push(" if (clippable) {");
69699
69810
  src.push(" float dist = 0.0;");
69700
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
69811
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
69701
69812
  src.push("if (sectionPlaneActive" + i + ") {");
69702
69813
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
69703
69814
  src.push("}");
@@ -69730,7 +69841,7 @@ class PointsBatchingSilhouetteRenderer extends VBOSceneModelPointBatchingRendere
69730
69841
 
69731
69842
  const scene = this._scene;
69732
69843
  const sectionPlanesState = scene._sectionPlanesState;
69733
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
69844
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
69734
69845
  const pointsMaterial = scene.pointsMaterial._state;
69735
69846
  const src = [];
69736
69847
  src.push ('#version 300 es');
@@ -69803,7 +69914,7 @@ class PointsBatchingSilhouetteRenderer extends VBOSceneModelPointBatchingRendere
69803
69914
  const sectionPlanesState = scene._sectionPlanesState;
69804
69915
  let i;
69805
69916
  let len;
69806
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
69917
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
69807
69918
  const src = [];
69808
69919
  src.push ('#version 300 es');
69809
69920
  src.push("// Points batching silhouette vertex shader");
@@ -69821,7 +69932,7 @@ class PointsBatchingSilhouetteRenderer extends VBOSceneModelPointBatchingRendere
69821
69932
  if (clipping) {
69822
69933
  src.push("in vec4 vWorldPosition;");
69823
69934
  src.push("in float vFlags;");
69824
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
69935
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
69825
69936
  src.push("uniform bool sectionPlaneActive" + i + ";");
69826
69937
  src.push("uniform vec3 sectionPlanePos" + i + ";");
69827
69938
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -69841,7 +69952,7 @@ class PointsBatchingSilhouetteRenderer extends VBOSceneModelPointBatchingRendere
69841
69952
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
69842
69953
  src.push(" if (clippable) {");
69843
69954
  src.push(" float dist = 0.0;");
69844
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
69955
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
69845
69956
  src.push("if (sectionPlaneActive" + i + ") {");
69846
69957
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
69847
69958
  src.push("}");
@@ -69869,7 +69980,7 @@ class PointsBatchingPickMeshRenderer extends VBOSceneModelPointBatchingRenderer
69869
69980
  _buildVertexShader() {
69870
69981
 
69871
69982
  const scene = this._scene;
69872
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
69983
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
69873
69984
  const pointsMaterial = scene.pointsMaterial._state;
69874
69985
  const src = [];
69875
69986
  src.push ('#version 300 es');
@@ -69948,7 +70059,7 @@ class PointsBatchingPickMeshRenderer extends VBOSceneModelPointBatchingRenderer
69948
70059
  _buildFragmentShader() {
69949
70060
  const scene = this._scene;
69950
70061
  const sectionPlanesState = scene._sectionPlanesState;
69951
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
70062
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
69952
70063
  const src = [];
69953
70064
  src.push ('#version 300 es');
69954
70065
  src.push("// Points batching pick mesh vertex shader");
@@ -69966,7 +70077,7 @@ class PointsBatchingPickMeshRenderer extends VBOSceneModelPointBatchingRenderer
69966
70077
  if (clipping) {
69967
70078
  src.push("in vec4 vWorldPosition;");
69968
70079
  src.push("in float vFlags;");
69969
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
70080
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
69970
70081
  src.push("uniform bool sectionPlaneActive" + i + ";");
69971
70082
  src.push("uniform vec3 sectionPlanePos" + i + ";");
69972
70083
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -69986,7 +70097,7 @@ class PointsBatchingPickMeshRenderer extends VBOSceneModelPointBatchingRenderer
69986
70097
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
69987
70098
  src.push(" if (clippable) {");
69988
70099
  src.push(" float dist = 0.0;");
69989
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
70100
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
69990
70101
  src.push(" if (sectionPlaneActive" + i + ") {");
69991
70102
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
69992
70103
  src.push(" }");
@@ -70013,7 +70124,7 @@ class PointsBatchingPickDepthRenderer extends VBOSceneModelPointBatchingRenderer
70013
70124
 
70014
70125
  _buildVertexShader() {
70015
70126
  const scene = this._scene;
70016
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
70127
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
70017
70128
  const pointsMaterial = scene.pointsMaterial._state;
70018
70129
  const src = [];
70019
70130
  src.push ('#version 300 es');
@@ -70087,7 +70198,7 @@ class PointsBatchingPickDepthRenderer extends VBOSceneModelPointBatchingRenderer
70087
70198
  _buildFragmentShader() {
70088
70199
  const scene = this._scene;
70089
70200
  const sectionPlanesState = scene._sectionPlanesState;
70090
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
70201
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
70091
70202
  const src = [];
70092
70203
  src.push ('#version 300 es');
70093
70204
  src.push("// Points batched pick depth fragment shader");
@@ -70111,7 +70222,7 @@ class PointsBatchingPickDepthRenderer extends VBOSceneModelPointBatchingRenderer
70111
70222
  if (clipping) {
70112
70223
  src.push("in vec4 vWorldPosition;");
70113
70224
  src.push("in float vFlags;");
70114
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
70225
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
70115
70226
  src.push("uniform bool sectionPlaneActive" + i + ";");
70116
70227
  src.push("uniform vec3 sectionPlanePos" + i + ";");
70117
70228
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -70138,7 +70249,7 @@ class PointsBatchingPickDepthRenderer extends VBOSceneModelPointBatchingRenderer
70138
70249
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
70139
70250
  src.push(" if (clippable) {");
70140
70251
  src.push(" float dist = 0.0;");
70141
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
70252
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
70142
70253
  src.push(" if (sectionPlaneActive" + i + ") {");
70143
70254
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
70144
70255
  src.push(" }");
@@ -70166,7 +70277,7 @@ class PointsBatchingOcclusionRenderer extends VBOSceneModelPointBatchingRenderer
70166
70277
 
70167
70278
  _buildVertexShader() {
70168
70279
  const scene = this._scene;
70169
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
70280
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
70170
70281
  const pointsMaterial = scene.pointsMaterial._state;
70171
70282
  const src = [];
70172
70283
  src.push ('#version 300 es');
@@ -70234,7 +70345,7 @@ class PointsBatchingOcclusionRenderer extends VBOSceneModelPointBatchingRenderer
70234
70345
  _buildFragmentShader() {
70235
70346
  const scene = this._scene;
70236
70347
  const sectionPlanesState = scene._sectionPlanesState;
70237
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
70348
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
70238
70349
  const src = [];
70239
70350
  src.push ('#version 300 es');
70240
70351
  src.push("// Points batching occlusion fragment shader");
@@ -70252,7 +70363,7 @@ class PointsBatchingOcclusionRenderer extends VBOSceneModelPointBatchingRenderer
70252
70363
  if (clipping) {
70253
70364
  src.push("in vec4 vWorldPosition;");
70254
70365
  src.push("in float vFlags;");
70255
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
70366
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
70256
70367
  src.push("uniform bool sectionPlaneActive" + i + ";");
70257
70368
  src.push("uniform vec3 sectionPlanePos" + i + ";");
70258
70369
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -70271,7 +70382,7 @@ class PointsBatchingOcclusionRenderer extends VBOSceneModelPointBatchingRenderer
70271
70382
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
70272
70383
  src.push(" if (clippable) {");
70273
70384
  src.push(" float dist = 0.0;");
70274
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
70385
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
70275
70386
  src.push(" if (sectionPlaneActive" + i + ") {");
70276
70387
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
70277
70388
  src.push(" }");
@@ -71174,7 +71285,7 @@ class PointsInstancingColorRenderer extends VBOSceneModelPointInstancingRenderer
71174
71285
  _buildVertexShader() {
71175
71286
  const scene = this._scene;
71176
71287
  const sectionPlanesState = scene._sectionPlanesState;
71177
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71288
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71178
71289
  const pointsMaterial = scene.pointsMaterial._state;
71179
71290
  const src = [];
71180
71291
  src.push('#version 300 es');
@@ -71274,7 +71385,7 @@ class PointsInstancingColorRenderer extends VBOSceneModelPointInstancingRenderer
71274
71385
  _buildFragmentShader() {
71275
71386
  const scene = this._scene;
71276
71387
  const sectionPlanesState = scene._sectionPlanesState;
71277
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71388
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71278
71389
  const src = [];
71279
71390
  src.push('#version 300 es');
71280
71391
  src.push("// Points instancing color fragment shader");
@@ -71293,7 +71404,7 @@ class PointsInstancingColorRenderer extends VBOSceneModelPointInstancingRenderer
71293
71404
  if (clipping) {
71294
71405
  src.push("in vec4 vWorldPosition;");
71295
71406
  src.push("in float vFlags;");
71296
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
71407
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
71297
71408
  src.push("uniform bool sectionPlaneActive" + i + ";");
71298
71409
  src.push("uniform vec3 sectionPlanePos" + i + ";");
71299
71410
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -71313,7 +71424,7 @@ class PointsInstancingColorRenderer extends VBOSceneModelPointInstancingRenderer
71313
71424
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
71314
71425
  src.push(" if (clippable) {");
71315
71426
  src.push(" float dist = 0.0;");
71316
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
71427
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
71317
71428
  src.push("if (sectionPlaneActive" + i + ") {");
71318
71429
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
71319
71430
  src.push("}");
@@ -71346,7 +71457,7 @@ class PointsInstancingSilhouetteRenderer extends VBOSceneModelPointInstancingRen
71346
71457
 
71347
71458
  const scene = this._scene;
71348
71459
  const sectionPlanesState = scene._sectionPlanesState;
71349
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71460
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71350
71461
  const pointsMaterial = scene.pointsMaterial._state;
71351
71462
  const src = [];
71352
71463
  src.push ('#version 300 es');
@@ -71428,7 +71539,7 @@ class PointsInstancingSilhouetteRenderer extends VBOSceneModelPointInstancingRen
71428
71539
  _buildFragmentShader() {
71429
71540
  const scene = this._scene;
71430
71541
  const sectionPlanesState = scene._sectionPlanesState;
71431
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71542
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71432
71543
  const src = [];
71433
71544
  src.push ('#version 300 es');
71434
71545
  src.push("// Points instancing silhouette fragment shader");
@@ -71446,7 +71557,7 @@ class PointsInstancingSilhouetteRenderer extends VBOSceneModelPointInstancingRen
71446
71557
  if (clipping) {
71447
71558
  src.push("in vec4 vWorldPosition;");
71448
71559
  src.push("in float vFlags;");
71449
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
71560
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
71450
71561
  src.push("uniform bool sectionPlaneActive" + i + ";");
71451
71562
  src.push("uniform vec3 sectionPlanePos" + i + ";");
71452
71563
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -71466,7 +71577,7 @@ class PointsInstancingSilhouetteRenderer extends VBOSceneModelPointInstancingRen
71466
71577
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
71467
71578
  src.push(" if (clippable) {");
71468
71579
  src.push(" float dist = 0.0;");
71469
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
71580
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
71470
71581
  src.push("if (sectionPlaneActive" + i + ") {");
71471
71582
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
71472
71583
  src.push("}");
@@ -71494,7 +71605,7 @@ class PointsInstancingPickMeshRenderer extends VBOSceneModelPointInstancingRende
71494
71605
  _buildVertexShader() {
71495
71606
  const scene = this._scene;
71496
71607
  const sectionPlanesState = scene._sectionPlanesState;
71497
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71608
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71498
71609
  const pointsMaterial = scene.pointsMaterial._state;
71499
71610
  const src = [];
71500
71611
  src.push ('#version 300 es');
@@ -71577,7 +71688,7 @@ class PointsInstancingPickMeshRenderer extends VBOSceneModelPointInstancingRende
71577
71688
  _buildFragmentShader() {
71578
71689
  const scene = this._scene;
71579
71690
  const sectionPlanesState = scene._sectionPlanesState;
71580
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71691
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71581
71692
  const src = [];
71582
71693
  src.push ('#version 300 es');
71583
71694
  src.push("// Points instancing pick mesh fragment shader");
@@ -71595,7 +71706,7 @@ class PointsInstancingPickMeshRenderer extends VBOSceneModelPointInstancingRende
71595
71706
  if (clipping) {
71596
71707
  src.push("in vec4 vWorldPosition;");
71597
71708
  src.push("in float vFlags;");
71598
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
71709
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
71599
71710
  src.push("uniform bool sectionPlaneActive" + i + ";");
71600
71711
  src.push("uniform vec3 sectionPlanePos" + i + ";");
71601
71712
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -71617,7 +71728,7 @@ class PointsInstancingPickMeshRenderer extends VBOSceneModelPointInstancingRende
71617
71728
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
71618
71729
  src.push(" if (clippable) {");
71619
71730
  src.push(" float dist = 0.0;");
71620
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
71731
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
71621
71732
  src.push("if (sectionPlaneActive" + i + ") {");
71622
71733
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
71623
71734
  src.push("}");
@@ -71645,7 +71756,7 @@ class PointsInstancingPickDepthRenderer extends VBOSceneModelPointInstancingRend
71645
71756
  _buildVertexShader() {
71646
71757
  const scene = this._scene;
71647
71758
  const sectionPlanesState = scene._sectionPlanesState;
71648
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71759
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71649
71760
  const pointsMaterial = scene.pointsMaterial._state;
71650
71761
  const src = [];
71651
71762
 
@@ -71730,7 +71841,7 @@ class PointsInstancingPickDepthRenderer extends VBOSceneModelPointInstancingRend
71730
71841
  _buildFragmentShader() {
71731
71842
  const scene = this._scene;
71732
71843
  const sectionPlanesState = scene._sectionPlanesState;
71733
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71844
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71734
71845
  const src = [];
71735
71846
  src.push ('#version 300 es');
71736
71847
  src.push("// Points instancing pick depth fragment shader");
@@ -71754,7 +71865,7 @@ class PointsInstancingPickDepthRenderer extends VBOSceneModelPointInstancingRend
71754
71865
  if (clipping) {
71755
71866
  src.push("in vec4 vWorldPosition;");
71756
71867
  src.push("in float vFlags;");
71757
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
71868
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
71758
71869
  src.push("uniform bool sectionPlaneActive" + i + ";");
71759
71870
  src.push("uniform vec3 sectionPlanePos" + i + ";");
71760
71871
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -71783,7 +71894,7 @@ class PointsInstancingPickDepthRenderer extends VBOSceneModelPointInstancingRend
71783
71894
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
71784
71895
  src.push(" if (clippable) {");
71785
71896
  src.push(" float dist = 0.0;");
71786
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
71897
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
71787
71898
  src.push("if (sectionPlaneActive" + i + ") {");
71788
71899
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
71789
71900
  src.push("}");
@@ -71813,7 +71924,7 @@ class PointsInstancingOcclusionRenderer extends VBOSceneModelPointInstancingRend
71813
71924
 
71814
71925
  const scene = this._scene;
71815
71926
  const sectionPlanesState = scene._sectionPlanesState;
71816
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71927
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71817
71928
  const pointsMaterial = scene.pointsMaterial._state;
71818
71929
  const src = [];
71819
71930
 
@@ -71895,7 +72006,7 @@ class PointsInstancingOcclusionRenderer extends VBOSceneModelPointInstancingRend
71895
72006
  _buildFragmentShader() {
71896
72007
  const scene = this._scene;
71897
72008
  const sectionPlanesState = scene._sectionPlanesState;
71898
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
72009
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71899
72010
  const src = [];
71900
72011
  src.push ('#version 300 es');
71901
72012
  src.push("// Points instancing occlusion vertex shader");
@@ -71913,7 +72024,7 @@ class PointsInstancingOcclusionRenderer extends VBOSceneModelPointInstancingRend
71913
72024
  if (clipping) {
71914
72025
  src.push("in vec4 vWorldPosition;");
71915
72026
  src.push("in float vFlags;");
71916
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
72027
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
71917
72028
  src.push("uniform bool sectionPlaneActive" + i + ";");
71918
72029
  src.push("uniform vec3 sectionPlanePos" + i + ";");
71919
72030
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -71932,7 +72043,7 @@ class PointsInstancingOcclusionRenderer extends VBOSceneModelPointInstancingRend
71932
72043
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
71933
72044
  src.push(" if (clippable) {");
71934
72045
  src.push(" float dist = 0.0;");
71935
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
72046
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
71936
72047
  src.push("if (sectionPlaneActive" + i + ") {");
71937
72048
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
71938
72049
  src.push("}");
@@ -71960,7 +72071,7 @@ class PointsInstancingDepthRenderer extends VBOSceneModelPointInstancingRenderer
71960
72071
  _buildVertexShader() {
71961
72072
  const scene = this._scene;
71962
72073
  const sectionPlanesState = scene._sectionPlanesState;
71963
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
72074
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71964
72075
  const pointsMaterial = scene.pointsMaterial._state;
71965
72076
  const src = [];
71966
72077
  src.push('#version 300 es');
@@ -72033,7 +72144,7 @@ class PointsInstancingDepthRenderer extends VBOSceneModelPointInstancingRenderer
72033
72144
  const sectionPlanesState = scene._sectionPlanesState;
72034
72145
  let i;
72035
72146
  let len;
72036
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
72147
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
72037
72148
  const src = [];
72038
72149
  src.push('#version 300 es');
72039
72150
  src.push("// Points instancing depth vertex shader");
@@ -72051,7 +72162,7 @@ class PointsInstancingDepthRenderer extends VBOSceneModelPointInstancingRenderer
72051
72162
  if (clipping) {
72052
72163
  src.push("in vec4 vWorldPosition;");
72053
72164
  src.push("in float vFlags;");
72054
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
72165
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
72055
72166
  src.push("uniform bool sectionPlaneActive" + i + ";");
72056
72167
  src.push("uniform vec3 sectionPlanePos" + i + ";");
72057
72168
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -72085,7 +72196,7 @@ class PointsInstancingDepthRenderer extends VBOSceneModelPointInstancingRenderer
72085
72196
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
72086
72197
  src.push(" if (clippable) {");
72087
72198
  src.push(" float dist = 0.0;");
72088
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
72199
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
72089
72200
  src.push("if (sectionPlaneActive" + i + ") {");
72090
72201
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
72091
72202
  src.push("}");
@@ -72112,7 +72223,7 @@ class PointsInstancingShadowRenderer extends VBOSceneModelPointInstancingRendere
72112
72223
  _buildVertexShader() {
72113
72224
  const scene = this._scene;
72114
72225
  const sectionPlanesState = scene._sectionPlanesState;
72115
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
72226
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
72116
72227
  const src = [];
72117
72228
  src.push ('#version 300 es');
72118
72229
  src.push("// Instancing geometry shadow drawing vertex shader");
@@ -72163,7 +72274,7 @@ class PointsInstancingShadowRenderer extends VBOSceneModelPointInstancingRendere
72163
72274
  _buildFragmentShader() {
72164
72275
  const scene = this._scene;
72165
72276
  const sectionPlanesState = scene._sectionPlanesState;
72166
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
72277
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
72167
72278
  const src = [];
72168
72279
  src.push ('#version 300 es');
72169
72280
  src.push("// Instancing geometry depth drawing fragment shader");
@@ -72182,7 +72293,7 @@ class PointsInstancingShadowRenderer extends VBOSceneModelPointInstancingRendere
72182
72293
  if (clipping) {
72183
72294
  src.push("in vec4 vWorldPosition;");
72184
72295
  src.push("in float vFlags;");
72185
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
72296
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
72186
72297
  src.push("uniform bool sectionPlaneActive" + i + ";");
72187
72298
  src.push("uniform vec3 sectionPlanePos" + i + ";");
72188
72299
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -72203,7 +72314,7 @@ class PointsInstancingShadowRenderer extends VBOSceneModelPointInstancingRendere
72203
72314
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
72204
72315
  src.push(" if (clippable) {");
72205
72316
  src.push(" float dist = 0.0;");
72206
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
72317
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
72207
72318
  src.push("if (sectionPlaneActive" + i + ") {");
72208
72319
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
72209
72320
  src.push("}");
@@ -74660,7 +74771,7 @@ function doCheckResult(buckets, mesh) {
74660
74771
  const tempVec3a$k = math.vec3();
74661
74772
  const tempVec3b$g = math.vec3();
74662
74773
  const tempVec3c$e = math.vec3();
74663
- const tempVec3d$a = math.vec3();
74774
+ math.vec3();
74664
74775
 
74665
74776
  const tempVec4a$6 = math.vec4();
74666
74777
 
@@ -74759,25 +74870,30 @@ class TrianglesDataTextureColorRenderer {
74759
74870
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
74760
74871
  }
74761
74872
 
74873
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
74762
74874
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
74763
- if (numSectionPlanes > 0) {
74875
+ if (numAllocatedSectionPlanes > 0) {
74764
74876
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
74765
74877
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
74766
74878
  const renderFlags = model.renderFlags;
74767
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
74879
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
74768
74880
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
74769
74881
  if (sectionPlaneUniforms) {
74770
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
74771
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
74772
- if (active) {
74773
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
74774
- if (origin) {
74775
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3d$a);
74776
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
74777
- } else {
74778
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
74882
+ if (sectionPlaneIndex < numSectionPlanes) {
74883
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
74884
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
74885
+ if (active) {
74886
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
74887
+ if (origin) {
74888
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$k);
74889
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
74890
+ } else {
74891
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
74892
+ }
74893
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
74779
74894
  }
74780
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
74895
+ } else {
74896
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
74781
74897
  }
74782
74898
  }
74783
74899
  }
@@ -74872,7 +74988,7 @@ class TrianglesDataTextureColorRenderer {
74872
74988
 
74873
74989
  this._uSectionPlanes = [];
74874
74990
 
74875
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
74991
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
74876
74992
  this._uSectionPlanes.push({
74877
74993
  active: program.getLocation("sectionPlaneActive" + i),
74878
74994
  pos: program.getLocation("sectionPlanePos" + i),
@@ -74962,7 +75078,7 @@ class TrianglesDataTextureColorRenderer {
74962
75078
  const scene = this._scene;
74963
75079
  const sectionPlanesState = scene._sectionPlanesState;
74964
75080
  const lightsState = scene._lightsState;
74965
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
75081
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
74966
75082
  let light;
74967
75083
  const src = [];
74968
75084
  src.push("#version 300 es");
@@ -75173,7 +75289,7 @@ class TrianglesDataTextureColorRenderer {
75173
75289
  _buildFragmentShader() {
75174
75290
  const scene = this._scene;
75175
75291
  const sectionPlanesState = scene._sectionPlanesState;
75176
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
75292
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
75177
75293
  const src = [];
75178
75294
  src.push('#version 300 es');
75179
75295
  src.push("// TrianglesDataTextureColorRenderer fragment shader");
@@ -75207,7 +75323,7 @@ class TrianglesDataTextureColorRenderer {
75207
75323
  if (clipping) {
75208
75324
  src.push("in vec4 vWorldPosition;");
75209
75325
  src.push("flat in uint vFlags2;");
75210
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
75326
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
75211
75327
  src.push("uniform bool sectionPlaneActive" + i + ";");
75212
75328
  src.push("uniform vec3 sectionPlanePos" + i + ";");
75213
75329
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -75221,7 +75337,7 @@ class TrianglesDataTextureColorRenderer {
75221
75337
  src.push(" bool clippable = vFlags2 > 0u;");
75222
75338
  src.push(" if (clippable) {");
75223
75339
  src.push(" float dist = 0.0;");
75224
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
75340
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
75225
75341
  src.push("if (sectionPlaneActive" + i + ") {");
75226
75342
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
75227
75343
  src.push("}");
@@ -75272,7 +75388,7 @@ const defaultColor$1 = new Float32Array([1, 1, 1]);
75272
75388
  const tempVec3a$j = math.vec3();
75273
75389
  const tempVec3b$f = math.vec3();
75274
75390
  const tempVec3c$d = math.vec3();
75275
- const tempVec3d$9 = math.vec3();
75391
+ math.vec3();
75276
75392
  const tempMat4a$b = math.mat4();
75277
75393
 
75278
75394
  /**
@@ -75387,25 +75503,30 @@ class TrianglesDataTextureSilhouetteRenderer {
75387
75503
  const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2);
75388
75504
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
75389
75505
  }
75506
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
75390
75507
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
75391
- if (numSectionPlanes > 0) {
75508
+ if (numAllocatedSectionPlanes > 0) {
75392
75509
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
75393
75510
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
75394
75511
  const renderFlags = model.renderFlags;
75395
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
75512
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
75396
75513
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
75397
75514
  if (sectionPlaneUniforms) {
75398
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
75399
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
75400
- if (active) {
75401
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
75402
- if (origin) {
75403
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3d$9);
75404
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
75405
- } else {
75406
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
75515
+ if (sectionPlaneIndex < numSectionPlanes) {
75516
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
75517
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
75518
+ if (active) {
75519
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
75520
+ if (origin) {
75521
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$j);
75522
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
75523
+ } else {
75524
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
75525
+ }
75526
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
75407
75527
  }
75408
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
75528
+ } else {
75529
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
75409
75530
  }
75410
75531
  }
75411
75532
  }
@@ -75462,7 +75583,7 @@ class TrianglesDataTextureSilhouetteRenderer {
75462
75583
  this._uViewMatrix = program.getLocation("viewMatrix");
75463
75584
  this._uProjMatrix = program.getLocation("projMatrix");
75464
75585
  this._uSectionPlanes = [];
75465
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
75586
+ for (let i = 0, len = scene.getMaxSectionPlanes(); i < len; i++) {
75466
75587
  this._uSectionPlanes.push({
75467
75588
  active: program.getLocation("sectionPlaneActive" + i),
75468
75589
  pos: program.getLocation("sectionPlanePos" + i),
@@ -75507,8 +75628,7 @@ class TrianglesDataTextureSilhouetteRenderer {
75507
75628
  _buildVertexShader() {
75508
75629
 
75509
75630
  const scene = this._scene;
75510
- const sectionPlanesState = scene._sectionPlanesState;
75511
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
75631
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
75512
75632
 
75513
75633
  const src = [];
75514
75634
  src.push("#version 300 es");
@@ -75662,8 +75782,7 @@ class TrianglesDataTextureSilhouetteRenderer {
75662
75782
 
75663
75783
  _buildFragmentShader() {
75664
75784
  const scene = this._scene;
75665
- const sectionPlanesState = scene._sectionPlanesState;
75666
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
75785
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
75667
75786
  const src = [];
75668
75787
  src.push('#version 300 es');
75669
75788
  src.push("// Triangles dataTexture draw fragment shader");
@@ -75682,7 +75801,7 @@ class TrianglesDataTextureSilhouetteRenderer {
75682
75801
  if (clipping) {
75683
75802
  src.push("in vec4 vWorldPosition;");
75684
75803
  src.push("flat in uint vFlags2;");
75685
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
75804
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
75686
75805
  src.push("uniform bool sectionPlaneActive" + i + ";");
75687
75806
  src.push("uniform vec3 sectionPlanePos" + i + ";");
75688
75807
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -75695,7 +75814,7 @@ class TrianglesDataTextureSilhouetteRenderer {
75695
75814
  src.push(" bool clippable = vFlags2 > 0u;");
75696
75815
  src.push(" if (clippable) {");
75697
75816
  src.push(" float dist = 0.0;");
75698
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
75817
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
75699
75818
  src.push("if (sectionPlaneActive" + i + ") {");
75700
75819
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
75701
75820
  src.push("}");
@@ -75729,7 +75848,7 @@ const defaultColor = new Float32Array([0, 0, 0, 1]);
75729
75848
 
75730
75849
  const tempVec3a$i = math.vec3();
75731
75850
  const tempVec3b$e = math.vec3();
75732
- const tempVec3d$8 = math.vec3();
75851
+ math.vec3();
75733
75852
  const tempMat4a$a = math.mat4();
75734
75853
 
75735
75854
  /**
@@ -75834,25 +75953,30 @@ class TrianglesDataTextureEdgesRenderer {
75834
75953
  gl.uniform4fv(this._uColor, defaultColor);
75835
75954
  }
75836
75955
 
75956
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
75837
75957
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
75838
- if (numSectionPlanes > 0) {
75958
+ if (numAllocatedSectionPlanes > 0) {
75839
75959
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
75840
75960
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
75841
75961
  const renderFlags = model.renderFlags;
75842
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
75962
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
75843
75963
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
75844
75964
  if (sectionPlaneUniforms) {
75845
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
75846
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
75847
- if (active) {
75848
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
75849
- if (origin) {
75850
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3d$8);
75851
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
75852
- } else {
75853
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
75965
+ if (sectionPlaneIndex < numSectionPlanes) {
75966
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
75967
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
75968
+ if (active) {
75969
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
75970
+ if (origin) {
75971
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$i);
75972
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
75973
+ } else {
75974
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
75975
+ }
75976
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
75854
75977
  }
75855
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
75978
+ } else {
75979
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
75856
75980
  }
75857
75981
  }
75858
75982
  }
@@ -75910,7 +76034,7 @@ class TrianglesDataTextureEdgesRenderer {
75910
76034
  this._uViewMatrix = program.getLocation("viewMatrix");
75911
76035
  this._uProjMatrix = program.getLocation("projMatrix");
75912
76036
  this._uSectionPlanes = [];
75913
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
76037
+ for (let i = 0, len = scene.getMaxSectionPlanes(); i < len; i++) {
75914
76038
  this._uSectionPlanes.push({
75915
76039
  active: program.getLocation("sectionPlaneActive" + i),
75916
76040
  pos: program.getLocation("sectionPlanePos" + i),
@@ -75949,8 +76073,7 @@ class TrianglesDataTextureEdgesRenderer {
75949
76073
 
75950
76074
  _buildVertexShader() {
75951
76075
  const scene = this._scene;
75952
- const sectionPlanesState = scene._sectionPlanesState;
75953
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
76076
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
75954
76077
  const src = [];
75955
76078
  src.push("#version 300 es");
75956
76079
  src.push("// Batched geometry edges drawing vertex shader");
@@ -76077,8 +76200,7 @@ class TrianglesDataTextureEdgesRenderer {
76077
76200
 
76078
76201
  _buildFragmentShader() {
76079
76202
  const scene = this._scene;
76080
- const sectionPlanesState = scene._sectionPlanesState;
76081
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
76203
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
76082
76204
  const src = [];
76083
76205
  src.push('#version 300 es');
76084
76206
  src.push("// Batched geometry edges drawing fragment shader");
@@ -76100,7 +76222,7 @@ class TrianglesDataTextureEdgesRenderer {
76100
76222
  if (clipping) {
76101
76223
  src.push("in vec4 vWorldPosition;");
76102
76224
  src.push("flat in uint vFlags2;");
76103
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
76225
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
76104
76226
  src.push("uniform bool sectionPlaneActive" + i + ";");
76105
76227
  src.push("uniform vec3 sectionPlanePos" + i + ";");
76106
76228
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -76113,7 +76235,7 @@ class TrianglesDataTextureEdgesRenderer {
76113
76235
  src.push(" bool clippable = vFlags2 > 0u;");
76114
76236
  src.push(" if (clippable) {");
76115
76237
  src.push(" float dist = 0.0;");
76116
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
76238
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
76117
76239
  src.push("if (sectionPlaneActive" + i + ") {");
76118
76240
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
76119
76241
  src.push("}");
@@ -76225,7 +76347,7 @@ class TrianglesDataTextureEdgesColorRenderer {
76225
76347
  gl.uniformMatrix4fv(this._uViewMatrix, false, rtcViewMatrix);
76226
76348
  gl.uniformMatrix4fv(this._uProjMatrix, false, camera.projMatrix);
76227
76349
 
76228
- const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
76350
+ const numSectionPlanes = scene.getMaxSectionPlanes();
76229
76351
  if (numSectionPlanes > 0) {
76230
76352
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
76231
76353
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
@@ -76305,7 +76427,7 @@ class TrianglesDataTextureEdgesColorRenderer {
76305
76427
  this._uProjMatrix = program.getLocation("projMatrix");
76306
76428
  this._uSectionPlanes = [];
76307
76429
 
76308
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
76430
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
76309
76431
  this._uSectionPlanes.push({
76310
76432
  active: program.getLocation("sectionPlaneActive" + i),
76311
76433
  pos: program.getLocation("sectionPlanePos" + i),
@@ -76351,8 +76473,7 @@ class TrianglesDataTextureEdgesColorRenderer {
76351
76473
 
76352
76474
  _buildVertexShader() {
76353
76475
  const scene = this._scene;
76354
- const sectionPlanesState = scene._sectionPlanesState;
76355
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
76476
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
76356
76477
  const src = [];
76357
76478
  src.push("#version 300 es");
76358
76479
  src.push("// TrianglesDataTextureEdgesColorRenderer");
@@ -76487,8 +76608,7 @@ class TrianglesDataTextureEdgesColorRenderer {
76487
76608
 
76488
76609
  _buildFragmentShader() {
76489
76610
  const scene = this._scene;
76490
- const sectionPlanesState = scene._sectionPlanesState;
76491
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
76611
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
76492
76612
  const src = [];
76493
76613
  src.push('#version 300 es');
76494
76614
  src.push("// TrianglesDataTextureEdgesColorRenderer");
@@ -76507,7 +76627,7 @@ class TrianglesDataTextureEdgesColorRenderer {
76507
76627
  if (clipping) {
76508
76628
  src.push("in vec4 vWorldPosition;");
76509
76629
  src.push("flat in uint vFlags2;");
76510
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
76630
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
76511
76631
  src.push("uniform bool sectionPlaneActive" + i + ";");
76512
76632
  src.push("uniform vec3 sectionPlanePos" + i + ";");
76513
76633
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -76520,7 +76640,7 @@ class TrianglesDataTextureEdgesColorRenderer {
76520
76640
  src.push(" bool clippable = vFlags2 > 0u;");
76521
76641
  src.push(" if (clippable) {");
76522
76642
  src.push(" float dist = 0.0;");
76523
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
76643
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
76524
76644
  src.push("if (sectionPlaneActive" + i + ") {");
76525
76645
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
76526
76646
  src.push("}");
@@ -76529,8 +76649,7 @@ class TrianglesDataTextureEdgesColorRenderer {
76529
76649
  src.push("}");
76530
76650
  }
76531
76651
  if (scene.logarithmicDepthBufferEnabled) {
76532
- // src.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;");
76533
- src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");
76652
+ src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");
76534
76653
  }
76535
76654
  src.push(" outColor = vColor;");
76536
76655
  src.push("}");
@@ -76638,25 +76757,30 @@ class TrianglesDataTexturePickMeshRenderer {
76638
76757
  const logDepthBufFC = 2.0 / (Math.log(camera.project.far + 1.0) / Math.LN2); // TODO: Far from pick project matrix?
76639
76758
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
76640
76759
  }
76760
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
76641
76761
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
76642
- if (numSectionPlanes > 0) {
76762
+ if (numAllocatedSectionPlanes > 0) {
76643
76763
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
76644
76764
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
76645
76765
  const renderFlags = model.renderFlags;
76646
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
76766
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
76647
76767
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
76648
76768
  if (sectionPlaneUniforms) {
76649
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
76650
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
76651
- if (active) {
76652
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
76653
- if (origin) {
76654
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$g);
76655
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
76656
- } else {
76657
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
76769
+ if (sectionPlaneIndex < numSectionPlanes) {
76770
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
76771
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
76772
+ if (active) {
76773
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
76774
+ if (origin) {
76775
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$g);
76776
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
76777
+ } else {
76778
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
76779
+ }
76780
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
76658
76781
  }
76659
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
76782
+ } else {
76783
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
76660
76784
  }
76661
76785
  }
76662
76786
  }
@@ -76664,8 +76788,8 @@ class TrianglesDataTexturePickMeshRenderer {
76664
76788
  if (state.numIndices8Bits > 0) {
76665
76789
  textureState.bindTriangleIndicesTextures(
76666
76790
  this._program,
76667
- this._uTexturePerPolygonIdPortionIds,
76668
- this._uTexturePerPolygonIdIndices,
76791
+ this._uTexturePerPolygonIdPortionIds,
76792
+ this._uTexturePerPolygonIdIndices,
76669
76793
  8 // 8 bits indices
76670
76794
  );
76671
76795
  gl.drawArrays(gl.TRIANGLES, 0, state.numIndices8Bits);
@@ -76673,8 +76797,8 @@ class TrianglesDataTexturePickMeshRenderer {
76673
76797
  if (state.numIndices16Bits > 0) {
76674
76798
  textureState.bindTriangleIndicesTextures(
76675
76799
  this._program,
76676
- this._uTexturePerPolygonIdPortionIds,
76677
- this._uTexturePerPolygonIdIndices,
76800
+ this._uTexturePerPolygonIdPortionIds,
76801
+ this._uTexturePerPolygonIdIndices,
76678
76802
  16 // 16 bits indices
76679
76803
  );
76680
76804
  gl.drawArrays(gl.TRIANGLES, 0, state.numIndices16Bits);
@@ -76682,8 +76806,8 @@ class TrianglesDataTexturePickMeshRenderer {
76682
76806
  if (state.numIndices32Bits > 0) {
76683
76807
  textureState.bindTriangleIndicesTextures(
76684
76808
  this._program,
76685
- this._uTexturePerPolygonIdPortionIds,
76686
- this._uTexturePerPolygonIdIndices,
76809
+ this._uTexturePerPolygonIdPortionIds,
76810
+ this._uTexturePerPolygonIdIndices,
76687
76811
  32 // 32 bits indices
76688
76812
  );
76689
76813
  gl.drawArrays(gl.TRIANGLES, 0, state.numIndices32Bits);
@@ -76708,7 +76832,7 @@ class TrianglesDataTexturePickMeshRenderer {
76708
76832
  this._uViewMatrix = program.getLocation("viewMatrix");
76709
76833
  this._uProjMatrix = program.getLocation("projMatrix");
76710
76834
  this._uSectionPlanes = [];
76711
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
76835
+ for (let i = 0, len = scene.getMaxSectionPlanes(); i < len; i++) {
76712
76836
  this._uSectionPlanes.push({
76713
76837
  active: program.getLocation("sectionPlaneActive" + i),
76714
76838
  pos: program.getLocation("sectionPlanePos" + i),
@@ -76718,14 +76842,14 @@ class TrianglesDataTexturePickMeshRenderer {
76718
76842
  if (scene.logarithmicDepthBufferEnabled) {
76719
76843
  this._uLogDepthBufFC = program.getLocation("logDepthBufFC");
76720
76844
  }
76721
- this.uTexturePerObjectPositionsDecodeMatrix = "uObjectPerObjectPositionsDecodeMatrix";
76722
- this.uTexturePerObjectColorsAndFlags = "uObjectPerObjectColorsAndFlags";
76723
- this._uTexturePerVertexIdCoordinates = "uTexturePerVertexIdCoordinates";
76724
- this._uTexturePerPolygonIdNormals = "uTexturePerPolygonIdNormals";
76725
- this._uTexturePerPolygonIdIndices = "uTexturePerPolygonIdIndices";
76845
+ this.uTexturePerObjectPositionsDecodeMatrix = "uObjectPerObjectPositionsDecodeMatrix";
76846
+ this.uTexturePerObjectColorsAndFlags = "uObjectPerObjectColorsAndFlags";
76847
+ this._uTexturePerVertexIdCoordinates = "uTexturePerVertexIdCoordinates";
76848
+ this._uTexturePerPolygonIdNormals = "uTexturePerPolygonIdNormals";
76849
+ this._uTexturePerPolygonIdIndices = "uTexturePerPolygonIdIndices";
76726
76850
  this._uTexturePerPolygonIdPortionIds = "uTexturePerPolygonIdPortionIds";
76727
- this._uTexturePerObjectMatrix= "uTexturePerObjectMatrix";
76728
- this._uCameraEyeRtc = program.getLocation("uCameraEyeRtc");
76851
+ this._uTexturePerObjectMatrix = "uTexturePerObjectMatrix";
76852
+ this._uCameraEyeRtc = program.getLocation("uCameraEyeRtc");
76729
76853
  }
76730
76854
 
76731
76855
  _bindProgram(frameCtx) {
@@ -76744,7 +76868,7 @@ class TrianglesDataTexturePickMeshRenderer {
76744
76868
 
76745
76869
  _buildVertexShader() {
76746
76870
  const scene = this._scene;
76747
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
76871
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
76748
76872
  const src = [];
76749
76873
  src.push("#version 300 es");
76750
76874
  src.push("// Batched geometry picking vertex shader");
@@ -76779,10 +76903,10 @@ class TrianglesDataTexturePickMeshRenderer {
76779
76903
  src.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;");
76780
76904
  src.push("uniform highp sampler2D uTexturePerObjectMatrix;");
76781
76905
  src.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;");
76782
- src.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;");
76783
- src.push("uniform highp usampler2D uTexturePerPolygonIdIndices;");
76906
+ src.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;");
76907
+ src.push("uniform highp usampler2D uTexturePerPolygonIdIndices;");
76784
76908
  src.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;");
76785
- src.push("uniform vec3 uCameraEyeRtc;");
76909
+ src.push("uniform vec3 uCameraEyeRtc;");
76786
76910
 
76787
76911
  src.push("vec3 positions[3];");
76788
76912
 
@@ -76825,9 +76949,9 @@ class TrianglesDataTexturePickMeshRenderer {
76825
76949
  src.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);");
76826
76950
 
76827
76951
  // get flags & flags2
76828
- src.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);");
76829
- src.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);");
76830
-
76952
+ src.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);");
76953
+ src.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);");
76954
+
76831
76955
  // flags.w = NOT_RENDERED | PICK
76832
76956
  // renderPass = PICK
76833
76957
 
@@ -76837,9 +76961,9 @@ class TrianglesDataTexturePickMeshRenderer {
76837
76961
  src.push("} else {");
76838
76962
 
76839
76963
  // get vertex base
76840
- src.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));");
76964
+ src.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));");
76841
76965
 
76842
- src.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));");
76966
+ src.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));");
76843
76967
 
76844
76968
  src.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;");
76845
76969
 
@@ -76848,7 +76972,7 @@ class TrianglesDataTexturePickMeshRenderer {
76848
76972
 
76849
76973
  src.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));");
76850
76974
  src.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;");
76851
-
76975
+
76852
76976
  src.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;");
76853
76977
  src.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;");
76854
76978
 
@@ -76856,7 +76980,7 @@ class TrianglesDataTexturePickMeshRenderer {
76856
76980
 
76857
76981
  src.push("mat4 objectDecodeAndInstanceMatrix = objectInstanceMatrix * mat4 (texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uObjectPerObjectPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));");
76858
76982
 
76859
- src.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;");
76983
+ src.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;");
76860
76984
 
76861
76985
  // get position
76862
76986
  src.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));");
@@ -76864,7 +76988,7 @@ class TrianglesDataTexturePickMeshRenderer {
76864
76988
  src.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));");
76865
76989
 
76866
76990
  // get color
76867
- src.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);");
76991
+ src.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);");
76868
76992
 
76869
76993
  src.push(`if (color.a == 0u) {`);
76870
76994
  src.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"); // Cull vertex
@@ -76882,17 +77006,17 @@ class TrianglesDataTexturePickMeshRenderer {
76882
77006
 
76883
77007
  // when the geometry is not solid, if needed, flip the triangle winding
76884
77008
  src.push("if (solid != 1u) {");
76885
- src.push("if (isPerspectiveMatrix(projMatrix)) {");
76886
- src.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;");
76887
- src.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {");
76888
- src.push("position = positions[2 - (gl_VertexID % 3)];");
76889
- src.push("}");
76890
- src.push("} else {");
76891
- src.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);");
76892
- src.push("if (viewNormal.z < 0.0) {");
76893
- src.push("position = positions[2 - (gl_VertexID % 3)];");
76894
- src.push("}");
76895
- src.push("}");
77009
+ src.push("if (isPerspectiveMatrix(projMatrix)) {");
77010
+ src.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;");
77011
+ src.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {");
77012
+ src.push("position = positions[2 - (gl_VertexID % 3)];");
77013
+ src.push("}");
77014
+ src.push("} else {");
77015
+ src.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);");
77016
+ src.push("if (viewNormal.z < 0.0) {");
77017
+ src.push("position = positions[2 - (gl_VertexID % 3)];");
77018
+ src.push("}");
77019
+ src.push("}");
76896
77020
  src.push("}");
76897
77021
 
76898
77022
  src.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); ");
@@ -76916,10 +77040,9 @@ class TrianglesDataTexturePickMeshRenderer {
76916
77040
 
76917
77041
  _buildFragmentShader() {
76918
77042
  const scene = this._scene;
76919
- const sectionPlanesState = scene._sectionPlanesState;
76920
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
77043
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
76921
77044
  const src = [];
76922
- src.push ('#version 300 es');
77045
+ src.push('#version 300 es');
76923
77046
  src.push("// Batched geometry picking fragment shader");
76924
77047
  src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");
76925
77048
  src.push("precision highp float;");
@@ -76936,7 +77059,7 @@ class TrianglesDataTexturePickMeshRenderer {
76936
77059
  if (clipping) {
76937
77060
  src.push("in vec4 vWorldPosition;");
76938
77061
  src.push("flat in uvec4 vFlags2;");
76939
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
77062
+ for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
76940
77063
  src.push("uniform bool sectionPlaneActive" + i + ";");
76941
77064
  src.push("uniform vec3 sectionPlanePos" + i + ";");
76942
77065
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -76949,7 +77072,7 @@ class TrianglesDataTexturePickMeshRenderer {
76949
77072
  src.push(" bool clippable = (float(vFlags2.x) > 0.0);");
76950
77073
  src.push(" if (clippable) {");
76951
77074
  src.push(" float dist = 0.0;");
76952
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
77075
+ for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
76953
77076
  src.push(" if (sectionPlaneActive" + i + ") {");
76954
77077
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
76955
77078
  src.push(" }");
@@ -76958,7 +77081,7 @@ class TrianglesDataTexturePickMeshRenderer {
76958
77081
  src.push(" }");
76959
77082
  }
76960
77083
  if (scene.logarithmicDepthBufferEnabled) {
76961
- src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");
77084
+ src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");
76962
77085
  //src.push(" gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;");
76963
77086
  }
76964
77087
  src.push(" outPickColor = vPickColor; ");
@@ -76981,7 +77104,7 @@ class TrianglesDataTexturePickMeshRenderer {
76981
77104
  const tempVec3a$f = math.vec3();
76982
77105
  const tempVec3b$b = math.vec3();
76983
77106
  const tempVec3c$a = math.vec3();
76984
- const tempVec3d$7 = math.vec3();
77107
+ math.vec3();
76985
77108
  const tempMat4a$7 = math.mat4();
76986
77109
 
76987
77110
  /**
@@ -77082,25 +77205,30 @@ class TrianglesDataTexturePickDepthRenderer {
77082
77205
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
77083
77206
  }
77084
77207
 
77208
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
77085
77209
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
77086
- if (numSectionPlanes > 0) {
77210
+ if (numAllocatedSectionPlanes > 0) {
77087
77211
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
77088
77212
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
77089
77213
  const renderFlags = model.renderFlags;
77090
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
77214
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
77091
77215
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
77092
77216
  if (sectionPlaneUniforms) {
77093
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
77094
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
77095
- if (active) {
77096
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
77097
- if (origin) {
77098
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3d$7);
77099
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
77100
- } else {
77101
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
77217
+ if (sectionPlaneIndex < numSectionPlanes) {
77218
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
77219
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
77220
+ if (active) {
77221
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
77222
+ if (origin) {
77223
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$f);
77224
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
77225
+ } else {
77226
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
77227
+ }
77228
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
77102
77229
  }
77103
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
77230
+ } else {
77231
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
77104
77232
  }
77105
77233
  }
77106
77234
  }
@@ -77152,7 +77280,7 @@ class TrianglesDataTexturePickDepthRenderer {
77152
77280
  this._uViewMatrix = program.getLocation("viewMatrix");
77153
77281
  this._uProjMatrix = program.getLocation("projMatrix");
77154
77282
  this._uSectionPlanes = [];
77155
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
77283
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
77156
77284
  this._uSectionPlanes.push({
77157
77285
  active: program.getLocation("sectionPlaneActive" + i),
77158
77286
  pos: program.getLocation("sectionPlanePos" + i),
@@ -77188,7 +77316,7 @@ class TrianglesDataTexturePickDepthRenderer {
77188
77316
  _buildVertexShader() {
77189
77317
 
77190
77318
  const scene = this._scene;
77191
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
77319
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
77192
77320
  const src = [];
77193
77321
  src.push("#version 300 es");
77194
77322
  src.push("// Triangles dataTexture pick depth vertex shader");
@@ -77356,8 +77484,7 @@ class TrianglesDataTexturePickDepthRenderer {
77356
77484
  _buildFragmentShader() {
77357
77485
 
77358
77486
  const scene = this._scene;
77359
- const sectionPlanesState = scene._sectionPlanesState;
77360
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
77487
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
77361
77488
  const src = [];
77362
77489
  src.push('#version 300 es');
77363
77490
  src.push("// Triangles dataTexture pick depth fragment shader");
@@ -77382,7 +77509,7 @@ class TrianglesDataTexturePickDepthRenderer {
77382
77509
  if (clipping) {
77383
77510
  src.push("in vec4 vWorldPosition;");
77384
77511
  src.push("flat in uint vFlags2;");
77385
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
77512
+ for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
77386
77513
  src.push("uniform bool sectionPlaneActive" + i + ";");
77387
77514
  src.push("uniform vec3 sectionPlanePos" + i + ";");
77388
77515
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -77403,7 +77530,7 @@ class TrianglesDataTexturePickDepthRenderer {
77403
77530
  src.push(" bool clippable = vFlags2 > 0u;");
77404
77531
  src.push(" if (clippable) {");
77405
77532
  src.push(" float dist = 0.0;");
77406
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
77533
+ for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
77407
77534
  src.push(" if (sectionPlaneActive" + i + ") {");
77408
77535
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
77409
77536
  src.push(" }");
@@ -77435,8 +77562,8 @@ class TrianglesDataTexturePickDepthRenderer {
77435
77562
  const tempVec3a$e = math.vec3();
77436
77563
  const tempVec3b$a = math.vec3();
77437
77564
  const tempVec3c$9 = math.vec3();
77438
- const tempVec3d$6 = math.vec3();
77439
- const tempVec3e$1 = math.vec3();
77565
+ const tempVec3d$2 = math.vec3();
77566
+ math.vec3();
77440
77567
  const tempMat4a$6 = math.mat4();
77441
77568
 
77442
77569
  /**
@@ -77521,7 +77648,7 @@ class TrianglesDataTextureSnapDepthRenderer {
77521
77648
  rtcOrigin[1] += position[1];
77522
77649
  rtcOrigin[2] += position[2];
77523
77650
  rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a$6);
77524
- rtcCameraEye = tempVec3d$6;
77651
+ rtcCameraEye = tempVec3d$2;
77525
77652
  rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];
77526
77653
  rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];
77527
77654
  rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];
@@ -77550,25 +77677,30 @@ class TrianglesDataTextureSnapDepthRenderer {
77550
77677
  const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2);
77551
77678
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
77552
77679
  }
77680
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
77553
77681
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
77554
- if (numSectionPlanes > 0) {
77682
+ if (numAllocatedSectionPlanes > 0) {
77555
77683
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
77556
77684
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
77557
77685
  const renderFlags = model.renderFlags;
77558
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
77686
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
77559
77687
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
77560
77688
  if (sectionPlaneUniforms) {
77561
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
77562
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
77563
- if (active) {
77564
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
77565
- if (origin) {
77566
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3e$1);
77567
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
77568
- } else {
77569
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
77689
+ if (sectionPlaneIndex < numSectionPlanes) {
77690
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
77691
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
77692
+ if (active) {
77693
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
77694
+ if (origin) {
77695
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$e);
77696
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
77697
+ } else {
77698
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
77699
+ }
77700
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
77570
77701
  }
77571
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
77702
+ } else {
77703
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
77572
77704
  }
77573
77705
  }
77574
77706
  }
@@ -77619,7 +77751,7 @@ class TrianglesDataTextureSnapDepthRenderer {
77619
77751
  this._uViewMatrix = program.getLocation("viewMatrix");
77620
77752
  this._uProjMatrix = program.getLocation("projMatrix");
77621
77753
  this._uSectionPlanes = [];
77622
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
77754
+ for (let i = 0, len = scene.getMaxSectionPlanes(); i < len; i++) {
77623
77755
  this._uSectionPlanes.push({
77624
77756
  active: program.getLocation("sectionPlaneActive" + i),
77625
77757
  pos: program.getLocation("sectionPlanePos" + i),
@@ -77656,8 +77788,7 @@ class TrianglesDataTextureSnapDepthRenderer {
77656
77788
 
77657
77789
  _buildVertexShader() {
77658
77790
  const scene = this._scene;
77659
- const sectionPlanesState = scene._sectionPlanesState;
77660
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
77791
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
77661
77792
  const src = [];
77662
77793
  src.push("#version 300 es");
77663
77794
  src.push("// Batched geometry edges drawing vertex shader");
@@ -77788,8 +77919,7 @@ class TrianglesDataTextureSnapDepthRenderer {
77788
77919
  _buildFragmentShader() {
77789
77920
 
77790
77921
  const scene = this._scene;
77791
- const sectionPlanesState = scene._sectionPlanesState;
77792
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
77922
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
77793
77923
  const src = [];
77794
77924
  src.push('#version 300 es');
77795
77925
  src.push("// Triangles dataTexture pick depth fragment shader");
@@ -77810,7 +77940,7 @@ class TrianglesDataTextureSnapDepthRenderer {
77810
77940
  if (clipping) {
77811
77941
  src.push("in vec4 vWorldPosition;");
77812
77942
  src.push("flat in uint vFlags2;");
77813
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
77943
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
77814
77944
  src.push("uniform bool sectionPlaneActive" + i + ";");
77815
77945
  src.push("uniform vec3 sectionPlanePos" + i + ";");
77816
77946
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -77823,7 +77953,7 @@ class TrianglesDataTextureSnapDepthRenderer {
77823
77953
  src.push(" bool clippable = vFlags2 > 0u;");
77824
77954
  src.push(" if (clippable) {");
77825
77955
  src.push(" float dist = 0.0;");
77826
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
77956
+ for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
77827
77957
  src.push(" if (sectionPlaneActive" + i + ") {");
77828
77958
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
77829
77959
  src.push(" }");
@@ -77854,8 +77984,8 @@ class TrianglesDataTextureSnapDepthRenderer {
77854
77984
  const tempVec3a$d = math.vec3();
77855
77985
  const tempVec3b$9 = math.vec3();
77856
77986
  const tempVec3c$8 = math.vec3();
77857
- const tempVec3d$5 = math.vec3();
77858
- const tempVec3e = math.vec3();
77987
+ const tempVec3d$1 = math.vec3();
77988
+ math.vec3();
77859
77989
  const tempMat4a$5 = math.mat4();
77860
77990
  /**
77861
77991
  * @private
@@ -77935,7 +78065,7 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
77935
78065
  rtcOrigin[1] += position[1];
77936
78066
  rtcOrigin[2] += position[2];
77937
78067
  rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a$5);
77938
- rtcCameraEye = tempVec3d$5;
78068
+ rtcCameraEye = tempVec3d$1;
77939
78069
  rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];
77940
78070
  rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];
77941
78071
  rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];
@@ -77964,25 +78094,30 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
77964
78094
  const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2);
77965
78095
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
77966
78096
  }
78097
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
77967
78098
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
77968
- if (numSectionPlanes > 0) {
78099
+ if (numAllocatedSectionPlanes > 0) {
77969
78100
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
77970
78101
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
77971
78102
  const renderFlags = model.renderFlags;
77972
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
78103
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
77973
78104
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
77974
78105
  if (sectionPlaneUniforms) {
77975
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
77976
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
77977
- if (active) {
77978
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
77979
- if (origin) {
77980
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3e);
77981
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
77982
- } else {
77983
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
78106
+ if (sectionPlaneIndex < numSectionPlanes) {
78107
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
78108
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
78109
+ if (active) {
78110
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
78111
+ if (origin) {
78112
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$d);
78113
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
78114
+ } else {
78115
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
78116
+ }
78117
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
77984
78118
  }
77985
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
78119
+ } else {
78120
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
77986
78121
  }
77987
78122
  }
77988
78123
  }
@@ -78032,7 +78167,7 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
78032
78167
  this._uViewMatrix = program.getLocation("viewMatrix");
78033
78168
  this._uProjMatrix = program.getLocation("projMatrix");
78034
78169
  this._uSectionPlanes = [];
78035
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
78170
+ for (let i = 0, len = scene.getMaxSectionPlanes(); i < len; i++) {
78036
78171
  this._uSectionPlanes.push({
78037
78172
  active: program.getLocation("sectionPlaneActive" + i),
78038
78173
  pos: program.getLocation("sectionPlanePos" + i),
@@ -78068,8 +78203,7 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
78068
78203
 
78069
78204
  _buildVertexShader() {
78070
78205
  const scene = this._scene;
78071
- const sectionPlanesState = scene._sectionPlanesState;
78072
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
78206
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
78073
78207
  const src = [];
78074
78208
  src.push("#version 300 es");
78075
78209
  src.push("// TrianglesDataTextureSnapDepthBufInitRenderer vertex shader");
@@ -78231,8 +78365,7 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
78231
78365
 
78232
78366
  _buildFragmentShader() {
78233
78367
  const scene = this._scene;
78234
- const sectionPlanesState = scene._sectionPlanesState;
78235
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
78368
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
78236
78369
  const src = [];
78237
78370
  src.push('#version 300 es');
78238
78371
  src.push("// TrianglesDataTextureSnapDepthBufInitRenderer fragment shader");
@@ -78254,7 +78387,7 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
78254
78387
  src.push("flat in vec4 vPickColor;");
78255
78388
  if (clipping) {
78256
78389
  src.push("flat in uint vFlags2;");
78257
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
78390
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
78258
78391
  src.push("uniform bool sectionPlaneActive" + i + ";");
78259
78392
  src.push("uniform vec3 sectionPlanePos" + i + ";");
78260
78393
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -78269,7 +78402,7 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
78269
78402
  src.push(" bool clippable = vFlags2 > 0u;");
78270
78403
  src.push(" if (clippable) {");
78271
78404
  src.push(" float dist = 0.0;");
78272
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
78405
+ for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
78273
78406
  src.push(" if (sectionPlaneActive" + i + ") {");
78274
78407
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
78275
78408
  src.push(" }");
@@ -78309,7 +78442,7 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
78309
78442
  const tempVec3a$c = math.vec3();
78310
78443
  const tempVec3b$8 = math.vec3();
78311
78444
  const tempVec3c$7 = math.vec3();
78312
- const tempVec3d$4 = math.vec3();
78445
+ math.vec3();
78313
78446
  const tempMat4a$4 = math.mat4();
78314
78447
 
78315
78448
  /**
@@ -78399,25 +78532,30 @@ class TrianglesDataTextureOcclusionRenderer {
78399
78532
 
78400
78533
  gl.uniformMatrix4fv(this._uProjMatrix, false, camera.projMatrix);
78401
78534
 
78535
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
78402
78536
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
78403
- if (numSectionPlanes > 0) {
78537
+ if (numAllocatedSectionPlanes > 0) {
78404
78538
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
78405
78539
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
78406
78540
  const renderFlags = model.renderFlags;
78407
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
78541
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
78408
78542
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
78409
78543
  if (sectionPlaneUniforms) {
78410
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
78411
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
78412
- if (active) {
78413
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
78414
- if (origin) {
78415
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3d$4);
78416
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
78417
- } else {
78418
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
78544
+ if (sectionPlaneIndex < numSectionPlanes) {
78545
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
78546
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
78547
+ if (active) {
78548
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
78549
+ if (origin) {
78550
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$c);
78551
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
78552
+ } else {
78553
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
78554
+ }
78555
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
78419
78556
  }
78420
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
78557
+ } else {
78558
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
78421
78559
  }
78422
78560
  }
78423
78561
  }
@@ -78468,7 +78606,7 @@ class TrianglesDataTextureOcclusionRenderer {
78468
78606
  this._uViewMatrix = program.getLocation("viewMatrix");
78469
78607
  this._uProjMatrix = program.getLocation("projMatrix");
78470
78608
  this._uSectionPlanes = [];
78471
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
78609
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
78472
78610
  this._uSectionPlanes.push({
78473
78611
  active: program.getLocation("sectionPlaneActive" + i),
78474
78612
  pos: program.getLocation("sectionPlanePos" + i),
@@ -78508,7 +78646,7 @@ class TrianglesDataTextureOcclusionRenderer {
78508
78646
 
78509
78647
  _buildVertexShader() {
78510
78648
  const scene = this._scene;
78511
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
78649
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
78512
78650
  const src = [];
78513
78651
  src.push("#version 300 es");
78514
78652
  src.push("// TrianglesDataTextureOcclusionRenderer vertex shader");
@@ -78649,7 +78787,7 @@ class TrianglesDataTextureOcclusionRenderer {
78649
78787
  _buildFragmentShader() {
78650
78788
  const scene = this._scene;
78651
78789
  const sectionPlanesState = scene._sectionPlanesState;
78652
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
78790
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
78653
78791
  const src = [];
78654
78792
  src.push('#version 300 es');
78655
78793
  src.push("// TrianglesDataTextureColorRenderer fragment shader");
@@ -78663,7 +78801,7 @@ class TrianglesDataTextureOcclusionRenderer {
78663
78801
  if (clipping) {
78664
78802
  src.push("in vec4 vWorldPosition;");
78665
78803
  src.push("flat in uint vFlags2;");
78666
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
78804
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
78667
78805
  src.push("uniform bool sectionPlaneActive" + i + ";");
78668
78806
  src.push("uniform vec3 sectionPlanePos" + i + ";");
78669
78807
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -78675,7 +78813,7 @@ class TrianglesDataTextureOcclusionRenderer {
78675
78813
  src.push(" bool clippable = (float(vFlags2) > 0.0);");
78676
78814
  src.push(" if (clippable) {");
78677
78815
  src.push(" float dist = 0.0;");
78678
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
78816
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
78679
78817
  src.push(" if (sectionPlaneActive" + i + ") {");
78680
78818
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
78681
78819
  src.push(" }");
@@ -78703,7 +78841,7 @@ class TrianglesDataTextureOcclusionRenderer {
78703
78841
  const tempVec3a$b = math.vec3();
78704
78842
  const tempVec3b$7 = math.vec3();
78705
78843
  const tempVec3c$6 = math.vec3();
78706
- const tempVec3d$3 = math.vec3();
78844
+ math.vec3();
78707
78845
  const tempMat4a$3 = math.mat4();
78708
78846
 
78709
78847
  /**
@@ -78797,25 +78935,30 @@ class TrianglesDataTextureDepthRenderer {
78797
78935
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
78798
78936
  }
78799
78937
 
78938
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
78800
78939
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
78801
- if (numSectionPlanes > 0) {
78940
+ if (numAllocatedSectionPlanes > 0) {
78802
78941
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
78803
78942
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
78804
78943
  const renderFlags = model.renderFlags;
78805
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
78944
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
78806
78945
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
78807
78946
  if (sectionPlaneUniforms) {
78808
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
78809
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
78810
- if (active) {
78811
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
78812
- if (origin) {
78813
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3d$3);
78814
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
78815
- } else {
78816
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
78947
+ if (sectionPlaneIndex < numSectionPlanes) {
78948
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
78949
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
78950
+ if (active) {
78951
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
78952
+ if (origin) {
78953
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$b);
78954
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
78955
+ } else {
78956
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
78957
+ }
78958
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
78817
78959
  }
78818
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
78960
+ } else {
78961
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
78819
78962
  }
78820
78963
  }
78821
78964
  }
@@ -78878,7 +79021,7 @@ class TrianglesDataTextureDepthRenderer {
78878
79021
  this._uProjMatrix = program.getLocation("projMatrix");
78879
79022
  this._uSectionPlanes = [];
78880
79023
 
78881
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
79024
+ for (let i = 0, len = scene.getMaxSectionPlanes(); i < len; i++) {
78882
79025
  this._uSectionPlanes.push({
78883
79026
  active: program.getLocation("sectionPlaneActive" + i),
78884
79027
  pos: program.getLocation("sectionPlanePos" + i),
@@ -78926,9 +79069,7 @@ class TrianglesDataTextureDepthRenderer {
78926
79069
 
78927
79070
  _buildVertexShader() {
78928
79071
  const scene = this._scene;
78929
- const sectionPlanesState = scene._sectionPlanesState;
78930
- scene._lightsState;
78931
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
79072
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
78932
79073
  const src = [];
78933
79074
  src.push("#version 300 es");
78934
79075
  src.push("// Triangles dataTexture draw vertex shader");
@@ -79089,8 +79230,7 @@ class TrianglesDataTextureDepthRenderer {
79089
79230
 
79090
79231
  _buildFragmentShader() {
79091
79232
  const scene = this._scene;
79092
- const sectionPlanesState = scene._sectionPlanesState;
79093
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
79233
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
79094
79234
  const src = [];
79095
79235
  src.push('#version 300 es');
79096
79236
  src.push("// Triangles dataTexture draw fragment shader");
@@ -79113,7 +79253,7 @@ class TrianglesDataTextureDepthRenderer {
79113
79253
  if (clipping) {
79114
79254
  src.push("in vec4 vWorldPosition;");
79115
79255
  src.push("flat in uint vFlags2;");
79116
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
79256
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
79117
79257
  src.push("uniform bool sectionPlaneActive" + i + ";");
79118
79258
  src.push("uniform vec3 sectionPlanePos" + i + ";");
79119
79259
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -79125,7 +79265,7 @@ class TrianglesDataTextureDepthRenderer {
79125
79265
  src.push(" bool clippable = vFlags2 > 0u;");
79126
79266
  src.push(" if (clippable) {");
79127
79267
  src.push(" float dist = 0.0;");
79128
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
79268
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
79129
79269
  src.push("if (sectionPlaneActive" + i + ") {");
79130
79270
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
79131
79271
  src.push("}");
@@ -79161,7 +79301,7 @@ class TrianglesDataTextureDepthRenderer {
79161
79301
  const tempVec3a$a = math.vec3();
79162
79302
  const tempVec3b$6 = math.vec3();
79163
79303
  const tempVec3c$5 = math.vec3();
79164
- const tempVec3d$2 = math.vec3();
79304
+ math.vec3();
79165
79305
  const tempMat4a$2 = math.mat4();
79166
79306
 
79167
79307
  /**
@@ -79246,25 +79386,30 @@ class TrianglesDataTextureNormalsRenderer {
79246
79386
  gl.uniformMatrix4fv(this._uViewNormalMatrix, false, camera.viewNormalMatrix);
79247
79387
  gl.uniformMatrix4fv(this._uWorldNormalMatrix, false, model.worldNormalMatrix);
79248
79388
 
79389
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
79249
79390
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
79250
- if (numSectionPlanes > 0) {
79391
+ if (numAllocatedSectionPlanes > 0) {
79251
79392
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
79252
79393
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
79253
79394
  const renderFlags = model.renderFlags;
79254
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
79395
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
79255
79396
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
79256
79397
  if (sectionPlaneUniforms) {
79257
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
79258
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
79259
- if (active) {
79260
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
79261
- if (origin) {
79262
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3d$2);
79263
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
79264
- } else {
79265
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
79398
+ if (sectionPlaneIndex < numSectionPlanes) {
79399
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
79400
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
79401
+ if (active) {
79402
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
79403
+ if (origin) {
79404
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$a);
79405
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
79406
+ } else {
79407
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
79408
+ }
79409
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
79266
79410
  }
79267
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
79411
+ } else {
79412
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
79268
79413
  }
79269
79414
  }
79270
79415
  }
@@ -79302,7 +79447,7 @@ class TrianglesDataTextureNormalsRenderer {
79302
79447
  this._uViewNormalMatrix = program.getLocation("viewNormalMatrix");
79303
79448
  this._uProjMatrix = program.getLocation("projMatrix");
79304
79449
  this._uSectionPlanes = [];
79305
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
79450
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
79306
79451
  this._uSectionPlanes.push({
79307
79452
  active: program.getLocation("sectionPlaneActive" + i),
79308
79453
  pos: program.getLocation("sectionPlanePos" + i),
@@ -79343,7 +79488,7 @@ class TrianglesDataTextureNormalsRenderer {
79343
79488
 
79344
79489
  _buildVertexShader() {
79345
79490
  const scene = this._scene;
79346
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
79491
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
79347
79492
  const src = [];
79348
79493
  src.push("// Batched geometry normals vertex shader");
79349
79494
  if (scene.logarithmicDepthBufferEnabled && WEBGL_INFO.SUPPORTED_EXTENSIONS["EXT_frag_depth"]) {
@@ -79425,8 +79570,7 @@ class TrianglesDataTextureNormalsRenderer {
79425
79570
 
79426
79571
  _buildFragmentShader() {
79427
79572
  const scene = this._scene;
79428
- const sectionPlanesState = scene._sectionPlanesState;
79429
- const clipping = (sectionPlanesState.sectionPlanes.length > 0);
79573
+ const clipping = (scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0);
79430
79574
  const src = [];
79431
79575
  src.push("#version 300 es");
79432
79576
  src.push("// Batched geometry normals fragment shader");
@@ -79452,7 +79596,7 @@ class TrianglesDataTextureNormalsRenderer {
79452
79596
  if (clipping) {
79453
79597
  src.push("in vec4 vWorldPosition;");
79454
79598
  src.push("in vec4 vFlags2;");
79455
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
79599
+ for (let i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
79456
79600
  src.push("uniform bool sectionPlaneActive" + i + ";");
79457
79601
  src.push("uniform vec3 sectionPlanePos" + i + ";");
79458
79602
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -79467,7 +79611,7 @@ class TrianglesDataTextureNormalsRenderer {
79467
79611
  src.push(" bool clippable = (float(vFlags2.x) > 0.0);");
79468
79612
  src.push(" if (clippable) {");
79469
79613
  src.push(" float dist = 0.0;");
79470
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
79614
+ for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
79471
79615
  src.push(" if (sectionPlaneActive" + i + ") {");
79472
79616
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
79473
79617
  src.push(" }");
@@ -79498,7 +79642,7 @@ class TrianglesDataTextureNormalsRenderer {
79498
79642
  const tempVec3a$9 = math.vec3();
79499
79643
  const tempVec3b$5 = math.vec3();
79500
79644
  const tempVec3c$4 = math.vec3();
79501
- const tempVec3d$1 = math.vec3();
79645
+ math.vec3();
79502
79646
 
79503
79647
  math.vec4();
79504
79648
 
@@ -79596,25 +79740,30 @@ class TrianglesDataTexturePickNormalsFlatRenderer {
79596
79740
  const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2);
79597
79741
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
79598
79742
  }
79743
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
79599
79744
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
79600
- if (numSectionPlanes > 0) {
79745
+ if (numAllocatedSectionPlanes > 0) {
79601
79746
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
79602
79747
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
79603
79748
  const renderFlags = model.renderFlags;
79604
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
79749
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
79605
79750
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
79606
79751
  if (sectionPlaneUniforms) {
79607
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
79608
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
79609
- if (active) {
79610
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
79611
- if (origin) {
79612
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3d$1);
79613
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
79614
- } else {
79615
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
79752
+ if (sectionPlaneIndex < numSectionPlanes) {
79753
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
79754
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
79755
+ if (active) {
79756
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
79757
+ if (origin) {
79758
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$9);
79759
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
79760
+ } else {
79761
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
79762
+ }
79763
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
79616
79764
  }
79617
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
79765
+ } else {
79766
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
79618
79767
  }
79619
79768
  }
79620
79769
  }
@@ -79670,7 +79819,7 @@ class TrianglesDataTexturePickNormalsFlatRenderer {
79670
79819
  this._uViewMatrix = program.getLocation("viewMatrix");
79671
79820
  this._uProjMatrix = program.getLocation("projMatrix");
79672
79821
  this._uSectionPlanes = [];
79673
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
79822
+ for (let i = 0, len = scene.getMaxSectionPlanes(); i < len; i++) {
79674
79823
  this._uSectionPlanes.push({
79675
79824
  active: program.getLocation("sectionPlaneActive" + i),
79676
79825
  pos: program.getLocation("sectionPlanePos" + i),
@@ -79711,9 +79860,7 @@ class TrianglesDataTexturePickNormalsFlatRenderer {
79711
79860
 
79712
79861
  _buildVertexShader() {
79713
79862
  const scene = this._scene;
79714
- const sectionPlanesState = scene._sectionPlanesState;
79715
- scene._lightsState;
79716
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
79863
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
79717
79864
  const src = [];
79718
79865
  src.push("#version 300 es");
79719
79866
  src.push("// trianglesDatatextureNormalsRenderer vertex shader");
@@ -79879,8 +80026,7 @@ class TrianglesDataTexturePickNormalsFlatRenderer {
79879
80026
 
79880
80027
  _buildFragmentShader() {
79881
80028
  const scene = this._scene;
79882
- const sectionPlanesState = scene._sectionPlanesState;
79883
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
80029
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
79884
80030
  const src = [];
79885
80031
  src.push('#version 300 es');
79886
80032
  src.push("// TrianglesDataTexturePickNormalsRenderer fragment shader");
@@ -79899,7 +80045,7 @@ class TrianglesDataTexturePickNormalsFlatRenderer {
79899
80045
  src.push("in vec4 vWorldPosition;");
79900
80046
  if (clipping) {
79901
80047
  src.push("flat in uint vFlags2;");
79902
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
80048
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
79903
80049
  src.push("uniform bool sectionPlaneActive" + i + ";");
79904
80050
  src.push("uniform vec3 sectionPlanePos" + i + ";");
79905
80051
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -79911,7 +80057,7 @@ class TrianglesDataTexturePickNormalsFlatRenderer {
79911
80057
  src.push(" bool clippable = vFlags2 > 0u;");
79912
80058
  src.push(" if (clippable) {");
79913
80059
  src.push(" float dist = 0.0;");
79914
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
80060
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
79915
80061
  src.push("if (sectionPlaneActive" + i + ") {");
79916
80062
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
79917
80063
  src.push("}");
@@ -100254,6 +100400,11 @@ class Viewer {
100254
100400
  * 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
100255
100401
  * 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)
100256
100402
  * mode for storing geometry, which is the standard technique used in most graphics engines, and will work adequately on most low-end GPUs.
100403
+ * @param {number} [cfg.numCachedSectionPlanes=0] Enhances the efficiency of SectionPlane creation by proactively allocating Viewer resources for a specified quantity
100404
+ * of SectionPlanes. Introducing this parameter streamlines the initial creation speed of SectionPlanes, particularly up to the designated quantity. This parameter internally
100405
+ * configures renderer logic for the specified number of SectionPlanes, eliminating the need for setting up logic with each SectionPlane creation and thereby enhancing
100406
+ * 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
100407
+ * your expected usage.
100257
100408
  */
100258
100409
  constructor(cfg) {
100259
100410
 
@@ -100311,7 +100462,8 @@ class Viewer {
100311
100462
  logarithmicDepthBufferEnabled: (!!cfg.logarithmicDepthBufferEnabled),
100312
100463
  pbrEnabled: (!!cfg.pbrEnabled),
100313
100464
  colorTextureEnabled: (cfg.colorTextureEnabled !== false),
100314
- dtxEnabled: (!!cfg.dtxEnabled)
100465
+ dtxEnabled: (!!cfg.dtxEnabled),
100466
+ numCachedSectionPlanes: cfg.numCachedSectionPlanes
100315
100467
  });
100316
100468
 
100317
100469
  /**