@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
@@ -21568,8 +21568,8 @@ class CustomProjection extends Component {
21568
21568
  const tempVec3$6 = math.vec3();
21569
21569
  const tempVec3b$q = math.vec3();
21570
21570
  const tempVec3c$n = math.vec3();
21571
- const tempVec3d$h = math.vec3();
21572
- const tempVec3e$4 = math.vec3();
21571
+ const tempVec3d$9 = math.vec3();
21572
+ const tempVec3e$2 = math.vec3();
21573
21573
  const tempVec3f$2 = math.vec3();
21574
21574
  const tempVec4a$d = math.vec4();
21575
21575
  const tempVec4b$c = math.vec4();
@@ -21881,7 +21881,7 @@ class Camera extends Component {
21881
21881
  math.rotationMat4v(angleInc * 0.0174532925, this._gimbalLock ? this._worldUp : this._up, tempMat);
21882
21882
  lookEyeVec = math.transformPoint3(tempMat, lookEyeVec, tempVec3b$q);
21883
21883
  this.eye = math.addVec3(this._look, lookEyeVec, tempVec3c$n); // Set eye position as 'look' plus 'eye' vector
21884
- this.up = math.transformPoint3(tempMat, this._up, tempVec3d$h); // Rotate 'up' vector
21884
+ this.up = math.transformPoint3(tempMat, this._up, tempVec3d$9); // Rotate 'up' vector
21885
21885
  }
21886
21886
 
21887
21887
  /**
@@ -21899,8 +21899,8 @@ class Camera extends Component {
21899
21899
  let eye2 = math.subVec3(this._eye, this._look, tempVec3$6);
21900
21900
  const left = math.cross3Vec3(math.normalizeVec3(eye2, tempVec3b$q), math.normalizeVec3(this._up, tempVec3c$n));
21901
21901
  math.rotationMat4v(angleInc * 0.0174532925, left, tempMat);
21902
- eye2 = math.transformPoint3(tempMat, eye2, tempVec3d$h);
21903
- this.up = math.transformPoint3(tempMat, this._up, tempVec3e$4);
21902
+ eye2 = math.transformPoint3(tempMat, eye2, tempVec3d$9);
21903
+ this.up = math.transformPoint3(tempMat, this._up, tempVec3e$2);
21904
21904
  this.eye = math.addVec3(eye2, this._look, tempVec3f$2);
21905
21905
  }
21906
21906
 
@@ -21915,7 +21915,7 @@ class Camera extends Component {
21915
21915
  look2 = math.transformPoint3(tempMat, look2, tempVec3b$q);
21916
21916
  this.look = math.addVec3(look2, this._eye, tempVec3c$n);
21917
21917
  if (this._gimbalLock) {
21918
- this.up = math.transformPoint3(tempMat, this._up, tempVec3d$h);
21918
+ this.up = math.transformPoint3(tempMat, this._up, tempVec3d$9);
21919
21919
  }
21920
21920
  }
21921
21921
 
@@ -21935,8 +21935,8 @@ class Camera extends Component {
21935
21935
  const left = math.cross3Vec3(math.normalizeVec3(look2, tempVec3b$q), math.normalizeVec3(this._up, tempVec3c$n));
21936
21936
  math.rotationMat4v(angleInc * 0.0174532925, left, tempMat);
21937
21937
  this.up = math.transformPoint3(tempMat, this._up, tempVec3f$2);
21938
- look2 = math.transformPoint3(tempMat, look2, tempVec3d$h);
21939
- this.look = math.addVec3(look2, this._eye, tempVec3e$4);
21938
+ look2 = math.transformPoint3(tempMat, look2, tempVec3d$9);
21939
+ this.look = math.addVec3(look2, this._eye, tempVec3e$2);
21940
21940
  }
21941
21941
 
21942
21942
  /**
@@ -21962,12 +21962,12 @@ class Camera extends Component {
21962
21962
  vec[2] += v[2];
21963
21963
  }
21964
21964
  if (pan[2] !== 0) {
21965
- v = math.mulVec3Scalar(math.normalizeVec3(eye2, tempVec3d$h), pan[2]);
21965
+ v = math.mulVec3Scalar(math.normalizeVec3(eye2, tempVec3d$9), pan[2]);
21966
21966
  vec[0] += v[0];
21967
21967
  vec[1] += v[1];
21968
21968
  vec[2] += v[2];
21969
21969
  }
21970
- this.eye = math.addVec3(this._eye, vec, tempVec3e$4);
21970
+ this.eye = math.addVec3(this._eye, vec, tempVec3e$2);
21971
21971
  this.look = math.addVec3(this._look, vec, tempVec3f$2);
21972
21972
  }
21973
21973
 
@@ -21984,7 +21984,7 @@ class Camera extends Component {
21984
21984
  return;
21985
21985
  }
21986
21986
  const dir = math.normalizeVec3(vec, tempVec3c$n);
21987
- this.eye = math.addVec3(this._look, math.mulVec3Scalar(dir, newLenLook), tempVec3d$h);
21987
+ this.eye = math.addVec3(this._look, math.mulVec3Scalar(dir, newLenLook), tempVec3d$9);
21988
21988
  }
21989
21989
 
21990
21990
  /**
@@ -27963,8 +27963,13 @@ class Scene extends Component {
27963
27963
  * @param {Viewer} viewer The Viewer this Scene belongs to.
27964
27964
  * @param {Object} cfg Scene configuration.
27965
27965
  * @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.
27966
- * @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.
27966
+ * @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.
27967
27967
  * @param {HTMLElement} [cfg.keyboardEventsElement] Optional reference to HTML element on which key events should be handled. Defaults to the HTML Document.
27968
+ * @param {number} [cfg.numCachedSectionPlanes=0] Enhances the efficiency of SectionPlane creation by proactively allocating Viewer resources for a specified quantity
27969
+ * of SectionPlanes. Introducing this parameter streamlines the initial creation speed of SectionPlanes, particularly up to the designated quantity. This parameter internally
27970
+ * configures renderer logic for the specified number of SectionPlanes, eliminating the need for setting up logic with each SectionPlane creation and thereby enhancing
27971
+ * 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
27972
+ * your expected usage.
27968
27973
  * @throws {String} Throws an exception when both canvasId or canvasElement are missing or they aren't pointing to a valid HTMLCanvasElement.
27969
27974
  */
27970
27975
  constructor(viewer, cfg = {}) {
@@ -27987,6 +27992,8 @@ class Scene extends Component {
27987
27992
 
27988
27993
  this._aabbDirty = true;
27989
27994
 
27995
+ this._numCachedSectionPlanes = cfg.numCachedSectionPlanes || 0;
27996
+
27990
27997
  /**
27991
27998
  * The {@link Viewer} this Scene belongs to.
27992
27999
  * @type {Viewer}
@@ -28249,6 +28256,8 @@ class Scene extends Component {
28249
28256
  alphaDepthMask: alphaDepthMask
28250
28257
  });
28251
28258
 
28259
+ const numCachedSectionPlanes = this._numCachedSectionPlanes;
28260
+
28252
28261
  this._sectionPlanesState = new (function () {
28253
28262
 
28254
28263
  this.sectionPlanes = [];
@@ -28261,13 +28270,14 @@ class Scene extends Component {
28261
28270
  if (hash) {
28262
28271
  return hash;
28263
28272
  }
28264
- const sectionPlanes = this.sectionPlanes;
28265
- if (sectionPlanes.length === 0) {
28273
+ const numAllocatedSectionPlanes = this.getNumAllocatedSectionPlanes();
28274
+ this.sectionPlanes;
28275
+ if (numAllocatedSectionPlanes === 0) {
28266
28276
  return this.hash = ";";
28267
28277
  }
28268
28278
 
28269
28279
  const hashParts = [];
28270
- for (let i = 0, len = sectionPlanes.length; i < len; i++) {
28280
+ for (let i = 0, len = numAllocatedSectionPlanes; i < len; i++) {
28271
28281
  hashParts.push("cp");
28272
28282
  }
28273
28283
  hashParts.push(";");
@@ -28289,6 +28299,11 @@ class Scene extends Component {
28289
28299
  }
28290
28300
  }
28291
28301
  };
28302
+
28303
+ this.getNumAllocatedSectionPlanes = function () {
28304
+ const num = this.sectionPlanes.length;
28305
+ return (num > numCachedSectionPlanes) ? num : numCachedSectionPlanes;
28306
+ };
28292
28307
  })();
28293
28308
 
28294
28309
  this._lightsState = new (function () {
@@ -28823,12 +28838,43 @@ class Scene extends Component {
28823
28838
  return this._logarithmicDepthBufferEnabled;
28824
28839
  }
28825
28840
 
28841
+ /**
28842
+ * Sets the number of {@link SectionPlane}s for which this Scene pre-caches resources.
28843
+ *
28844
+ * This property enhances the efficiency of SectionPlane creation by proactively allocating and caching Viewer resources for a specified quantity
28845
+ * of SectionPlanes. Introducing this parameter streamlines the initial creation speed of SectionPlanes, particularly up to the designated quantity. This parameter internally
28846
+ * configures renderer logic for the specified number of SectionPlanes, eliminating the need for setting up logic with each SectionPlane creation and thereby enhancing
28847
+ * 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
28848
+ * your expected usage.
28849
+ *
28850
+ * Default is ````0````.
28851
+ */
28852
+ set numCachedSectionPlanes(numCachedSectionPlanes) {
28853
+ this._numCachedSectionPlanes = numCachedSectionPlanes;
28854
+ this._recompile();
28855
+ }
28856
+
28857
+ /**
28858
+ * Gets the number of {@link SectionPlane}s for which this Scene pre-caches resources.
28859
+ *
28860
+ * This property enhances the efficiency of SectionPlane creation by proactively allocating and caching Viewer resources for a specified quantity
28861
+ * of SectionPlanes. Introducing this parameter streamlines the initial creation speed of SectionPlanes, particularly up to the designated quantity. This parameter internally
28862
+ * configures renderer logic for the specified number of SectionPlanes, eliminating the need for setting up logic with each SectionPlane creation and thereby enhancing
28863
+ * 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
28864
+ * your expected usage.
28865
+ *
28866
+ * Default is ````0````.
28867
+ *
28868
+ * @returns {number} The number of {@link SectionPlane}s for which this Scene pre-caches resources.
28869
+ */
28870
+ get numCachedSectionPlanes() {
28871
+ return this._numCachedSectionPlanes;
28872
+ }
28873
+
28826
28874
  /**
28827
28875
  * Sets whether physically-based rendering is enabled.
28828
28876
  *
28829
28877
  * Default is ````false````.
28830
- *
28831
- * @returns {Boolean} True if quality rendering is enabled.
28832
28878
  */
28833
28879
  set pbrEnabled(pbrEnabled) {
28834
28880
  this._pbrEnabled = !!pbrEnabled;
@@ -30165,12 +30211,12 @@ class Scene extends Component {
30165
30211
 
30166
30212
  /**
30167
30213
  * This method will "tickify" the provided `cb` function.
30168
- *
30214
+ *
30169
30215
  * This means, the function will be wrapped so:
30170
- *
30216
+ *
30171
30217
  * - it runs time-aligned to scene ticks
30172
30218
  * - it runs maximum once per scene-tick
30173
- *
30219
+ *
30174
30220
  * @param {Function} cb The function to tickify
30175
30221
  * @returns {Function)}
30176
30222
  */
@@ -30191,7 +30237,7 @@ class Scene extends Component {
30191
30237
 
30192
30238
  /**
30193
30239
  * The provided `cb` function is replaced with a "set-dirty" function
30194
- *
30240
+ *
30195
30241
  * @type {Function}
30196
30242
  */
30197
30243
  const wrapperFunc = function (...args) {
@@ -30201,7 +30247,7 @@ class Scene extends Component {
30201
30247
 
30202
30248
  /**
30203
30249
  * An each scene tick, if the "dirty-flag" is set, run the `cb` function.
30204
- *
30250
+ *
30205
30251
  * This will make it run time-aligned to the scene tick.
30206
30252
  */
30207
30253
  const tickSubId = this.on("tick", () => {
@@ -30215,7 +30261,7 @@ class Scene extends Component {
30215
30261
  /**
30216
30262
  * And, store the list of subscribers.
30217
30263
  */
30218
- this._tickifiedFunctions[cbString] = { tickSubId, wrapperFunc };
30264
+ this._tickifiedFunctions[cbString] = {tickSubId, wrapperFunc};
30219
30265
 
30220
30266
  return wrapperFunc;
30221
30267
  }
@@ -30708,7 +30754,7 @@ function buildVertexLambert(mesh) {
30708
30754
  const geometryState = mesh._geometry._state;
30709
30755
  const billboard = mesh._state.billboard;
30710
30756
  const stationary = mesh._state.stationary;
30711
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
30757
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
30712
30758
  const quantizedGeometry = !!geometryState.compressGeometry;
30713
30759
 
30714
30760
  const src = [];
@@ -30885,7 +30931,7 @@ function buildFragmentLambert(mesh) {
30885
30931
  const sectionPlanesState = scene._sectionPlanesState;
30886
30932
  mesh._material._state;
30887
30933
  const geometryState = mesh._geometry._state;
30888
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
30934
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
30889
30935
  const gammaOutput = scene.gammaOutput; // If set, then it expects that all textures and colors need to be outputted in premultiplied gamma. Default is false.
30890
30936
  const src = [];
30891
30937
  src.push("#version 300 es");
@@ -30905,7 +30951,7 @@ function buildFragmentLambert(mesh) {
30905
30951
  if (clipping) {
30906
30952
  src.push("in vec4 vWorldPosition;");
30907
30953
  src.push("uniform bool clippable;");
30908
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
30954
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
30909
30955
  src.push("uniform bool sectionPlaneActive" + i + ";");
30910
30956
  src.push("uniform vec3 sectionPlanePos" + i + ";");
30911
30957
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -30923,7 +30969,7 @@ function buildFragmentLambert(mesh) {
30923
30969
  if (clipping) {
30924
30970
  src.push("if (clippable) {");
30925
30971
  src.push(" float dist = 0.0;");
30926
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
30972
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
30927
30973
  src.push("if (sectionPlaneActive" + i + ") {");
30928
30974
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
30929
30975
  src.push("}");
@@ -30964,7 +31010,7 @@ function buildVertexDraw(mesh) {
30964
31010
  const stationary = meshState.stationary;
30965
31011
  const texturing = hasTextures(mesh);
30966
31012
  const normals = hasNormals$1(mesh);
30967
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
31013
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
30968
31014
  const receivesShadow = getReceivesShadow(mesh);
30969
31015
  const quantizedGeometry = !!geometryState.compressGeometry;
30970
31016
  const src = [];
@@ -31186,7 +31232,7 @@ function buildFragmentDraw(mesh) {
31186
31232
  const sectionPlanesState = mesh.scene._sectionPlanesState;
31187
31233
  const lightsState = mesh.scene._lightsState;
31188
31234
  const materialState = mesh._material._state;
31189
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
31235
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
31190
31236
  const normals = hasNormals$1(mesh);
31191
31237
  const uvs = geometryState.uvBuf;
31192
31238
  const phongMaterial = (materialState.type === "PhongMaterial");
@@ -31247,7 +31293,7 @@ function buildFragmentDraw(mesh) {
31247
31293
  if (clipping) {
31248
31294
  src.push("in vec4 vWorldPosition;");
31249
31295
  src.push("uniform bool clippable;");
31250
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
31296
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
31251
31297
  src.push("uniform bool sectionPlaneActive" + i + ";");
31252
31298
  src.push("uniform vec3 sectionPlanePos" + i + ";");
31253
31299
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -31737,7 +31783,7 @@ function buildFragmentDraw(mesh) {
31737
31783
  if (clipping) {
31738
31784
  src.push("if (clippable) {");
31739
31785
  src.push(" float dist = 0.0;");
31740
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
31786
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
31741
31787
  src.push("if (sectionPlaneActive" + i + ") {");
31742
31788
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
31743
31789
  src.push("}");
@@ -32271,19 +32317,29 @@ DrawRenderer.prototype.drawMesh = function (frameCtx, mesh) {
32271
32317
  gl.uniformMatrix4fv(this._uViewNormalMatrix, false, camera.viewNormalMatrix);
32272
32318
 
32273
32319
  if (meshState.clippable) {
32320
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
32274
32321
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
32275
- if (numSectionPlanes > 0) {
32322
+ if (numAllocatedSectionPlanes > 0) {
32276
32323
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
32277
32324
  const renderFlags = mesh.renderFlags;
32278
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
32325
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
32279
32326
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
32280
32327
  if (sectionPlaneUniforms) {
32281
- const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];
32282
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
32283
- if (active) {
32284
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
32285
- gl.uniform3fv(sectionPlaneUniforms.pos, origin ? getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$A) : sectionPlane.pos);
32286
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
32328
+ if (sectionPlaneIndex < numSectionPlanes) {
32329
+ const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];
32330
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
32331
+ if (active) {
32332
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
32333
+ if (origin) {
32334
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$A);
32335
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
32336
+ } else {
32337
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
32338
+ }
32339
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
32340
+ }
32341
+ } else {
32342
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
32287
32343
  }
32288
32344
  }
32289
32345
  }
@@ -33348,7 +33404,7 @@ function buildFragment$5(mesh) {
33348
33404
  const scene = mesh.scene;
33349
33405
  const sectionPlanesState = mesh.scene._sectionPlanesState;
33350
33406
  const gammaOutput = mesh.scene.gammaOutput;
33351
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
33407
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
33352
33408
  const src = [];
33353
33409
  src.push("#version 300 es");
33354
33410
  src.push("// Lambertian drawing fragment shader");
@@ -33375,7 +33431,7 @@ function buildFragment$5(mesh) {
33375
33431
  if (clipping) {
33376
33432
  src.push("in vec4 vWorldPosition;");
33377
33433
  src.push("uniform bool clippable;");
33378
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
33434
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
33379
33435
  src.push("uniform bool sectionPlaneActive" + i + ";");
33380
33436
  src.push("uniform vec3 sectionPlanePos" + i + ";");
33381
33437
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -33387,7 +33443,7 @@ function buildFragment$5(mesh) {
33387
33443
  if (clipping) {
33388
33444
  src.push("if (clippable) {");
33389
33445
  src.push(" float dist = 0.0;");
33390
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
33446
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
33391
33447
  src.push("if (sectionPlaneActive" + i + ") {");
33392
33448
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
33393
33449
  src.push("}");
@@ -33493,19 +33549,29 @@ EmphasisFillRenderer.prototype.drawMesh = function (frameCtx, mesh, mode) {
33493
33549
  gl.uniformMatrix4fv(this._uViewNormalMatrix, false, camera.viewNormalMatrix);
33494
33550
 
33495
33551
  if (meshState.clippable) {
33552
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
33496
33553
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
33497
- if (numSectionPlanes > 0) {
33554
+ if (numAllocatedSectionPlanes > 0) {
33498
33555
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
33499
33556
  const renderFlags = mesh.renderFlags;
33500
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
33557
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
33501
33558
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
33502
33559
  if (sectionPlaneUniforms) {
33503
- const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];
33504
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
33505
- if (active) {
33506
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
33507
- gl.uniform3fv(sectionPlaneUniforms.pos, origin ? getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$z) : sectionPlane.pos);
33508
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
33560
+ if (sectionPlaneIndex < numSectionPlanes) {
33561
+ const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];
33562
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
33563
+ if (active) {
33564
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
33565
+ if (origin) {
33566
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$z);
33567
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
33568
+ } else {
33569
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
33570
+ }
33571
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
33572
+ }
33573
+ } else {
33574
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
33509
33575
  }
33510
33576
  }
33511
33577
  }
@@ -33614,7 +33680,7 @@ EmphasisFillRenderer.prototype._allocate = function (mesh) {
33614
33680
  }
33615
33681
  }
33616
33682
  this._uSectionPlanes = [];
33617
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
33683
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
33618
33684
  this._uSectionPlanes.push({
33619
33685
  active: program.getLocation("sectionPlaneActive" + i),
33620
33686
  pos: program.getLocation("sectionPlanePos" + i),
@@ -33777,7 +33843,7 @@ function buildFragment$4(mesh) {
33777
33843
  const scene = mesh.scene;
33778
33844
  const sectionPlanesState = mesh.scene._sectionPlanesState;
33779
33845
  const gammaOutput = mesh.scene.gammaOutput;
33780
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
33846
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
33781
33847
  const src = [];
33782
33848
  src.push("#version 300 es");
33783
33849
  src.push("// Edges drawing fragment shader");
@@ -33802,7 +33868,7 @@ function buildFragment$4(mesh) {
33802
33868
  if (clipping) {
33803
33869
  src.push("in vec4 vWorldPosition;");
33804
33870
  src.push("uniform bool clippable;");
33805
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
33871
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
33806
33872
  src.push("uniform bool sectionPlaneActive" + i + ";");
33807
33873
  src.push("uniform vec3 sectionPlanePos" + i + ";");
33808
33874
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -33814,7 +33880,7 @@ function buildFragment$4(mesh) {
33814
33880
  if (clipping) {
33815
33881
  src.push("if (clippable) {");
33816
33882
  src.push(" float dist = 0.0;");
33817
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
33883
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
33818
33884
  src.push("if (sectionPlaneActive" + i + ") {");
33819
33885
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
33820
33886
  src.push("}");
@@ -33912,19 +33978,29 @@ EmphasisEdgesRenderer.prototype.drawMesh = function (frameCtx, mesh, mode) {
33912
33978
  gl.uniformMatrix4fv(this._uViewMatrix, false, origin ? frameCtx.getRTCViewMatrix(meshState.originHash, origin) : camera.viewMatrix);
33913
33979
 
33914
33980
  if (meshState.clippable) {
33981
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
33915
33982
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
33916
- if (numSectionPlanes > 0) {
33983
+ if (numAllocatedSectionPlanes > 0) {
33917
33984
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
33918
33985
  const renderFlags = mesh.renderFlags;
33919
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
33986
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
33920
33987
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
33921
33988
  if (sectionPlaneUniforms) {
33922
- const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];
33923
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
33924
- if (active) {
33925
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
33926
- gl.uniform3fv(sectionPlaneUniforms.pos, origin ? getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$y) : sectionPlane.pos);
33927
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
33989
+ if (sectionPlaneIndex < numSectionPlanes) {
33990
+ const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];
33991
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
33992
+ if (active) {
33993
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
33994
+ if (origin) {
33995
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$y);
33996
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
33997
+ } else {
33998
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
33999
+ }
34000
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
34001
+ }
34002
+ } else {
34003
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
33928
34004
  }
33929
34005
  }
33930
34006
  }
@@ -34025,7 +34101,7 @@ EmphasisEdgesRenderer.prototype._allocate = function (mesh) {
34025
34101
  this._uViewMatrix = program.getLocation("viewMatrix");
34026
34102
  this._uProjMatrix = program.getLocation("projMatrix");
34027
34103
  this._uSectionPlanes = [];
34028
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
34104
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
34029
34105
  this._uSectionPlanes.push({
34030
34106
  active: program.getLocation("sectionPlaneActive" + i),
34031
34107
  pos: program.getLocation("sectionPlanePos" + i),
@@ -34177,7 +34253,7 @@ function buildVertex$3(mesh) {
34177
34253
  function buildFragment$3(mesh) {
34178
34254
  const scene = mesh.scene;
34179
34255
  const sectionPlanesState = scene._sectionPlanesState;
34180
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
34256
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
34181
34257
  const src = [];
34182
34258
  src.push('#version 300 es');
34183
34259
  src.push("// Mesh picking fragment shader");
@@ -34197,7 +34273,7 @@ function buildFragment$3(mesh) {
34197
34273
  if (clipping) {
34198
34274
  src.push("uniform bool clippable;");
34199
34275
  src.push("in vec4 vWorldPosition;");
34200
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
34276
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
34201
34277
  src.push("uniform bool sectionPlaneActive" + i + ";");
34202
34278
  src.push("uniform vec3 sectionPlanePos" + i + ";");
34203
34279
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -34208,7 +34284,7 @@ function buildFragment$3(mesh) {
34208
34284
  if (clipping) {
34209
34285
  src.push("if (clippable) {");
34210
34286
  src.push(" float dist = 0.0;");
34211
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
34287
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
34212
34288
  src.push("if (sectionPlaneActive" + i + ") {");
34213
34289
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
34214
34290
  src.push("}");
@@ -34301,19 +34377,29 @@ PickMeshRenderer.prototype.drawMesh = function (frameCtx, mesh) {
34301
34377
  gl.uniformMatrix4fv(this._uViewMatrix, false, origin ? frameCtx.getRTCPickViewMatrix(meshState.originHash, origin) : frameCtx.pickViewMatrix);
34302
34378
 
34303
34379
  if (meshState.clippable) {
34380
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
34304
34381
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
34305
- if (numSectionPlanes > 0) {
34382
+ if (numAllocatedSectionPlanes > 0) {
34306
34383
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
34307
34384
  const renderFlags = mesh.renderFlags;
34308
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
34385
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
34309
34386
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
34310
34387
  if (sectionPlaneUniforms) {
34311
- const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];
34312
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
34313
- if (active) {
34314
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
34315
- gl.uniform3fv(sectionPlaneUniforms.pos, origin ? getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$x) : sectionPlane.pos);
34316
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
34388
+ if (sectionPlaneIndex < numSectionPlanes) {
34389
+ const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];
34390
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
34391
+ if (active) {
34392
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
34393
+ if (origin) {
34394
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$x);
34395
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
34396
+ } else {
34397
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
34398
+ }
34399
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
34400
+ }
34401
+ } else {
34402
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
34317
34403
  }
34318
34404
  }
34319
34405
  }
@@ -34505,7 +34591,7 @@ function buildVertex$2(mesh) {
34505
34591
  function buildFragment$2(mesh) {
34506
34592
  const scene = mesh.scene;
34507
34593
  const sectionPlanesState = scene._sectionPlanesState;
34508
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
34594
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
34509
34595
  const src = [];
34510
34596
  src.push('#version 300 es');
34511
34597
  src.push("// Surface picking fragment shader");
@@ -34525,7 +34611,7 @@ function buildFragment$2(mesh) {
34525
34611
  if (clipping) {
34526
34612
  src.push("uniform bool clippable;");
34527
34613
  src.push("in vec4 vWorldPosition;");
34528
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
34614
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
34529
34615
  src.push("uniform bool sectionPlaneActive" + i + ";");
34530
34616
  src.push("uniform vec3 sectionPlanePos" + i + ";");
34531
34617
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -34536,7 +34622,7 @@ function buildFragment$2(mesh) {
34536
34622
  if (clipping) {
34537
34623
  src.push("if (clippable) {");
34538
34624
  src.push(" float dist = 0.0;");
34539
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
34625
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
34540
34626
  src.push("if (sectionPlaneActive" + i + ") {");
34541
34627
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
34542
34628
  src.push("}");
@@ -34637,19 +34723,29 @@ PickTriangleRenderer.prototype.drawMesh = function (frameCtx, mesh) {
34637
34723
  gl.uniformMatrix4fv(this._uViewMatrix, false, origin ? frameCtx.getRTCPickViewMatrix(meshState.originHash, origin) : frameCtx.pickViewMatrix);
34638
34724
 
34639
34725
  if (meshState.clippable) {
34726
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
34640
34727
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
34641
- if (numSectionPlanes > 0) {
34728
+ if (numAllocatedSectionPlanes > 0) {
34642
34729
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
34643
34730
  const renderFlags = mesh.renderFlags;
34644
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
34731
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
34645
34732
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
34646
34733
  if (sectionPlaneUniforms) {
34647
- const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];
34648
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
34649
- if (active) {
34650
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
34651
- gl.uniform3fv(sectionPlaneUniforms.pos, origin ? getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$w) : sectionPlane.pos);
34652
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
34734
+ if (sectionPlaneIndex < numSectionPlanes) {
34735
+ const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];
34736
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
34737
+ if (active) {
34738
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
34739
+ if (origin) {
34740
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$w);
34741
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
34742
+ } else {
34743
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
34744
+ }
34745
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
34746
+ }
34747
+ } else {
34748
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
34653
34749
  }
34654
34750
  }
34655
34751
  }
@@ -34830,7 +34926,7 @@ function buildFragment$1(mesh) {
34830
34926
 
34831
34927
  const scene = mesh.scene;
34832
34928
  const sectionPlanesState = scene._sectionPlanesState;
34833
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
34929
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
34834
34930
  const src = [];
34835
34931
  src.push('#version 300 es');
34836
34932
  src.push("// Mesh occlusion fragment shader");
@@ -34851,7 +34947,7 @@ function buildFragment$1(mesh) {
34851
34947
  if (clipping) {
34852
34948
  src.push("uniform bool clippable;");
34853
34949
  src.push("in vec4 vWorldPosition;");
34854
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
34950
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
34855
34951
  src.push("uniform bool sectionPlaneActive" + i + ";");
34856
34952
  src.push("uniform vec3 sectionPlanePos" + i + ";");
34857
34953
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -34865,7 +34961,7 @@ function buildFragment$1(mesh) {
34865
34961
  if (clipping) {
34866
34962
  src.push("if (clippable) {");
34867
34963
  src.push(" float dist = 0.0;");
34868
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
34964
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
34869
34965
  src.push("if (sectionPlaneActive" + i + ") {");
34870
34966
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
34871
34967
  src.push("}");
@@ -34986,19 +35082,29 @@ OcclusionRenderer.prototype.drawMesh = function (frameCtx, mesh) {
34986
35082
  gl.uniformMatrix4fv(this._uViewMatrix, false, origin ? frameCtx.getRTCViewMatrix(meshState.originHash, origin) : camera.viewMatrix);
34987
35083
 
34988
35084
  if (meshState.clippable) {
35085
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
34989
35086
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
34990
- if (numSectionPlanes > 0) {
35087
+ if (numAllocatedSectionPlanes > 0) {
34991
35088
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
34992
35089
  const renderFlags = mesh.renderFlags;
34993
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
35090
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
34994
35091
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
34995
35092
  if (sectionPlaneUniforms) {
34996
- const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];
34997
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
34998
- if (active) {
34999
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
35000
- gl.uniform3fv(sectionPlaneUniforms.pos, origin ? getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$v) : sectionPlane.pos);
35001
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
35093
+ if (sectionPlaneIndex < numSectionPlanes) {
35094
+ const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];
35095
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
35096
+ if (active) {
35097
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
35098
+ if (origin) {
35099
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$v);
35100
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
35101
+ } else {
35102
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
35103
+ }
35104
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
35105
+ }
35106
+ } else {
35107
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
35002
35108
  }
35003
35109
  }
35004
35110
  }
@@ -35133,7 +35239,7 @@ function buildFragment(mesh) {
35133
35239
  const scene = mesh.scene;
35134
35240
  scene.canvas.gl;
35135
35241
  const sectionPlanesState = scene._sectionPlanesState;
35136
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
35242
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
35137
35243
  const src = [];
35138
35244
  src.push("// Mesh shadow fragment shader");
35139
35245
 
@@ -35148,7 +35254,7 @@ function buildFragment(mesh) {
35148
35254
  if (clipping) {
35149
35255
  src.push("uniform bool clippable;");
35150
35256
  src.push("in vec4 vWorldPosition;");
35151
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
35257
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
35152
35258
  src.push("uniform bool sectionPlaneActive" + i + ";");
35153
35259
  src.push("uniform vec3 sectionPlanePos" + i + ";");
35154
35260
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -35169,7 +35275,7 @@ function buildFragment(mesh) {
35169
35275
  if (clipping) {
35170
35276
  src.push("if (clippable) {");
35171
35277
  src.push(" float dist = 0.0;");
35172
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
35278
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
35173
35279
  src.push("if (sectionPlaneActive" + i + ") {");
35174
35280
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
35175
35281
  src.push("}");
@@ -35364,7 +35470,7 @@ ShadowRenderer.prototype._bindProgram = function (frame) {
35364
35470
  this._lastMaterialId = null;
35365
35471
  this._lastVertexBufsId = null;
35366
35472
  this._lastGeometryId = null;
35367
- if (sectionPlanesState.sectionPlanes.length > 0) {
35473
+ if (sectionPlanesState.getNumAllocatedSectionPlanes() > 0) {
35368
35474
  let sectionPlaneUniforms;
35369
35475
  let uSectionPlaneActive;
35370
35476
  let sectionPlane;
@@ -56581,32 +56687,38 @@ class VBOSceneModelRenderer {
56581
56687
  const {gl} = scene.canvas;
56582
56688
  const {model, layerIndex} = layer;
56583
56689
 
56690
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
56584
56691
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
56585
- if (numSectionPlanes > 0) {
56692
+ if (numAllocatedSectionPlanes > 0) {
56586
56693
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
56587
56694
  const baseIndex = layerIndex * numSectionPlanes;
56588
56695
  const renderFlags = model.renderFlags;
56589
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
56696
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
56590
56697
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
56591
56698
  if (sectionPlaneUniforms) {
56592
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
56593
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
56594
- if (active) {
56595
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
56596
- const origin = layer._state.origin;
56597
- if (origin) {
56598
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$s);
56599
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
56600
- } else {
56601
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
56699
+ if (sectionPlaneIndex < numSectionPlanes) {
56700
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
56701
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
56702
+ if (active) {
56703
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
56704
+ const origin = layer._state.origin;
56705
+ if (origin) {
56706
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$s);
56707
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
56708
+ } else {
56709
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
56710
+ }
56711
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
56602
56712
  }
56603
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
56713
+ } else {
56714
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
56604
56715
  }
56605
56716
  }
56606
56717
  }
56607
56718
  }
56608
56719
  }
56609
56720
 
56721
+
56610
56722
  _allocate() {
56611
56723
  const scene = this._scene;
56612
56724
  const gl = scene.canvas.gl;
@@ -56687,7 +56799,7 @@ class VBOSceneModelRenderer {
56687
56799
 
56688
56800
  this._uSectionPlanes = [];
56689
56801
 
56690
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
56802
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
56691
56803
  this._uSectionPlanes.push({
56692
56804
  active: program.getLocation("sectionPlaneActive" + i),
56693
56805
  pos: program.getLocation("sectionPlanePos" + i),
@@ -57153,12 +57265,11 @@ class VBOSceneModelTriangleBatchingEdgesRenderer extends VBOSceneModelTriangleBa
57153
57265
  }
57154
57266
 
57155
57267
 
57156
-
57157
57268
  /**
57158
57269
  * @private
57159
57270
  */
57160
57271
  class VBOSceneModelTriangleInstancingRenderer extends VBOSceneModelRenderer {
57161
- constructor(scene, withSAO, { edges = false} = {}) {
57272
+ constructor(scene, withSAO, {edges = false} = {}) {
57162
57273
  super(scene, withSAO, {instancing: true, edges});
57163
57274
  }
57164
57275
 
@@ -57305,7 +57416,7 @@ class TrianglesBatchingColorRenderer extends VBOSceneModelTriangleBatchingRender
57305
57416
  const scene = this._scene;
57306
57417
  const sectionPlanesState = scene._sectionPlanesState;
57307
57418
  const lightsState = scene._lightsState;
57308
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
57419
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57309
57420
  let light;
57310
57421
  const src = [];
57311
57422
  src.push("#version 300 es");
@@ -57444,7 +57555,7 @@ class TrianglesBatchingColorRenderer extends VBOSceneModelTriangleBatchingRender
57444
57555
  _buildFragmentShader() {
57445
57556
  const scene = this._scene;
57446
57557
  const sectionPlanesState = scene._sectionPlanesState;
57447
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
57558
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57448
57559
  const src = [];
57449
57560
  src.push("#version 300 es");
57450
57561
  src.push("// Triangles batching draw fragment shader");
@@ -57477,7 +57588,7 @@ class TrianglesBatchingColorRenderer extends VBOSceneModelTriangleBatchingRender
57477
57588
  if (clipping) {
57478
57589
  src.push("in vec4 vWorldPosition;");
57479
57590
  src.push("in float vFlags;");
57480
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
57591
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
57481
57592
  src.push("uniform bool sectionPlaneActive" + i + ";");
57482
57593
  src.push("uniform vec3 sectionPlanePos" + i + ";");
57483
57594
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -57491,7 +57602,7 @@ class TrianglesBatchingColorRenderer extends VBOSceneModelTriangleBatchingRender
57491
57602
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
57492
57603
  src.push(" if (clippable) {");
57493
57604
  src.push(" float dist = 0.0;");
57494
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
57605
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
57495
57606
  src.push("if (sectionPlaneActive" + i + ") {");
57496
57607
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
57497
57608
  src.push("}");
@@ -57537,7 +57648,7 @@ class TrianglesBatchingFlatColorRenderer extends VBOSceneModelTriangleBatchingRe
57537
57648
  _buildVertexShader() {
57538
57649
  const scene = this._scene;
57539
57650
  const sectionPlanesState = scene._sectionPlanesState;
57540
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
57651
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57541
57652
  const src = [];
57542
57653
  src.push("#version 300 es");
57543
57654
  src.push("// Triangles batching flat-shading draw vertex shader");
@@ -57609,7 +57720,7 @@ class TrianglesBatchingFlatColorRenderer extends VBOSceneModelTriangleBatchingRe
57609
57720
  const scene = this._scene;
57610
57721
  const lightsState = scene._lightsState;
57611
57722
  const sectionPlanesState = scene._sectionPlanesState;
57612
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
57723
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57613
57724
  const src = [];
57614
57725
  src.push("#version 300 es");
57615
57726
  src.push("// Triangles batching flat-shading draw fragment shader");
@@ -57645,7 +57756,7 @@ class TrianglesBatchingFlatColorRenderer extends VBOSceneModelTriangleBatchingRe
57645
57756
  if (clipping) {
57646
57757
  src.push("in vec4 vWorldPosition;");
57647
57758
  src.push("in float vFlags;");
57648
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
57759
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
57649
57760
  src.push("uniform bool sectionPlaneActive" + i + ";");
57650
57761
  src.push("uniform vec3 sectionPlanePos" + i + ";");
57651
57762
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -57683,7 +57794,7 @@ class TrianglesBatchingFlatColorRenderer extends VBOSceneModelTriangleBatchingRe
57683
57794
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
57684
57795
  src.push(" if (clippable) {");
57685
57796
  src.push(" float dist = 0.0;");
57686
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
57797
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
57687
57798
  src.push("if (sectionPlaneActive" + i + ") {");
57688
57799
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
57689
57800
  src.push("}");
@@ -57772,7 +57883,7 @@ class TrianglesBatchingSilhouetteRenderer extends VBOSceneModelTriangleBatchingR
57772
57883
 
57773
57884
  const scene = this._scene;
57774
57885
  const sectionPlanesState = scene._sectionPlanesState;
57775
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
57886
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57776
57887
 
57777
57888
  const src = [];
57778
57889
  src.push("#version 300 es");
@@ -57843,7 +57954,7 @@ class TrianglesBatchingSilhouetteRenderer extends VBOSceneModelTriangleBatchingR
57843
57954
  const sectionPlanesState = scene._sectionPlanesState;
57844
57955
  let i;
57845
57956
  let len;
57846
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
57957
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57847
57958
  const src = [];
57848
57959
  src.push("#version 300 es");
57849
57960
  src.push("// Triangles batching silhouette fragment shader");
@@ -57863,7 +57974,7 @@ class TrianglesBatchingSilhouetteRenderer extends VBOSceneModelTriangleBatchingR
57863
57974
  if (clipping) {
57864
57975
  src.push("in vec4 vWorldPosition;");
57865
57976
  src.push("in float vFlags;");
57866
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
57977
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
57867
57978
  src.push("uniform bool sectionPlaneActive" + i + ";");
57868
57979
  src.push("uniform vec3 sectionPlanePos" + i + ";");
57869
57980
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -57876,7 +57987,7 @@ class TrianglesBatchingSilhouetteRenderer extends VBOSceneModelTriangleBatchingR
57876
57987
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
57877
57988
  src.push(" if (clippable) {");
57878
57989
  src.push(" float dist = 0.0;");
57879
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
57990
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
57880
57991
  src.push("if (sectionPlaneActive" + i + ") {");
57881
57992
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
57882
57993
  src.push("}");
@@ -57905,7 +58016,7 @@ class TrianglesBatchingEdgesRenderer extends VBOSceneModelTriangleBatchingEdgesR
57905
58016
  _buildVertexShader() {
57906
58017
  const scene = this._scene;
57907
58018
  const sectionPlanesState = scene._sectionPlanesState;
57908
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
58019
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57909
58020
  const src = [];
57910
58021
 
57911
58022
  src.push("#version 300 es");
@@ -57974,7 +58085,7 @@ class TrianglesBatchingEdgesRenderer extends VBOSceneModelTriangleBatchingEdgesR
57974
58085
  _buildFragmentShader() {
57975
58086
  const scene = this._scene;
57976
58087
  const sectionPlanesState = scene._sectionPlanesState;
57977
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
58088
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57978
58089
  const src = [];
57979
58090
  src.push("#version 300 es");
57980
58091
  src.push("// Batched geometry edges drawing fragment shader");
@@ -57994,7 +58105,7 @@ class TrianglesBatchingEdgesRenderer extends VBOSceneModelTriangleBatchingEdgesR
57994
58105
  if (clipping) {
57995
58106
  src.push("in vec4 vWorldPosition;");
57996
58107
  src.push("in float vFlags;");
57997
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
58108
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
57998
58109
  src.push("uniform bool sectionPlaneActive" + i + ";");
57999
58110
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58000
58111
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58007,7 +58118,7 @@ class TrianglesBatchingEdgesRenderer extends VBOSceneModelTriangleBatchingEdgesR
58007
58118
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58008
58119
  src.push(" if (clippable) {");
58009
58120
  src.push(" float dist = 0.0;");
58010
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
58121
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
58011
58122
  src.push("if (sectionPlaneActive" + i + ") {");
58012
58123
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58013
58124
  src.push("}");
@@ -58032,7 +58143,7 @@ class TrianglesBatchingEdgesColorRenderer extends VBOSceneModelTriangleBatchingE
58032
58143
  _buildVertexShader() {
58033
58144
  const scene = this._scene;
58034
58145
  const sectionPlanesState = scene._sectionPlanesState;
58035
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
58146
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58036
58147
  const src = [];
58037
58148
  src.push("#version 300 es");
58038
58149
  src.push("// Batched geometry edges drawing vertex shader");
@@ -58101,7 +58212,7 @@ class TrianglesBatchingEdgesColorRenderer extends VBOSceneModelTriangleBatchingE
58101
58212
  _buildFragmentShader() {
58102
58213
  const scene = this._scene;
58103
58214
  const sectionPlanesState = scene._sectionPlanesState;
58104
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
58215
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58105
58216
  const src = [];
58106
58217
  src.push("#version 300 es");
58107
58218
  src.push("// Batched geometry edges drawing fragment shader");
@@ -58120,7 +58231,7 @@ class TrianglesBatchingEdgesColorRenderer extends VBOSceneModelTriangleBatchingE
58120
58231
  if (clipping) {
58121
58232
  src.push("in vec4 vWorldPosition;");
58122
58233
  src.push("in float vFlags;");
58123
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
58234
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
58124
58235
  src.push("uniform bool sectionPlaneActive" + i + ";");
58125
58236
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58126
58237
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58133,7 +58244,7 @@ class TrianglesBatchingEdgesColorRenderer extends VBOSceneModelTriangleBatchingE
58133
58244
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58134
58245
  src.push(" if (clippable) {");
58135
58246
  src.push(" float dist = 0.0;");
58136
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
58247
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
58137
58248
  src.push("if (sectionPlaneActive" + i + ") {");
58138
58249
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58139
58250
  src.push("}");
@@ -58157,7 +58268,7 @@ class TrianglesBatchingPickMeshRenderer extends VBOSceneModelTriangleBatchingRen
58157
58268
 
58158
58269
  _buildVertexShader() {
58159
58270
  const scene = this._scene;
58160
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
58271
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58161
58272
  const src = [];
58162
58273
  src.push("#version 300 es");
58163
58274
  src.push("// Batched geometry picking vertex shader");
@@ -58229,7 +58340,7 @@ class TrianglesBatchingPickMeshRenderer extends VBOSceneModelTriangleBatchingRen
58229
58340
  _buildFragmentShader() {
58230
58341
  const scene = this._scene;
58231
58342
  const sectionPlanesState = scene._sectionPlanesState;
58232
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
58343
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58233
58344
  const src = [];
58234
58345
  src.push("#version 300 es");
58235
58346
  src.push("// Batched geometry picking fragment shader");
@@ -58249,7 +58360,7 @@ class TrianglesBatchingPickMeshRenderer extends VBOSceneModelTriangleBatchingRen
58249
58360
  if (clipping) {
58250
58361
  src.push("in vec4 vWorldPosition;");
58251
58362
  src.push("in float vFlags;");
58252
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58363
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58253
58364
  src.push("uniform bool sectionPlaneActive" + i + ";");
58254
58365
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58255
58366
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58262,7 +58373,7 @@ class TrianglesBatchingPickMeshRenderer extends VBOSceneModelTriangleBatchingRen
58262
58373
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58263
58374
  src.push(" if (clippable) {");
58264
58375
  src.push(" float dist = 0.0;");
58265
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58376
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58266
58377
  src.push(" if (sectionPlaneActive" + i + ") {");
58267
58378
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58268
58379
  src.push(" }");
@@ -58287,7 +58398,7 @@ class TrianglesBatchingPickDepthRenderer extends VBOSceneModelTriangleBatchingRe
58287
58398
  _buildVertexShader() {
58288
58399
 
58289
58400
  const scene = this._scene;
58290
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
58401
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58291
58402
  const src = [];
58292
58403
  src.push("#version 300 es");
58293
58404
  src.push("// Triangles batching pick depth vertex shader");
@@ -58357,7 +58468,7 @@ class TrianglesBatchingPickDepthRenderer extends VBOSceneModelTriangleBatchingRe
58357
58468
 
58358
58469
  const scene = this._scene;
58359
58470
  const sectionPlanesState = scene._sectionPlanesState;
58360
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
58471
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58361
58472
  const src = [];
58362
58473
  src.push("#version 300 es");
58363
58474
  src.push("// Triangles batching pick depth fragment shader");
@@ -58384,7 +58495,7 @@ class TrianglesBatchingPickDepthRenderer extends VBOSceneModelTriangleBatchingRe
58384
58495
  if (clipping) {
58385
58496
  src.push("in vec4 vWorldPosition;");
58386
58497
  src.push("in float vFlags;");
58387
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58498
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58388
58499
  src.push("uniform bool sectionPlaneActive" + i + ";");
58389
58500
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58390
58501
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58404,7 +58515,7 @@ class TrianglesBatchingPickDepthRenderer extends VBOSceneModelTriangleBatchingRe
58404
58515
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58405
58516
  src.push(" if (clippable) {");
58406
58517
  src.push(" float dist = 0.0;");
58407
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58518
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58408
58519
  src.push(" if (sectionPlaneActive" + i + ") {");
58409
58520
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58410
58521
  src.push(" }");
@@ -58429,7 +58540,7 @@ class TrianglesBatchingPickNormalsRenderer extends VBOSceneModelTriangleBatching
58429
58540
 
58430
58541
  _buildVertexShader() {
58431
58542
  const scene = this._scene;
58432
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
58543
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58433
58544
  const src = [];
58434
58545
  src.push("#version 300 es");
58435
58546
  src.push("// Triangles batching pick normals vertex shader");
@@ -58500,7 +58611,7 @@ class TrianglesBatchingPickNormalsRenderer extends VBOSceneModelTriangleBatching
58500
58611
  _buildFragmentShader() {
58501
58612
  const scene = this._scene;
58502
58613
  const sectionPlanesState = scene._sectionPlanesState;
58503
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
58614
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58504
58615
  const src = [];
58505
58616
  src.push("#version 300 es");
58506
58617
  src.push("// Triangles batching pick normals fragment shader");
@@ -58520,7 +58631,7 @@ class TrianglesBatchingPickNormalsRenderer extends VBOSceneModelTriangleBatching
58520
58631
  if (clipping) {
58521
58632
  src.push("in vec4 vWorldPosition;");
58522
58633
  src.push("in float vFlags;");
58523
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58634
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58524
58635
  src.push("uniform bool sectionPlaneActive" + i + ";");
58525
58636
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58526
58637
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58533,7 +58644,7 @@ class TrianglesBatchingPickNormalsRenderer extends VBOSceneModelTriangleBatching
58533
58644
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58534
58645
  src.push(" if (clippable) {");
58535
58646
  src.push(" float dist = 0.0;");
58536
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58647
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58537
58648
  src.push(" if (sectionPlaneActive" + i + ") {");
58538
58649
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58539
58650
  src.push(" }");
@@ -58557,7 +58668,7 @@ class TrianglesBatchingOcclusionRenderer extends VBOSceneModelTriangleBatchingRe
58557
58668
 
58558
58669
  _buildVertexShader() {
58559
58670
  const scene = this._scene;
58560
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
58671
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58561
58672
  const src = [];
58562
58673
  src.push("#version 300 es");
58563
58674
  src.push("// Triangles batching occlusion vertex shader");
@@ -58606,7 +58717,7 @@ class TrianglesBatchingOcclusionRenderer extends VBOSceneModelTriangleBatchingRe
58606
58717
  _buildFragmentShader() {
58607
58718
  const scene = this._scene;
58608
58719
  const sectionPlanesState = scene._sectionPlanesState;
58609
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
58720
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58610
58721
  const src = [];
58611
58722
  src.push("#version 300 es");
58612
58723
  src.push("// Triangles batching occlusion fragment shader");
@@ -58621,7 +58732,7 @@ class TrianglesBatchingOcclusionRenderer extends VBOSceneModelTriangleBatchingRe
58621
58732
  if (clipping) {
58622
58733
  src.push("in vec4 vWorldPosition;");
58623
58734
  src.push("in float vFlags;");
58624
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58735
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58625
58736
  src.push("uniform bool sectionPlaneActive" + i + ";");
58626
58737
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58627
58738
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58633,7 +58744,7 @@ class TrianglesBatchingOcclusionRenderer extends VBOSceneModelTriangleBatchingRe
58633
58744
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58634
58745
  src.push(" if (clippable) {");
58635
58746
  src.push(" float dist = 0.0;");
58636
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58747
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58637
58748
  src.push(" if (sectionPlaneActive" + i + ") {");
58638
58749
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58639
58750
  src.push(" }");
@@ -58654,7 +58765,7 @@ class TrianglesBatchingDepthRenderer extends VBOSceneModelTriangleBatchingRender
58654
58765
 
58655
58766
  _buildVertexShader() {
58656
58767
  const scene = this._scene;
58657
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
58768
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58658
58769
  const src = [];
58659
58770
  src.push("#version 300 es");
58660
58771
  src.push("// Triangles batching depth vertex shader");
@@ -58714,7 +58825,7 @@ class TrianglesBatchingDepthRenderer extends VBOSceneModelTriangleBatchingRender
58714
58825
  _buildFragmentShader() {
58715
58826
  const scene = this._scene;
58716
58827
  const sectionPlanesState = scene._sectionPlanesState;
58717
- const clipping = (sectionPlanesState.sectionPlanes.length > 0);
58828
+ const clipping = (sectionPlanesState.getNumAllocatedSectionPlanes() > 0);
58718
58829
  const src = [];
58719
58830
  src.push("#version 300 es");
58720
58831
  src.push("// Triangles batching depth fragment shader");
@@ -58729,7 +58840,7 @@ class TrianglesBatchingDepthRenderer extends VBOSceneModelTriangleBatchingRender
58729
58840
  if (clipping) {
58730
58841
  src.push("in vec4 vWorldPosition;");
58731
58842
  src.push("in float vFlags;");
58732
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58843
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58733
58844
  src.push("uniform bool sectionPlaneActive" + i + ";");
58734
58845
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58735
58846
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58753,7 +58864,7 @@ class TrianglesBatchingDepthRenderer extends VBOSceneModelTriangleBatchingRender
58753
58864
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58754
58865
  src.push(" if (clippable) {");
58755
58866
  src.push(" float dist = 0.0;");
58756
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58867
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58757
58868
  src.push(" if (sectionPlaneActive" + i + ") {");
58758
58869
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58759
58870
  src.push(" }");
@@ -58778,7 +58889,7 @@ class TrianglesBatchingNormalsRenderer extends VBOSceneModelTriangleBatchingRend
58778
58889
 
58779
58890
  _buildVertexShader() {
58780
58891
  const scene = this._scene;
58781
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
58892
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58782
58893
  const src = [];
58783
58894
  src.push("#version 300 es");
58784
58895
  src.push("// Batched geometry normals vertex shader");
@@ -58849,7 +58960,7 @@ class TrianglesBatchingNormalsRenderer extends VBOSceneModelTriangleBatchingRend
58849
58960
  _buildFragmentShader() {
58850
58961
  const scene = this._scene;
58851
58962
  const sectionPlanesState = scene._sectionPlanesState;
58852
- const clipping = (sectionPlanesState.sectionPlanes.length > 0);
58963
+ const clipping = (sectionPlanesState.getNumAllocatedSectionPlanes() > 0);
58853
58964
  const src = [];
58854
58965
  src.push("#version 300 es");
58855
58966
  src.push("// Batched geometry normals fragment shader");
@@ -58873,7 +58984,7 @@ class TrianglesBatchingNormalsRenderer extends VBOSceneModelTriangleBatchingRend
58873
58984
  if (clipping) {
58874
58985
  src.push("in vec4 vWorldPosition;");
58875
58986
  src.push("in float vFlags;");
58876
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58987
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58877
58988
  src.push("uniform bool sectionPlaneActive" + i + ";");
58878
58989
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58879
58990
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58890,7 +59001,7 @@ class TrianglesBatchingNormalsRenderer extends VBOSceneModelTriangleBatchingRend
58890
59001
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58891
59002
  src.push(" if (clippable) {");
58892
59003
  src.push(" float dist = 0.0;");
58893
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
59004
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58894
59005
  src.push(" if (sectionPlaneActive" + i + ") {");
58895
59006
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58896
59007
  src.push(" }");
@@ -58916,7 +59027,7 @@ class TrianglesBatchingShadowRenderer extends VBOSceneModelTriangleBatchingRende
58916
59027
 
58917
59028
  _buildVertexShader() {
58918
59029
  const scene = this._scene;
58919
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
59030
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58920
59031
  const src = [];
58921
59032
  src.push("#version 300 es");
58922
59033
  src.push("// Batched geometry shadow vertex shader");
@@ -58963,7 +59074,7 @@ class TrianglesBatchingShadowRenderer extends VBOSceneModelTriangleBatchingRende
58963
59074
  _buildFragmentShader() {
58964
59075
  const scene = this._scene;
58965
59076
  const sectionPlanesState = scene._sectionPlanesState;
58966
- const clipping = (sectionPlanesState.sectionPlanes.length > 0);
59077
+ const clipping = (sectionPlanesState.getNumAllocatedSectionPlanes() > 0);
58967
59078
  const src = [];
58968
59079
  src.push("#version 300 es");
58969
59080
  src.push("// Batched geometry shadow fragment shader");
@@ -58977,7 +59088,7 @@ class TrianglesBatchingShadowRenderer extends VBOSceneModelTriangleBatchingRende
58977
59088
  if (clipping) {
58978
59089
  src.push("in vec4 vWorldPosition;");
58979
59090
  src.push("in float vFlags;");
58980
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
59091
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58981
59092
  src.push("uniform bool sectionPlaneActive" + i + ";");
58982
59093
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58983
59094
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58998,7 +59109,7 @@ class TrianglesBatchingShadowRenderer extends VBOSceneModelTriangleBatchingRende
58998
59109
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58999
59110
  src.push(" if (clippable) {");
59000
59111
  src.push(" float dist = 0.0;");
59001
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
59112
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
59002
59113
  src.push(" if (sectionPlaneActive" + i + ") {");
59003
59114
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
59004
59115
  src.push(" }");
@@ -59034,7 +59145,7 @@ class TrianglesBatchingPBRRenderer extends VBOSceneModelTriangleBatchingRenderer
59034
59145
  const scene = this._scene;
59035
59146
  const sectionPlanesState = scene._sectionPlanesState;
59036
59147
  const lightsState = scene._lightsState;
59037
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
59148
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
59038
59149
  const clippingCaps = sectionPlanesState.clippingCaps;
59039
59150
 
59040
59151
  const src = [];
@@ -59164,7 +59275,7 @@ class TrianglesBatchingPBRRenderer extends VBOSceneModelTriangleBatchingRenderer
59164
59275
  const gammaOutput = scene.gammaOutput; // If set, then it expects that all textures and colors need to be outputted in premultiplied gamma. Default is false.
59165
59276
  const sectionPlanesState = scene._sectionPlanesState;
59166
59277
  const lightsState = scene._lightsState;
59167
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
59278
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
59168
59279
  const clippingCaps = sectionPlanesState.clippingCaps;
59169
59280
  const src = [];
59170
59281
 
@@ -59268,7 +59379,7 @@ class TrianglesBatchingPBRRenderer extends VBOSceneModelTriangleBatchingRenderer
59268
59379
  if (clippingCaps) {
59269
59380
  src.push("in vec4 vClipPosition;");
59270
59381
  }
59271
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
59382
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
59272
59383
  src.push("uniform bool sectionPlaneActive" + i + ";");
59273
59384
  src.push("uniform vec3 sectionPlanePos" + i + ";");
59274
59385
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -59441,7 +59552,7 @@ class TrianglesBatchingPBRRenderer extends VBOSceneModelTriangleBatchingRenderer
59441
59552
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
59442
59553
  src.push(" if (clippable) {");
59443
59554
  src.push(" float dist = 0.0;");
59444
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
59555
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
59445
59556
  src.push("if (sectionPlaneActive" + i + ") {");
59446
59557
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
59447
59558
  src.push("}");
@@ -59579,7 +59690,7 @@ class TrianglesBatchingPickNormalsFlatRenderer extends VBOSceneModelTriangleBatc
59579
59690
 
59580
59691
  _buildVertexShader() {
59581
59692
  const scene = this._scene;
59582
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
59693
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
59583
59694
  const src = [];
59584
59695
  src.push("#version 300 es");
59585
59696
  src.push("// Triangles batching pick flat normals vertex shader");
@@ -59638,7 +59749,7 @@ class TrianglesBatchingPickNormalsFlatRenderer extends VBOSceneModelTriangleBatc
59638
59749
  _buildFragmentShader() {
59639
59750
  const scene = this._scene;
59640
59751
  const sectionPlanesState = scene._sectionPlanesState;
59641
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
59752
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
59642
59753
  const src = [];
59643
59754
  src.push("#version 300 es");
59644
59755
  src.push("// Triangles batching pick flat normals fragment shader");
@@ -59658,7 +59769,7 @@ class TrianglesBatchingPickNormalsFlatRenderer extends VBOSceneModelTriangleBatc
59658
59769
  src.push("in vec4 vWorldPosition;");
59659
59770
  if (clipping) {
59660
59771
  src.push("in float vFlags;");
59661
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
59772
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
59662
59773
  src.push("uniform bool sectionPlaneActive" + i + ";");
59663
59774
  src.push("uniform vec3 sectionPlanePos" + i + ";");
59664
59775
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -59670,7 +59781,7 @@ class TrianglesBatchingPickNormalsFlatRenderer extends VBOSceneModelTriangleBatc
59670
59781
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
59671
59782
  src.push(" if (clippable) {");
59672
59783
  src.push(" float dist = 0.0;");
59673
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
59784
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
59674
59785
  src.push(" if (sectionPlaneActive" + i + ") {");
59675
59786
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
59676
59787
  src.push(" }");
@@ -59707,7 +59818,7 @@ class TrianglesBatchingColorTextureRenderer extends VBOSceneModelTriangleBatchin
59707
59818
 
59708
59819
  const scene = this._scene;
59709
59820
  const sectionPlanesState = scene._sectionPlanesState;
59710
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
59821
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
59711
59822
  const src = [];
59712
59823
  src.push("#version 300 es");
59713
59824
  src.push("// Triangles batching color texture vertex shader");
@@ -59784,7 +59895,7 @@ class TrianglesBatchingColorTextureRenderer extends VBOSceneModelTriangleBatchin
59784
59895
  const gammaOutput = scene.gammaOutput; // If set, then it expects that all textures and colors need to be outputted in premultiplied gamma. Default is false.
59785
59896
  const lightsState = scene._lightsState;
59786
59897
  const sectionPlanesState = scene._sectionPlanesState;
59787
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
59898
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
59788
59899
  const src = [];
59789
59900
  src.push("#version 300 es");
59790
59901
  src.push("// Triangles batching color texture fragment shader");
@@ -59834,7 +59945,7 @@ class TrianglesBatchingColorTextureRenderer extends VBOSceneModelTriangleBatchin
59834
59945
  if (clipping) {
59835
59946
  src.push("in vec4 vWorldPosition;");
59836
59947
  src.push("in float vFlags;");
59837
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
59948
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
59838
59949
  src.push("uniform bool sectionPlaneActive" + i + ";");
59839
59950
  src.push("uniform vec3 sectionPlanePos" + i + ";");
59840
59951
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -59871,7 +59982,7 @@ class TrianglesBatchingColorTextureRenderer extends VBOSceneModelTriangleBatchin
59871
59982
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
59872
59983
  src.push(" if (clippable) {");
59873
59984
  src.push(" float dist = 0.0;");
59874
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
59985
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
59875
59986
  src.push("if (sectionPlaneActive" + i + ") {");
59876
59987
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
59877
59988
  src.push("}");
@@ -60461,7 +60572,7 @@ function octDecodeVec2(oct) { // Decode an oct-encoded normal
60461
60572
  const tempVec3a$r = math.vec3();
60462
60573
  const tempVec3b$n = math.vec3();
60463
60574
  const tempVec3c$k = math.vec3();
60464
- const tempVec3d$g = math.vec3();
60575
+ const tempVec3d$8 = math.vec3();
60465
60576
  const tempMat4a$g = math.mat4();
60466
60577
 
60467
60578
  /**
@@ -60527,7 +60638,7 @@ class SnapBatchingDepthBufInitRenderer extends VBOSceneModelRenderer {
60527
60638
  rtcOrigin[1] += position[1];
60528
60639
  rtcOrigin[2] += position[2];
60529
60640
  rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a$g);
60530
- rtcCameraEye = tempVec3d$g;
60641
+ rtcCameraEye = tempVec3d$8;
60531
60642
  rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];
60532
60643
  rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];
60533
60644
  rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];
@@ -60602,7 +60713,7 @@ class SnapBatchingDepthBufInitRenderer extends VBOSceneModelRenderer {
60602
60713
 
60603
60714
  _buildVertexShader() {
60604
60715
  const scene = this._scene;
60605
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
60716
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
60606
60717
  const src = [];
60607
60718
  src.push ('#version 300 es');
60608
60719
  src.push("// VBO SnapBatchingDepthBufInitRenderer vertex shader");
@@ -60689,7 +60800,7 @@ class SnapBatchingDepthBufInitRenderer extends VBOSceneModelRenderer {
60689
60800
  _buildFragmentShader() {
60690
60801
  const scene = this._scene;
60691
60802
  const sectionPlanesState = scene._sectionPlanesState;
60692
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
60803
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
60693
60804
  const src = [];
60694
60805
  src.push ('#version 300 es');
60695
60806
  src.push("// VBO SnapBatchingDepthBufInitRenderer fragment shader");
@@ -60711,7 +60822,7 @@ class SnapBatchingDepthBufInitRenderer extends VBOSceneModelRenderer {
60711
60822
  src.push("flat in vec4 vPickColor;");
60712
60823
  if (clipping) {
60713
60824
  src.push("in float vFlags;");
60714
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
60825
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
60715
60826
  src.push("uniform bool sectionPlaneActive" + i + ";");
60716
60827
  src.push("uniform vec3 sectionPlanePos" + i + ";");
60717
60828
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -60726,7 +60837,7 @@ class SnapBatchingDepthBufInitRenderer extends VBOSceneModelRenderer {
60726
60837
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
60727
60838
  src.push(" if (clippable) {");
60728
60839
  src.push(" float dist = 0.0;");
60729
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
60840
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
60730
60841
  src.push(" if (sectionPlaneActive" + i + ") {");
60731
60842
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
60732
60843
  src.push(" }");
@@ -60766,7 +60877,7 @@ class SnapBatchingDepthBufInitRenderer extends VBOSceneModelRenderer {
60766
60877
  const tempVec3a$q = math.vec3();
60767
60878
  const tempVec3b$m = math.vec3();
60768
60879
  const tempVec3c$j = math.vec3();
60769
- const tempVec3d$f = math.vec3();
60880
+ const tempVec3d$7 = math.vec3();
60770
60881
  const tempMat4a$f = math.mat4();
60771
60882
 
60772
60883
  /**
@@ -60836,7 +60947,7 @@ class SnapBatchingDepthRenderer extends VBOSceneModelRenderer{
60836
60947
  rtcOrigin[1] += position[1];
60837
60948
  rtcOrigin[2] += position[2];
60838
60949
  rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a$f);
60839
- rtcCameraEye = tempVec3d$f;
60950
+ rtcCameraEye = tempVec3d$7;
60840
60951
  rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];
60841
60952
  rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];
60842
60953
  rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];
@@ -60917,7 +61028,7 @@ class SnapBatchingDepthRenderer extends VBOSceneModelRenderer{
60917
61028
 
60918
61029
  _buildVertexShader() {
60919
61030
  const scene = this._scene;
60920
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
61031
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
60921
61032
  scene.pointsMaterial._state;
60922
61033
  const src = [];
60923
61034
  src.push ('#version 300 es');
@@ -61004,7 +61115,7 @@ class SnapBatchingDepthRenderer extends VBOSceneModelRenderer{
61004
61115
  _buildFragmentShader() {
61005
61116
  const scene = this._scene;
61006
61117
  const sectionPlanesState = scene._sectionPlanesState;
61007
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
61118
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
61008
61119
  const src = [];
61009
61120
  src.push ('#version 300 es');
61010
61121
  src.push("// SnapBatchingDepthRenderer fragment shader");
@@ -61025,7 +61136,7 @@ class SnapBatchingDepthRenderer extends VBOSceneModelRenderer{
61025
61136
  if (clipping) {
61026
61137
  src.push("in vec4 vWorldPosition;");
61027
61138
  src.push("in float vFlags;");
61028
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
61139
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
61029
61140
  src.push("uniform bool sectionPlaneActive" + i + ";");
61030
61141
  src.push("uniform vec3 sectionPlanePos" + i + ";");
61031
61142
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -61038,7 +61149,7 @@ class SnapBatchingDepthRenderer extends VBOSceneModelRenderer{
61038
61149
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
61039
61150
  src.push(" if (clippable) {");
61040
61151
  src.push(" float dist = 0.0;");
61041
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
61152
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
61042
61153
  src.push(" if (sectionPlaneActive" + i + ") {");
61043
61154
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
61044
61155
  src.push(" }");
@@ -61159,8 +61270,8 @@ math.OBB3();
61159
61270
  const tempVec3a$p = math.vec3();
61160
61271
  const tempVec3b$l = math.vec3();
61161
61272
  const tempVec3c$i = math.vec3();
61162
- const tempVec3d$e = math.vec3();
61163
- const tempVec3e$3 = math.vec3();
61273
+ const tempVec3d$6 = math.vec3();
61274
+ const tempVec3e$1 = math.vec3();
61164
61275
  const tempVec3f$1 = math.vec3();
61165
61276
  const tempVec3g$1 = math.vec3();
61166
61277
 
@@ -62351,8 +62462,8 @@ class TrianglesBatchingLayer {
62351
62462
 
62352
62463
  math.transformRay(this.model.worldNormalMatrix, rtcRayOrigin, rtcRayDir, rtcRayOrigin, rtcRayDir); // RTC -> local
62353
62464
 
62354
- const a = tempVec3d$e;
62355
- const b = tempVec3e$3;
62465
+ const a = tempVec3d$6;
62466
+ const b = tempVec3e$1;
62356
62467
  const c = tempVec3f$1;
62357
62468
 
62358
62469
  let gotIntersect = false;
@@ -62475,7 +62586,7 @@ class TrianglesInstancingColorRenderer extends VBOSceneModelTriangleInstancingRe
62475
62586
  const scene = this._scene;
62476
62587
  const sectionPlanesState = scene._sectionPlanesState;
62477
62588
  const lightsState = scene._lightsState;
62478
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
62589
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
62479
62590
  let i;
62480
62591
  let len;
62481
62592
  let light;
@@ -62627,7 +62738,7 @@ class TrianglesInstancingColorRenderer extends VBOSceneModelTriangleInstancingRe
62627
62738
  _buildFragmentShader() {
62628
62739
  const scene = this._scene;
62629
62740
  const sectionPlanesState = scene._sectionPlanesState;
62630
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
62741
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
62631
62742
  const src = [];
62632
62743
  src.push("#version 300 es");
62633
62744
  src.push("// Instancing geometry drawing fragment shader");
@@ -62660,7 +62771,7 @@ class TrianglesInstancingColorRenderer extends VBOSceneModelTriangleInstancingRe
62660
62771
  if (clipping) {
62661
62772
  src.push("in vec4 vWorldPosition;");
62662
62773
  src.push("in float vFlags;");
62663
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
62774
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
62664
62775
  src.push("uniform bool sectionPlaneActive" + i + ";");
62665
62776
  src.push("uniform vec3 sectionPlanePos" + i + ";");
62666
62777
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -62674,7 +62785,7 @@ class TrianglesInstancingColorRenderer extends VBOSceneModelTriangleInstancingRe
62674
62785
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
62675
62786
  src.push(" if (clippable) {");
62676
62787
  src.push(" float dist = 0.0;");
62677
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
62788
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
62678
62789
  src.push("if (sectionPlaneActive" + i + ") {");
62679
62790
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
62680
62791
  src.push("}");
@@ -62720,7 +62831,7 @@ class TrianglesInstancingFlatColorRenderer extends VBOSceneModelTriangleInstanci
62720
62831
  _buildVertexShader() {
62721
62832
  const scene = this._scene;
62722
62833
  const sectionPlanesState = scene._sectionPlanesState;
62723
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
62834
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
62724
62835
  const src = [];
62725
62836
  src.push("#version 300 es");
62726
62837
  src.push("// Instancing geometry flat-shading drawing vertex shader");
@@ -62802,7 +62913,7 @@ class TrianglesInstancingFlatColorRenderer extends VBOSceneModelTriangleInstanci
62802
62913
  const lightsState = scene._lightsState;
62803
62914
  let i;
62804
62915
  let len;
62805
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
62916
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
62806
62917
  const src = [];
62807
62918
  src.push("#version 300 es");
62808
62919
  src.push("// Instancing geometry flat-shading drawing fragment shader");
@@ -62835,7 +62946,7 @@ class TrianglesInstancingFlatColorRenderer extends VBOSceneModelTriangleInstanci
62835
62946
  if (clipping) {
62836
62947
  src.push("in vec4 vWorldPosition;");
62837
62948
  src.push("in float vFlags;");
62838
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
62949
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
62839
62950
  src.push("uniform bool sectionPlaneActive" + i + ";");
62840
62951
  src.push("uniform vec3 sectionPlanePos" + i + ";");
62841
62952
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -62874,7 +62985,7 @@ class TrianglesInstancingFlatColorRenderer extends VBOSceneModelTriangleInstanci
62874
62985
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
62875
62986
  src.push(" if (clippable) {");
62876
62987
  src.push(" float dist = 0.0;");
62877
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
62988
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
62878
62989
  src.push("if (sectionPlaneActive" + i + ") {");
62879
62990
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
62880
62991
  src.push("}");
@@ -62962,7 +63073,7 @@ class TrianglesInstancingSilhouetteRenderer extends VBOSceneModelTriangleInstanc
62962
63073
  _buildVertexShader() {
62963
63074
  const scene = this._scene;
62964
63075
  const sectionPlanesState = scene._sectionPlanesState;
62965
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63076
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
62966
63077
  const src = [];
62967
63078
  src.push("#version 300 es");
62968
63079
  src.push("// Instancing silhouette vertex shader");
@@ -63037,7 +63148,7 @@ class TrianglesInstancingSilhouetteRenderer extends VBOSceneModelTriangleInstanc
63037
63148
  _buildFragmentShader() {
63038
63149
  const scene = this._scene;
63039
63150
  const sectionPlanesState = scene._sectionPlanesState;
63040
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63151
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63041
63152
  const src = [];
63042
63153
  src.push("#version 300 es");
63043
63154
  src.push("// Instancing fill fragment shader");
@@ -63057,7 +63168,7 @@ class TrianglesInstancingSilhouetteRenderer extends VBOSceneModelTriangleInstanc
63057
63168
  if (clipping) {
63058
63169
  src.push("in vec4 vWorldPosition;");
63059
63170
  src.push("in float vFlags;");
63060
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
63171
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63061
63172
  src.push("uniform bool sectionPlaneActive" + i + ";");
63062
63173
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63063
63174
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63070,7 +63181,7 @@ class TrianglesInstancingSilhouetteRenderer extends VBOSceneModelTriangleInstanc
63070
63181
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63071
63182
  src.push(" if (clippable) {");
63072
63183
  src.push(" float dist = 0.0;");
63073
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
63184
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63074
63185
  src.push("if (sectionPlaneActive" + i + ") {");
63075
63186
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63076
63187
  src.push("}");
@@ -63099,7 +63210,7 @@ class TrianglesInstancingEdgesRenderer extends VBOSceneModelTriangleInstancingEd
63099
63210
  _buildVertexShader() {
63100
63211
  const scene = this._scene;
63101
63212
  const sectionPlanesState = scene._sectionPlanesState;
63102
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63213
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63103
63214
  const src = [];
63104
63215
  src.push("#version 300 es");
63105
63216
  src.push("// Triangles instancing edges vertex shader");
@@ -63168,7 +63279,7 @@ class TrianglesInstancingEdgesRenderer extends VBOSceneModelTriangleInstancingEd
63168
63279
  _buildFragmentShader() {
63169
63280
  const scene = this._scene;
63170
63281
  const sectionPlanesState = scene._sectionPlanesState;
63171
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63282
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63172
63283
  const src = [];
63173
63284
  src.push("#version 300 es");
63174
63285
  src.push("// Batched geometry edges drawing fragment shader");
@@ -63188,7 +63299,7 @@ class TrianglesInstancingEdgesRenderer extends VBOSceneModelTriangleInstancingEd
63188
63299
  if (clipping) {
63189
63300
  src.push("in vec4 vWorldPosition;");
63190
63301
  src.push("in float vFlags;");
63191
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
63302
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63192
63303
  src.push("uniform bool sectionPlaneActive" + i + ";");
63193
63304
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63194
63305
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63201,7 +63312,7 @@ class TrianglesInstancingEdgesRenderer extends VBOSceneModelTriangleInstancingEd
63201
63312
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63202
63313
  src.push(" if (clippable) {");
63203
63314
  src.push(" float dist = 0.0;");
63204
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
63315
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63205
63316
  src.push("if (sectionPlaneActive" + i + ") {");
63206
63317
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63207
63318
  src.push("}");
@@ -63226,7 +63337,7 @@ class TrianglesInstancingEdgesColorRenderer extends VBOSceneModelTriangleInstanc
63226
63337
  _buildVertexShader() {
63227
63338
  const scene = this._scene;
63228
63339
  const sectionPlanesState = scene._sectionPlanesState;
63229
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63340
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63230
63341
  const src = [];
63231
63342
  src.push("#version 300 es");
63232
63343
  src.push("// Triangles instancing edges vertex shader");
@@ -63296,7 +63407,7 @@ class TrianglesInstancingEdgesColorRenderer extends VBOSceneModelTriangleInstanc
63296
63407
  _buildFragmentShader() {
63297
63408
  const scene = this._scene;
63298
63409
  const sectionPlanesState = scene._sectionPlanesState;
63299
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63410
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63300
63411
  const src = [];
63301
63412
  src.push("#version 300 es");
63302
63413
  src.push("// Batched geometry edges drawing fragment shader");
@@ -63316,7 +63427,7 @@ class TrianglesInstancingEdgesColorRenderer extends VBOSceneModelTriangleInstanc
63316
63427
  if (clipping) {
63317
63428
  src.push("in vec4 vWorldPosition;");
63318
63429
  src.push("in float vFlags;");
63319
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
63430
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63320
63431
  src.push("uniform bool sectionPlaneActive" + i + ";");
63321
63432
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63322
63433
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63329,7 +63440,7 @@ class TrianglesInstancingEdgesColorRenderer extends VBOSceneModelTriangleInstanc
63329
63440
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63330
63441
  src.push(" if (clippable) {");
63331
63442
  src.push(" float dist = 0.0;");
63332
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
63443
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63333
63444
  src.push("if (sectionPlaneActive" + i + ") {");
63334
63445
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63335
63446
  src.push("}");
@@ -63354,7 +63465,7 @@ class TrianglesInstancingPickMeshRenderer extends VBOSceneModelTriangleInstancin
63354
63465
  _buildVertexShader() {
63355
63466
  const scene = this._scene;
63356
63467
  const sectionPlanesState = scene._sectionPlanesState;
63357
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63468
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63358
63469
  const src = [];
63359
63470
  src.push("#version 300 es");
63360
63471
  src.push("// Instancing geometry picking vertex shader");
@@ -63430,7 +63541,7 @@ class TrianglesInstancingPickMeshRenderer extends VBOSceneModelTriangleInstancin
63430
63541
  _buildFragmentShader() {
63431
63542
  const scene = this._scene;
63432
63543
  const sectionPlanesState = scene._sectionPlanesState;
63433
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63544
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63434
63545
  const src = [];
63435
63546
  src.push("#version 300 es");
63436
63547
  src.push("// Batched geometry picking fragment shader");
@@ -63450,7 +63561,7 @@ class TrianglesInstancingPickMeshRenderer extends VBOSceneModelTriangleInstancin
63450
63561
  if (clipping) {
63451
63562
  src.push("in vec4 vWorldPosition;");
63452
63563
  src.push("in float vFlags;");
63453
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63564
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63454
63565
  src.push("uniform bool sectionPlaneActive" + i + ";");
63455
63566
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63456
63567
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63463,7 +63574,7 @@ class TrianglesInstancingPickMeshRenderer extends VBOSceneModelTriangleInstancin
63463
63574
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63464
63575
  src.push(" if (clippable) {");
63465
63576
  src.push(" float dist = 0.0;");
63466
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63577
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63467
63578
  src.push("if (sectionPlaneActive" + i + ") {");
63468
63579
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63469
63580
  src.push("}");
@@ -63488,7 +63599,7 @@ class TrianglesInstancingPickDepthRenderer extends VBOSceneModelTriangleInstanci
63488
63599
  _buildVertexShader() {
63489
63600
  const scene = this._scene;
63490
63601
  const sectionPlanesState = scene._sectionPlanesState;
63491
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63602
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63492
63603
  const src = [];
63493
63604
  src.push("#version 300 es");
63494
63605
  src.push("// Instancing geometry depth vertex shader");
@@ -63564,7 +63675,7 @@ class TrianglesInstancingPickDepthRenderer extends VBOSceneModelTriangleInstanci
63564
63675
  _buildFragmentShader() {
63565
63676
  const scene = this._scene;
63566
63677
  const sectionPlanesState = scene._sectionPlanesState;
63567
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63678
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63568
63679
  const src = [];
63569
63680
  src.push("#version 300 es");
63570
63681
  src.push("// Batched geometry depth fragment shader");
@@ -63590,7 +63701,7 @@ class TrianglesInstancingPickDepthRenderer extends VBOSceneModelTriangleInstanci
63590
63701
  if (clipping) {
63591
63702
  src.push("in vec4 vWorldPosition;");
63592
63703
  src.push("in float vFlags;");
63593
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63704
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63594
63705
  src.push("uniform bool sectionPlaneActive" + i + ";");
63595
63706
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63596
63707
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63610,7 +63721,7 @@ class TrianglesInstancingPickDepthRenderer extends VBOSceneModelTriangleInstanci
63610
63721
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63611
63722
  src.push(" if (clippable) {");
63612
63723
  src.push(" float dist = 0.0;");
63613
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63724
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63614
63725
  src.push("if (sectionPlaneActive" + i + ") {");
63615
63726
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63616
63727
  src.push("}");
@@ -63636,7 +63747,7 @@ class TrianglesInstancingPickNormalsRenderer extends VBOSceneModelTriangleInstan
63636
63747
  _buildVertexShader() {
63637
63748
  const scene = this._scene;
63638
63749
  const sectionPlanesState = scene._sectionPlanesState;
63639
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63750
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63640
63751
  const src = [];
63641
63752
  src.push("#version 300 es");
63642
63753
  src.push("// Instancing geometry normals vertex shader");
@@ -63717,7 +63828,7 @@ class TrianglesInstancingPickNormalsRenderer extends VBOSceneModelTriangleInstan
63717
63828
  _buildFragmentShader() {
63718
63829
  const scene = this._scene;
63719
63830
  const sectionPlanesState = scene._sectionPlanesState;
63720
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63831
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63721
63832
  const src = [];
63722
63833
  src.push("#version 300 es");
63723
63834
  src.push("// Batched geometry normals fragment shader");
@@ -63741,7 +63852,7 @@ class TrianglesInstancingPickNormalsRenderer extends VBOSceneModelTriangleInstan
63741
63852
  if (clipping) {
63742
63853
  src.push("in vec4 vWorldPosition;");
63743
63854
  src.push("in float vFlags;");
63744
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63855
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63745
63856
  src.push("uniform bool sectionPlaneActive" + i + ";");
63746
63857
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63747
63858
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63754,7 +63865,7 @@ class TrianglesInstancingPickNormalsRenderer extends VBOSceneModelTriangleInstan
63754
63865
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63755
63866
  src.push(" if (clippable) {");
63756
63867
  src.push(" float dist = 0.0;");
63757
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63868
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63758
63869
  src.push("if (sectionPlaneActive" + i + ") {");
63759
63870
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63760
63871
  src.push("}");
@@ -63779,7 +63890,7 @@ class TrianglesInstancingOcclusionRenderer extends VBOSceneModelTriangleInstanci
63779
63890
  _buildVertexShader() {
63780
63891
  const scene = this._scene;
63781
63892
  const sectionPlanesState = scene._sectionPlanesState;
63782
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63893
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63783
63894
  const src = [];
63784
63895
  src.push("#version 300 es");
63785
63896
  src.push("// TrianglesInstancingOcclusionRenderer vertex shader");
@@ -63830,7 +63941,7 @@ class TrianglesInstancingOcclusionRenderer extends VBOSceneModelTriangleInstanci
63830
63941
  _buildFragmentShader() {
63831
63942
  const scene = this._scene;
63832
63943
  const sectionPlanesState = scene._sectionPlanesState;
63833
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63944
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63834
63945
  const src = [];
63835
63946
  src.push("#version 300 es");
63836
63947
  src.push("// TrianglesInstancingOcclusionRenderer fragment shader");
@@ -63845,7 +63956,7 @@ class TrianglesInstancingOcclusionRenderer extends VBOSceneModelTriangleInstanci
63845
63956
  if (clipping) {
63846
63957
  src.push("in vec4 vWorldPosition;");
63847
63958
  src.push("in float vFlags;");
63848
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63959
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63849
63960
  src.push("uniform bool sectionPlaneActive" + i + ";");
63850
63961
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63851
63962
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63857,7 +63968,7 @@ class TrianglesInstancingOcclusionRenderer extends VBOSceneModelTriangleInstanci
63857
63968
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63858
63969
  src.push(" if (clippable) {");
63859
63970
  src.push(" float dist = 0.0;");
63860
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63971
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63861
63972
  src.push("if (sectionPlaneActive" + i + ") {");
63862
63973
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63863
63974
  src.push("}");
@@ -63879,7 +63990,7 @@ class TrianglesInstancingDepthRenderer extends VBOSceneModelTriangleInstancingRe
63879
63990
  _buildVertexShader() {
63880
63991
  const scene = this._scene;
63881
63992
  const sectionPlanesState = scene._sectionPlanesState;
63882
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63993
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63883
63994
  const src = [];
63884
63995
  src.push("#version 300 es");
63885
63996
  src.push("// Instancing geometry depth drawing vertex shader");
@@ -63947,7 +64058,7 @@ class TrianglesInstancingDepthRenderer extends VBOSceneModelTriangleInstancingRe
63947
64058
  const sectionPlanesState = scene._sectionPlanesState;
63948
64059
  let i;
63949
64060
  let len;
63950
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64061
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63951
64062
  const src = [];
63952
64063
  src.push("#version 300 es");
63953
64064
  src.push("// Instancing geometry depth drawing fragment shader");
@@ -63962,7 +64073,7 @@ class TrianglesInstancingDepthRenderer extends VBOSceneModelTriangleInstancingRe
63962
64073
  if (clipping) {
63963
64074
  src.push("in vec4 vWorldPosition;");
63964
64075
  src.push("in float vFlags;");
63965
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64076
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63966
64077
  src.push("uniform bool sectionPlaneActive" + i + ";");
63967
64078
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63968
64079
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63975,7 +64086,7 @@ class TrianglesInstancingDepthRenderer extends VBOSceneModelTriangleInstancingRe
63975
64086
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63976
64087
  src.push(" if (clippable) {");
63977
64088
  src.push(" float dist = 0.0;");
63978
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64089
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63979
64090
  src.push("if (sectionPlaneActive" + i + ") {");
63980
64091
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63981
64092
  src.push("}");
@@ -64001,7 +64112,7 @@ class TrianglesInstancingNormalsRenderer extends VBOSceneModelTriangleInstancing
64001
64112
  _buildVertexShader() {
64002
64113
  const scene = this._scene;
64003
64114
  const sectionPlanesState = scene._sectionPlanesState;
64004
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64115
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64005
64116
  const src = [];
64006
64117
  src.push("#version 300 es");
64007
64118
  src.push("// Instancing geometry normals drawing vertex shader");
@@ -64077,7 +64188,7 @@ class TrianglesInstancingNormalsRenderer extends VBOSceneModelTriangleInstancing
64077
64188
  _buildFragmentShader() {
64078
64189
  const scene = this._scene;
64079
64190
  const sectionPlanesState = scene._sectionPlanesState;
64080
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64191
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64081
64192
  const src = [];
64082
64193
  src.push("#version 300 es");
64083
64194
  src.push("// Instancing geometry depth drawing fragment shader");
@@ -64097,7 +64208,7 @@ class TrianglesInstancingNormalsRenderer extends VBOSceneModelTriangleInstancing
64097
64208
  if (clipping) {
64098
64209
  src.push("in vec4 vWorldPosition;");
64099
64210
  src.push("in float vFlags;");
64100
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64211
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
64101
64212
  src.push("uniform bool sectionPlaneActive" + i + ";");
64102
64213
  src.push("uniform vec3 sectionPlanePos" + i + ";");
64103
64214
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -64113,7 +64224,7 @@ class TrianglesInstancingNormalsRenderer extends VBOSceneModelTriangleInstancing
64113
64224
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
64114
64225
  src.push(" if (clippable) {");
64115
64226
  src.push(" float dist = 0.0;");
64116
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64227
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
64117
64228
  src.push("if (sectionPlaneActive" + i + ") {");
64118
64229
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
64119
64230
  src.push("}");
@@ -64140,7 +64251,7 @@ class TrianglesInstancingShadowRenderer extends VBOSceneModelTriangleInstancingR
64140
64251
  _buildVertexShader() {
64141
64252
  const scene = this._scene;
64142
64253
  const sectionPlanesState = scene._sectionPlanesState;
64143
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64254
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64144
64255
  const src = [];
64145
64256
  src.push("#version 300 es");
64146
64257
  src.push("// Instancing geometry shadow drawing vertex shader");
@@ -64189,7 +64300,7 @@ class TrianglesInstancingShadowRenderer extends VBOSceneModelTriangleInstancingR
64189
64300
  _buildFragmentShader() {
64190
64301
  const scene = this._scene;
64191
64302
  const sectionPlanesState = scene._sectionPlanesState;
64192
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64303
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64193
64304
  const src = [];
64194
64305
  src.push("#version 300 es");
64195
64306
  src.push("// Instancing geometry depth drawing fragment shader");
@@ -64208,7 +64319,7 @@ class TrianglesInstancingShadowRenderer extends VBOSceneModelTriangleInstancingR
64208
64319
  if (clipping) {
64209
64320
  src.push("in vec4 vWorldPosition;");
64210
64321
  src.push("in float vFlags;");
64211
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64322
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
64212
64323
  src.push("uniform bool sectionPlaneActive" + i + ";");
64213
64324
  src.push("uniform vec3 sectionPlanePos" + i + ";");
64214
64325
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -64224,7 +64335,7 @@ class TrianglesInstancingShadowRenderer extends VBOSceneModelTriangleInstancingR
64224
64335
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
64225
64336
  src.push(" if (clippable) {");
64226
64337
  src.push(" float dist = 0.0;");
64227
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64338
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
64228
64339
  src.push("if (sectionPlaneActive" + i + ") {");
64229
64340
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
64230
64341
  src.push("}");
@@ -64263,7 +64374,7 @@ class TrianglesInstancingPBRRenderer extends VBOSceneModelTriangleInstancingRend
64263
64374
  const scene = this._scene;
64264
64375
  const sectionPlanesState = scene._sectionPlanesState;
64265
64376
  const lightsState = scene._lightsState;
64266
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64377
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64267
64378
  const clippingCaps = sectionPlanesState.clippingCaps;
64268
64379
  const src = [];
64269
64380
  src.push("#version 300 es");
@@ -64389,7 +64500,7 @@ class TrianglesInstancingPBRRenderer extends VBOSceneModelTriangleInstancingRend
64389
64500
  const gammaOutput = scene.gammaOutput; // If set, then it expects that all textures and colors need to be outputted in premultiplied gamma. Default is false.
64390
64501
  const sectionPlanesState = scene._sectionPlanesState;
64391
64502
  const lightsState = scene._lightsState;
64392
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64503
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64393
64504
  const clippingCaps = sectionPlanesState.clippingCaps;
64394
64505
  const src = [];
64395
64506
  src.push("#version 300 es");
@@ -64479,7 +64590,7 @@ class TrianglesInstancingPBRRenderer extends VBOSceneModelTriangleInstancingRend
64479
64590
  if (clippingCaps) {
64480
64591
  src.push("in vec4 vClipPosition;");
64481
64592
  }
64482
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64593
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
64483
64594
  src.push("uniform bool sectionPlaneActive" + i + ";");
64484
64595
  src.push("uniform vec3 sectionPlanePos" + i + ";");
64485
64596
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -64668,7 +64779,7 @@ class TrianglesInstancingPBRRenderer extends VBOSceneModelTriangleInstancingRend
64668
64779
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
64669
64780
  src.push(" if (clippable) {");
64670
64781
  src.push(" float dist = 0.0;");
64671
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64782
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
64672
64783
  src.push("if (sectionPlaneActive" + i + ") {");
64673
64784
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
64674
64785
  src.push("}");
@@ -64808,7 +64919,7 @@ class TrianglesInstancingPickNormalsFlatRenderer extends VBOSceneModelTriangleIn
64808
64919
  _buildVertexShader() {
64809
64920
  const scene = this._scene;
64810
64921
  const sectionPlanesState = scene._sectionPlanesState;
64811
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64922
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64812
64923
  const src = [];
64813
64924
  src.push("#version 300 es");
64814
64925
  src.push("// Instancing geometry normals vertex shader");
@@ -64875,7 +64986,7 @@ class TrianglesInstancingPickNormalsFlatRenderer extends VBOSceneModelTriangleIn
64875
64986
  _buildFragmentShader() {
64876
64987
  const scene = this._scene;
64877
64988
  const sectionPlanesState = scene._sectionPlanesState;
64878
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64989
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64879
64990
  const src = [];
64880
64991
  src.push("#version 300 es");
64881
64992
  src.push("// Batched geometry normals fragment shader");
@@ -64896,7 +65007,7 @@ class TrianglesInstancingPickNormalsFlatRenderer extends VBOSceneModelTriangleIn
64896
65007
  src.push("in vec4 vWorldPosition;");
64897
65008
  if (clipping) {
64898
65009
  src.push("in float vFlags;");
64899
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
65010
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
64900
65011
  src.push("uniform bool sectionPlaneActive" + i + ";");
64901
65012
  src.push("uniform vec3 sectionPlanePos" + i + ";");
64902
65013
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -64908,7 +65019,7 @@ class TrianglesInstancingPickNormalsFlatRenderer extends VBOSceneModelTriangleIn
64908
65019
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
64909
65020
  src.push(" if (clippable) {");
64910
65021
  src.push(" float dist = 0.0;");
64911
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
65022
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
64912
65023
  src.push("if (sectionPlaneActive" + i + ") {");
64913
65024
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
64914
65025
  src.push("}");
@@ -64944,7 +65055,7 @@ class TrianglesInstancingColorTextureRenderer extends VBOSceneModelTriangleInsta
64944
65055
  _buildVertexShader() {
64945
65056
  const scene = this._scene;
64946
65057
  const sectionPlanesState = scene._sectionPlanesState;
64947
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
65058
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64948
65059
  const src = [];
64949
65060
  src.push("#version 300 es");
64950
65061
  src.push("// Instancing geometry drawing vertex shader");
@@ -65031,7 +65142,7 @@ class TrianglesInstancingColorTextureRenderer extends VBOSceneModelTriangleInsta
65031
65142
  const lightsState = scene._lightsState;
65032
65143
  let i;
65033
65144
  let len;
65034
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
65145
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
65035
65146
  const src = [];
65036
65147
  src.push("#version 300 es");
65037
65148
  src.push("// Instancing geometry drawing fragment shader");
@@ -65080,7 +65191,7 @@ class TrianglesInstancingColorTextureRenderer extends VBOSceneModelTriangleInsta
65080
65191
  if (clipping) {
65081
65192
  src.push("in vec4 vWorldPosition;");
65082
65193
  src.push("in float vFlags;");
65083
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
65194
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
65084
65195
  src.push("uniform bool sectionPlaneActive" + i + ";");
65085
65196
  src.push("uniform vec3 sectionPlanePos" + i + ";");
65086
65197
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -65118,7 +65229,7 @@ class TrianglesInstancingColorTextureRenderer extends VBOSceneModelTriangleInsta
65118
65229
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
65119
65230
  src.push(" if (clippable) {");
65120
65231
  src.push(" float dist = 0.0;");
65121
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
65232
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
65122
65233
  src.push("if (sectionPlaneActive" + i + ") {");
65123
65234
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
65124
65235
  src.push("}");
@@ -65530,7 +65641,7 @@ function getInstancingRenderers$1(scene) {
65530
65641
  const tempVec3a$o = math.vec3();
65531
65642
  const tempVec3b$k = math.vec3();
65532
65643
  const tempVec3c$h = math.vec3();
65533
- const tempVec3d$d = math.vec3();
65644
+ const tempVec3d$5 = math.vec3();
65534
65645
  const tempMat4a$e = math.mat4();
65535
65646
 
65536
65647
  /**
@@ -65599,7 +65710,7 @@ class SnapInstancingDepthBufInitRenderer extends VBOSceneModelRenderer {
65599
65710
  rtcOrigin[1] += position[1];
65600
65711
  rtcOrigin[2] += position[2];
65601
65712
  rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a$e);
65602
- rtcCameraEye = tempVec3d$d;
65713
+ rtcCameraEye = tempVec3d$5;
65603
65714
  rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];
65604
65715
  rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];
65605
65716
  rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];
@@ -65699,7 +65810,7 @@ class SnapInstancingDepthBufInitRenderer extends VBOSceneModelRenderer {
65699
65810
  _buildVertexShader() {
65700
65811
  const scene = this._scene;
65701
65812
  const sectionPlanesState = scene._sectionPlanesState;
65702
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
65813
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
65703
65814
  const src = [];
65704
65815
  src.push ('#version 300 es');
65705
65816
  src.push("// SnapInstancingDepthBufInitRenderer vertex shader");
@@ -65789,7 +65900,7 @@ class SnapInstancingDepthBufInitRenderer extends VBOSceneModelRenderer {
65789
65900
  _buildFragmentShader() {
65790
65901
  const scene = this._scene;
65791
65902
  const sectionPlanesState = scene._sectionPlanesState;
65792
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
65903
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
65793
65904
  const src = [];
65794
65905
  src.push ('#version 300 es');
65795
65906
  src.push("// Points instancing pick depth fragment shader");
@@ -65811,7 +65922,7 @@ class SnapInstancingDepthBufInitRenderer extends VBOSceneModelRenderer {
65811
65922
  src.push("flat in vec4 vPickColor;");
65812
65923
  if (clipping) {
65813
65924
  src.push("in float vFlags;");
65814
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
65925
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
65815
65926
  src.push("uniform bool sectionPlaneActive" + i + ";");
65816
65927
  src.push("uniform vec3 sectionPlanePos" + i + ";");
65817
65928
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -65826,7 +65937,7 @@ class SnapInstancingDepthBufInitRenderer extends VBOSceneModelRenderer {
65826
65937
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
65827
65938
  src.push(" if (clippable) {");
65828
65939
  src.push(" float dist = 0.0;");
65829
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
65940
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
65830
65941
  src.push("if (sectionPlaneActive" + i + ") {");
65831
65942
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
65832
65943
  src.push("}");
@@ -65866,7 +65977,7 @@ class SnapInstancingDepthBufInitRenderer extends VBOSceneModelRenderer {
65866
65977
  const tempVec3a$n = math.vec3();
65867
65978
  const tempVec3b$j = math.vec3();
65868
65979
  const tempVec3c$g = math.vec3();
65869
- const tempVec3d$c = math.vec3();
65980
+ const tempVec3d$4 = math.vec3();
65870
65981
  const tempMat4a$d = math.mat4();
65871
65982
 
65872
65983
  /**
@@ -65936,7 +66047,7 @@ class SnapInstancingDepthRenderer extends VBOSceneModelRenderer {
65936
66047
  rtcOrigin[1] += position[1];
65937
66048
  rtcOrigin[2] += position[2];
65938
66049
  rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a$d);
65939
- rtcCameraEye = tempVec3d$c;
66050
+ rtcCameraEye = tempVec3d$4;
65940
66051
  rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];
65941
66052
  rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];
65942
66053
  rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];
@@ -66033,7 +66144,7 @@ class SnapInstancingDepthRenderer extends VBOSceneModelRenderer {
66033
66144
  _buildVertexShader() {
66034
66145
  const scene = this._scene;
66035
66146
  const sectionPlanesState = scene._sectionPlanesState;
66036
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
66147
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
66037
66148
  const src = [];
66038
66149
  src.push ('#version 300 es');
66039
66150
  src.push("// SnapInstancingDepthRenderer vertex shader");
@@ -66121,7 +66232,7 @@ class SnapInstancingDepthRenderer extends VBOSceneModelRenderer {
66121
66232
  _buildFragmentShader() {
66122
66233
  const scene = this._scene;
66123
66234
  const sectionPlanesState = scene._sectionPlanesState;
66124
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
66235
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
66125
66236
  const src = [];
66126
66237
  src.push ('#version 300 es');
66127
66238
  src.push("// SnapInstancingDepthRenderer fragment shader");
@@ -66142,7 +66253,7 @@ class SnapInstancingDepthRenderer extends VBOSceneModelRenderer {
66142
66253
  if (clipping) {
66143
66254
  src.push("in vec4 vWorldPosition;");
66144
66255
  src.push("in float vFlags;");
66145
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
66256
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
66146
66257
  src.push("uniform bool sectionPlaneActive" + i + ";");
66147
66258
  src.push("uniform vec3 sectionPlanePos" + i + ";");
66148
66259
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -66155,7 +66266,7 @@ class SnapInstancingDepthRenderer extends VBOSceneModelRenderer {
66155
66266
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
66156
66267
  src.push(" if (clippable) {");
66157
66268
  src.push(" float dist = 0.0;");
66158
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
66269
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
66159
66270
  src.push("if (sectionPlaneActive" + i + ") {");
66160
66271
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
66161
66272
  src.push("}");
@@ -66276,8 +66387,8 @@ const tempVec3fa$2 = new Float32Array(3);
66276
66387
  const tempVec3a$m = math.vec3();
66277
66388
  const tempVec3b$i = math.vec3();
66278
66389
  const tempVec3c$f = math.vec3();
66279
- const tempVec3d$b = math.vec3();
66280
- const tempVec3e$2 = math.vec3();
66390
+ const tempVec3d$3 = math.vec3();
66391
+ const tempVec3e = math.vec3();
66281
66392
  const tempVec3f = math.vec3();
66282
66393
  const tempVec3g = math.vec3();
66283
66394
 
@@ -67353,8 +67464,8 @@ class TrianglesInstancingLayer {
67353
67464
 
67354
67465
  math.transformRay(portion.inverseMatrix, rtcRayOrigin, rtcRayDir, rtcRayOrigin, rtcRayDir);
67355
67466
 
67356
- const a = tempVec3d$b;
67357
- const b = tempVec3e$2;
67467
+ const a = tempVec3d$3;
67468
+ const b = tempVec3e;
67358
67469
  const c = tempVec3f;
67359
67470
 
67360
67471
  let gotIntersect = false;
@@ -67484,7 +67595,7 @@ class LinesBatchingColorRenderer extends VBOSceneModelLineBatchingRenderer {
67484
67595
  _buildVertexShader() {
67485
67596
  const scene = this._scene;
67486
67597
  const sectionPlanesState = scene._sectionPlanesState;
67487
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
67598
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
67488
67599
  const src = [];
67489
67600
  src.push('#version 300 es');
67490
67601
  src.push("// Lines batching color vertex shader");
@@ -67537,7 +67648,7 @@ class LinesBatchingColorRenderer extends VBOSceneModelLineBatchingRenderer {
67537
67648
  _buildFragmentShader() {
67538
67649
  const scene = this._scene;
67539
67650
  const sectionPlanesState = scene._sectionPlanesState;
67540
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
67651
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
67541
67652
  const src = [];
67542
67653
  src.push('#version 300 es');
67543
67654
  src.push("// Lines batching color fragment shader");
@@ -67555,7 +67666,7 @@ class LinesBatchingColorRenderer extends VBOSceneModelLineBatchingRenderer {
67555
67666
  if (clipping) {
67556
67667
  src.push("in vec4 vWorldPosition;");
67557
67668
  src.push("in float vFlags;");
67558
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
67669
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
67559
67670
  src.push("uniform bool sectionPlaneActive" + i + ";");
67560
67671
  src.push("uniform vec3 sectionPlanePos" + i + ";");
67561
67672
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -67568,7 +67679,7 @@ class LinesBatchingColorRenderer extends VBOSceneModelLineBatchingRenderer {
67568
67679
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
67569
67680
  src.push(" if (clippable) {");
67570
67681
  src.push(" float dist = 0.0;");
67571
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
67682
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
67572
67683
  src.push("if (sectionPlaneActive" + i + ") {");
67573
67684
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
67574
67685
  src.push("}");
@@ -67598,7 +67709,7 @@ class LinesBatchingSilhouetteRenderer extends VBOSceneModelLineBatchingRenderer
67598
67709
 
67599
67710
  const scene = this._scene;
67600
67711
  const sectionPlanesState = scene._sectionPlanesState;
67601
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
67712
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
67602
67713
 
67603
67714
  const src = [];
67604
67715
  src.push('#version 300 es');
@@ -67659,7 +67770,7 @@ class LinesBatchingSilhouetteRenderer extends VBOSceneModelLineBatchingRenderer
67659
67770
 
67660
67771
  const scene = this._scene;
67661
67772
  const sectionPlanesState = scene._sectionPlanesState;
67662
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
67773
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
67663
67774
  const src = [];
67664
67775
  src.push('#version 300 es');
67665
67776
  src.push("// Lines batching silhouette fragment shader");
@@ -67678,7 +67789,7 @@ class LinesBatchingSilhouetteRenderer extends VBOSceneModelLineBatchingRenderer
67678
67789
  if (clipping) {
67679
67790
  src.push("in vec4 vWorldPosition;");
67680
67791
  src.push("in float vFlags;");
67681
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
67792
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
67682
67793
  src.push("uniform bool sectionPlaneActive" + i + ";");
67683
67794
  src.push("uniform vec3 sectionPlanePos" + i + ";");
67684
67795
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -67691,7 +67802,7 @@ class LinesBatchingSilhouetteRenderer extends VBOSceneModelLineBatchingRenderer
67691
67802
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
67692
67803
  src.push(" if (clippable) {");
67693
67804
  src.push(" float dist = 0.0;");
67694
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
67805
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
67695
67806
  src.push("if (sectionPlaneActive" + i + ") {");
67696
67807
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
67697
67808
  src.push("}");
@@ -68539,7 +68650,7 @@ class LinesInstancingColorRenderer extends VBOSceneModelLineInstancingRenderer {
68539
68650
  _buildVertexShader() {
68540
68651
  const scene = this._scene;
68541
68652
  const sectionPlanesState = scene._sectionPlanesState;
68542
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
68653
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
68543
68654
  const src = [];
68544
68655
  src.push('#version 300 es');
68545
68656
  src.push("// Lines instancing color vertex shader");
@@ -68612,7 +68723,7 @@ class LinesInstancingColorRenderer extends VBOSceneModelLineInstancingRenderer {
68612
68723
  const sectionPlanesState = scene._sectionPlanesState;
68613
68724
  let i;
68614
68725
  let len;
68615
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
68726
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
68616
68727
  const src = [];
68617
68728
  src.push('#version 300 es');
68618
68729
  src.push("// Lines instancing color fragment shader");
@@ -68630,7 +68741,7 @@ class LinesInstancingColorRenderer extends VBOSceneModelLineInstancingRenderer {
68630
68741
  if (clipping) {
68631
68742
  src.push("in vec4 vWorldPosition;");
68632
68743
  src.push("in float vFlags;");
68633
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
68744
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
68634
68745
  src.push("uniform bool sectionPlaneActive" + i + ";");
68635
68746
  src.push("uniform vec3 sectionPlanePos" + i + ";");
68636
68747
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -68643,7 +68754,7 @@ class LinesInstancingColorRenderer extends VBOSceneModelLineInstancingRenderer {
68643
68754
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
68644
68755
  src.push(" if (clippable) {");
68645
68756
  src.push(" float dist = 0.0;");
68646
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
68757
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
68647
68758
  src.push("if (sectionPlaneActive" + i + ") {");
68648
68759
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
68649
68760
  src.push("}");
@@ -68686,7 +68797,7 @@ class LinesInstancingSilhouetteRenderer extends VBOSceneModelLineInstancingRende
68686
68797
  _buildVertexShader() {
68687
68798
  const scene = this._scene;
68688
68799
  const sectionPlanesState = scene._sectionPlanesState;
68689
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
68800
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
68690
68801
  const src = [];
68691
68802
  src.push('#version 300 es');
68692
68803
  src.push("// Lines instancing silhouette vertex shader");
@@ -68751,7 +68862,7 @@ class LinesInstancingSilhouetteRenderer extends VBOSceneModelLineInstancingRende
68751
68862
  _buildFragmentShader() {
68752
68863
  const scene = this._scene;
68753
68864
  const sectionPlanesState = scene._sectionPlanesState;
68754
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
68865
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
68755
68866
  const src = [];
68756
68867
  src.push('#version 300 es');
68757
68868
  src.push("// Lines instancing silhouette fragment shader");
@@ -68769,7 +68880,7 @@ class LinesInstancingSilhouetteRenderer extends VBOSceneModelLineInstancingRende
68769
68880
  if (clipping) {
68770
68881
  src.push("in vec4 vWorldPosition;");
68771
68882
  src.push("in float vFlags;");
68772
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
68883
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
68773
68884
  src.push("uniform bool sectionPlaneActive" + i + ";");
68774
68885
  src.push("uniform vec3 sectionPlanePos" + i + ";");
68775
68886
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -68782,7 +68893,7 @@ class LinesInstancingSilhouetteRenderer extends VBOSceneModelLineInstancingRende
68782
68893
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
68783
68894
  src.push(" if (clippable) {");
68784
68895
  src.push(" float dist = 0.0;");
68785
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
68896
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
68786
68897
  src.push("if (sectionPlaneActive" + i + ") {");
68787
68898
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
68788
68899
  src.push("}");
@@ -69561,7 +69672,7 @@ class PointsBatchingColorRenderer extends VBOSceneModelPointBatchingRenderer {
69561
69672
 
69562
69673
  const scene = this._scene;
69563
69674
  const sectionPlanesState = scene._sectionPlanesState;
69564
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
69675
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
69565
69676
  const pointsMaterial = scene.pointsMaterial;
69566
69677
  const src = [];
69567
69678
  src.push('#version 300 es');
@@ -69654,7 +69765,7 @@ class PointsBatchingColorRenderer extends VBOSceneModelPointBatchingRenderer {
69654
69765
 
69655
69766
  const scene = this._scene;
69656
69767
  const sectionPlanesState = scene._sectionPlanesState;
69657
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
69768
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
69658
69769
  const src = [];
69659
69770
  src.push('#version 300 es');
69660
69771
  src.push("// Points batching color fragment shader");
@@ -69673,7 +69784,7 @@ class PointsBatchingColorRenderer extends VBOSceneModelPointBatchingRenderer {
69673
69784
  if (clipping) {
69674
69785
  src.push("in vec4 vWorldPosition;");
69675
69786
  src.push("in float vFlags;");
69676
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
69787
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
69677
69788
  src.push("uniform bool sectionPlaneActive" + i + ";");
69678
69789
  src.push("uniform vec3 sectionPlanePos" + i + ";");
69679
69790
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -69693,7 +69804,7 @@ class PointsBatchingColorRenderer extends VBOSceneModelPointBatchingRenderer {
69693
69804
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
69694
69805
  src.push(" if (clippable) {");
69695
69806
  src.push(" float dist = 0.0;");
69696
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
69807
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
69697
69808
  src.push("if (sectionPlaneActive" + i + ") {");
69698
69809
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
69699
69810
  src.push("}");
@@ -69726,7 +69837,7 @@ class PointsBatchingSilhouetteRenderer extends VBOSceneModelPointBatchingRendere
69726
69837
 
69727
69838
  const scene = this._scene;
69728
69839
  const sectionPlanesState = scene._sectionPlanesState;
69729
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
69840
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
69730
69841
  const pointsMaterial = scene.pointsMaterial._state;
69731
69842
  const src = [];
69732
69843
  src.push ('#version 300 es');
@@ -69799,7 +69910,7 @@ class PointsBatchingSilhouetteRenderer extends VBOSceneModelPointBatchingRendere
69799
69910
  const sectionPlanesState = scene._sectionPlanesState;
69800
69911
  let i;
69801
69912
  let len;
69802
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
69913
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
69803
69914
  const src = [];
69804
69915
  src.push ('#version 300 es');
69805
69916
  src.push("// Points batching silhouette vertex shader");
@@ -69817,7 +69928,7 @@ class PointsBatchingSilhouetteRenderer extends VBOSceneModelPointBatchingRendere
69817
69928
  if (clipping) {
69818
69929
  src.push("in vec4 vWorldPosition;");
69819
69930
  src.push("in float vFlags;");
69820
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
69931
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
69821
69932
  src.push("uniform bool sectionPlaneActive" + i + ";");
69822
69933
  src.push("uniform vec3 sectionPlanePos" + i + ";");
69823
69934
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -69837,7 +69948,7 @@ class PointsBatchingSilhouetteRenderer extends VBOSceneModelPointBatchingRendere
69837
69948
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
69838
69949
  src.push(" if (clippable) {");
69839
69950
  src.push(" float dist = 0.0;");
69840
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
69951
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
69841
69952
  src.push("if (sectionPlaneActive" + i + ") {");
69842
69953
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
69843
69954
  src.push("}");
@@ -69865,7 +69976,7 @@ class PointsBatchingPickMeshRenderer extends VBOSceneModelPointBatchingRenderer
69865
69976
  _buildVertexShader() {
69866
69977
 
69867
69978
  const scene = this._scene;
69868
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
69979
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
69869
69980
  const pointsMaterial = scene.pointsMaterial._state;
69870
69981
  const src = [];
69871
69982
  src.push ('#version 300 es');
@@ -69944,7 +70055,7 @@ class PointsBatchingPickMeshRenderer extends VBOSceneModelPointBatchingRenderer
69944
70055
  _buildFragmentShader() {
69945
70056
  const scene = this._scene;
69946
70057
  const sectionPlanesState = scene._sectionPlanesState;
69947
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
70058
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
69948
70059
  const src = [];
69949
70060
  src.push ('#version 300 es');
69950
70061
  src.push("// Points batching pick mesh vertex shader");
@@ -69962,7 +70073,7 @@ class PointsBatchingPickMeshRenderer extends VBOSceneModelPointBatchingRenderer
69962
70073
  if (clipping) {
69963
70074
  src.push("in vec4 vWorldPosition;");
69964
70075
  src.push("in float vFlags;");
69965
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
70076
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
69966
70077
  src.push("uniform bool sectionPlaneActive" + i + ";");
69967
70078
  src.push("uniform vec3 sectionPlanePos" + i + ";");
69968
70079
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -69982,7 +70093,7 @@ class PointsBatchingPickMeshRenderer extends VBOSceneModelPointBatchingRenderer
69982
70093
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
69983
70094
  src.push(" if (clippable) {");
69984
70095
  src.push(" float dist = 0.0;");
69985
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
70096
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
69986
70097
  src.push(" if (sectionPlaneActive" + i + ") {");
69987
70098
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
69988
70099
  src.push(" }");
@@ -70009,7 +70120,7 @@ class PointsBatchingPickDepthRenderer extends VBOSceneModelPointBatchingRenderer
70009
70120
 
70010
70121
  _buildVertexShader() {
70011
70122
  const scene = this._scene;
70012
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
70123
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
70013
70124
  const pointsMaterial = scene.pointsMaterial._state;
70014
70125
  const src = [];
70015
70126
  src.push ('#version 300 es');
@@ -70083,7 +70194,7 @@ class PointsBatchingPickDepthRenderer extends VBOSceneModelPointBatchingRenderer
70083
70194
  _buildFragmentShader() {
70084
70195
  const scene = this._scene;
70085
70196
  const sectionPlanesState = scene._sectionPlanesState;
70086
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
70197
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
70087
70198
  const src = [];
70088
70199
  src.push ('#version 300 es');
70089
70200
  src.push("// Points batched pick depth fragment shader");
@@ -70107,7 +70218,7 @@ class PointsBatchingPickDepthRenderer extends VBOSceneModelPointBatchingRenderer
70107
70218
  if (clipping) {
70108
70219
  src.push("in vec4 vWorldPosition;");
70109
70220
  src.push("in float vFlags;");
70110
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
70221
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
70111
70222
  src.push("uniform bool sectionPlaneActive" + i + ";");
70112
70223
  src.push("uniform vec3 sectionPlanePos" + i + ";");
70113
70224
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -70134,7 +70245,7 @@ class PointsBatchingPickDepthRenderer extends VBOSceneModelPointBatchingRenderer
70134
70245
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
70135
70246
  src.push(" if (clippable) {");
70136
70247
  src.push(" float dist = 0.0;");
70137
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
70248
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
70138
70249
  src.push(" if (sectionPlaneActive" + i + ") {");
70139
70250
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
70140
70251
  src.push(" }");
@@ -70162,7 +70273,7 @@ class PointsBatchingOcclusionRenderer extends VBOSceneModelPointBatchingRenderer
70162
70273
 
70163
70274
  _buildVertexShader() {
70164
70275
  const scene = this._scene;
70165
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
70276
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
70166
70277
  const pointsMaterial = scene.pointsMaterial._state;
70167
70278
  const src = [];
70168
70279
  src.push ('#version 300 es');
@@ -70230,7 +70341,7 @@ class PointsBatchingOcclusionRenderer extends VBOSceneModelPointBatchingRenderer
70230
70341
  _buildFragmentShader() {
70231
70342
  const scene = this._scene;
70232
70343
  const sectionPlanesState = scene._sectionPlanesState;
70233
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
70344
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
70234
70345
  const src = [];
70235
70346
  src.push ('#version 300 es');
70236
70347
  src.push("// Points batching occlusion fragment shader");
@@ -70248,7 +70359,7 @@ class PointsBatchingOcclusionRenderer extends VBOSceneModelPointBatchingRenderer
70248
70359
  if (clipping) {
70249
70360
  src.push("in vec4 vWorldPosition;");
70250
70361
  src.push("in float vFlags;");
70251
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
70362
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
70252
70363
  src.push("uniform bool sectionPlaneActive" + i + ";");
70253
70364
  src.push("uniform vec3 sectionPlanePos" + i + ";");
70254
70365
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -70267,7 +70378,7 @@ class PointsBatchingOcclusionRenderer extends VBOSceneModelPointBatchingRenderer
70267
70378
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
70268
70379
  src.push(" if (clippable) {");
70269
70380
  src.push(" float dist = 0.0;");
70270
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
70381
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
70271
70382
  src.push(" if (sectionPlaneActive" + i + ") {");
70272
70383
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
70273
70384
  src.push(" }");
@@ -71170,7 +71281,7 @@ class PointsInstancingColorRenderer extends VBOSceneModelPointInstancingRenderer
71170
71281
  _buildVertexShader() {
71171
71282
  const scene = this._scene;
71172
71283
  const sectionPlanesState = scene._sectionPlanesState;
71173
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71284
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71174
71285
  const pointsMaterial = scene.pointsMaterial._state;
71175
71286
  const src = [];
71176
71287
  src.push('#version 300 es');
@@ -71270,7 +71381,7 @@ class PointsInstancingColorRenderer extends VBOSceneModelPointInstancingRenderer
71270
71381
  _buildFragmentShader() {
71271
71382
  const scene = this._scene;
71272
71383
  const sectionPlanesState = scene._sectionPlanesState;
71273
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71384
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71274
71385
  const src = [];
71275
71386
  src.push('#version 300 es');
71276
71387
  src.push("// Points instancing color fragment shader");
@@ -71289,7 +71400,7 @@ class PointsInstancingColorRenderer extends VBOSceneModelPointInstancingRenderer
71289
71400
  if (clipping) {
71290
71401
  src.push("in vec4 vWorldPosition;");
71291
71402
  src.push("in float vFlags;");
71292
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
71403
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
71293
71404
  src.push("uniform bool sectionPlaneActive" + i + ";");
71294
71405
  src.push("uniform vec3 sectionPlanePos" + i + ";");
71295
71406
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -71309,7 +71420,7 @@ class PointsInstancingColorRenderer extends VBOSceneModelPointInstancingRenderer
71309
71420
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
71310
71421
  src.push(" if (clippable) {");
71311
71422
  src.push(" float dist = 0.0;");
71312
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
71423
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
71313
71424
  src.push("if (sectionPlaneActive" + i + ") {");
71314
71425
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
71315
71426
  src.push("}");
@@ -71342,7 +71453,7 @@ class PointsInstancingSilhouetteRenderer extends VBOSceneModelPointInstancingRen
71342
71453
 
71343
71454
  const scene = this._scene;
71344
71455
  const sectionPlanesState = scene._sectionPlanesState;
71345
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71456
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71346
71457
  const pointsMaterial = scene.pointsMaterial._state;
71347
71458
  const src = [];
71348
71459
  src.push ('#version 300 es');
@@ -71424,7 +71535,7 @@ class PointsInstancingSilhouetteRenderer extends VBOSceneModelPointInstancingRen
71424
71535
  _buildFragmentShader() {
71425
71536
  const scene = this._scene;
71426
71537
  const sectionPlanesState = scene._sectionPlanesState;
71427
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71538
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71428
71539
  const src = [];
71429
71540
  src.push ('#version 300 es');
71430
71541
  src.push("// Points instancing silhouette fragment shader");
@@ -71442,7 +71553,7 @@ class PointsInstancingSilhouetteRenderer extends VBOSceneModelPointInstancingRen
71442
71553
  if (clipping) {
71443
71554
  src.push("in vec4 vWorldPosition;");
71444
71555
  src.push("in float vFlags;");
71445
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
71556
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
71446
71557
  src.push("uniform bool sectionPlaneActive" + i + ";");
71447
71558
  src.push("uniform vec3 sectionPlanePos" + i + ";");
71448
71559
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -71462,7 +71573,7 @@ class PointsInstancingSilhouetteRenderer extends VBOSceneModelPointInstancingRen
71462
71573
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
71463
71574
  src.push(" if (clippable) {");
71464
71575
  src.push(" float dist = 0.0;");
71465
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
71576
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
71466
71577
  src.push("if (sectionPlaneActive" + i + ") {");
71467
71578
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
71468
71579
  src.push("}");
@@ -71490,7 +71601,7 @@ class PointsInstancingPickMeshRenderer extends VBOSceneModelPointInstancingRende
71490
71601
  _buildVertexShader() {
71491
71602
  const scene = this._scene;
71492
71603
  const sectionPlanesState = scene._sectionPlanesState;
71493
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71604
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71494
71605
  const pointsMaterial = scene.pointsMaterial._state;
71495
71606
  const src = [];
71496
71607
  src.push ('#version 300 es');
@@ -71573,7 +71684,7 @@ class PointsInstancingPickMeshRenderer extends VBOSceneModelPointInstancingRende
71573
71684
  _buildFragmentShader() {
71574
71685
  const scene = this._scene;
71575
71686
  const sectionPlanesState = scene._sectionPlanesState;
71576
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71687
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71577
71688
  const src = [];
71578
71689
  src.push ('#version 300 es');
71579
71690
  src.push("// Points instancing pick mesh fragment shader");
@@ -71591,7 +71702,7 @@ class PointsInstancingPickMeshRenderer extends VBOSceneModelPointInstancingRende
71591
71702
  if (clipping) {
71592
71703
  src.push("in vec4 vWorldPosition;");
71593
71704
  src.push("in float vFlags;");
71594
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
71705
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
71595
71706
  src.push("uniform bool sectionPlaneActive" + i + ";");
71596
71707
  src.push("uniform vec3 sectionPlanePos" + i + ";");
71597
71708
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -71613,7 +71724,7 @@ class PointsInstancingPickMeshRenderer extends VBOSceneModelPointInstancingRende
71613
71724
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
71614
71725
  src.push(" if (clippable) {");
71615
71726
  src.push(" float dist = 0.0;");
71616
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
71727
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
71617
71728
  src.push("if (sectionPlaneActive" + i + ") {");
71618
71729
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
71619
71730
  src.push("}");
@@ -71641,7 +71752,7 @@ class PointsInstancingPickDepthRenderer extends VBOSceneModelPointInstancingRend
71641
71752
  _buildVertexShader() {
71642
71753
  const scene = this._scene;
71643
71754
  const sectionPlanesState = scene._sectionPlanesState;
71644
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71755
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71645
71756
  const pointsMaterial = scene.pointsMaterial._state;
71646
71757
  const src = [];
71647
71758
 
@@ -71726,7 +71837,7 @@ class PointsInstancingPickDepthRenderer extends VBOSceneModelPointInstancingRend
71726
71837
  _buildFragmentShader() {
71727
71838
  const scene = this._scene;
71728
71839
  const sectionPlanesState = scene._sectionPlanesState;
71729
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71840
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71730
71841
  const src = [];
71731
71842
  src.push ('#version 300 es');
71732
71843
  src.push("// Points instancing pick depth fragment shader");
@@ -71750,7 +71861,7 @@ class PointsInstancingPickDepthRenderer extends VBOSceneModelPointInstancingRend
71750
71861
  if (clipping) {
71751
71862
  src.push("in vec4 vWorldPosition;");
71752
71863
  src.push("in float vFlags;");
71753
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
71864
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
71754
71865
  src.push("uniform bool sectionPlaneActive" + i + ";");
71755
71866
  src.push("uniform vec3 sectionPlanePos" + i + ";");
71756
71867
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -71779,7 +71890,7 @@ class PointsInstancingPickDepthRenderer extends VBOSceneModelPointInstancingRend
71779
71890
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
71780
71891
  src.push(" if (clippable) {");
71781
71892
  src.push(" float dist = 0.0;");
71782
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
71893
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
71783
71894
  src.push("if (sectionPlaneActive" + i + ") {");
71784
71895
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
71785
71896
  src.push("}");
@@ -71809,7 +71920,7 @@ class PointsInstancingOcclusionRenderer extends VBOSceneModelPointInstancingRend
71809
71920
 
71810
71921
  const scene = this._scene;
71811
71922
  const sectionPlanesState = scene._sectionPlanesState;
71812
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71923
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71813
71924
  const pointsMaterial = scene.pointsMaterial._state;
71814
71925
  const src = [];
71815
71926
 
@@ -71891,7 +72002,7 @@ class PointsInstancingOcclusionRenderer extends VBOSceneModelPointInstancingRend
71891
72002
  _buildFragmentShader() {
71892
72003
  const scene = this._scene;
71893
72004
  const sectionPlanesState = scene._sectionPlanesState;
71894
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
72005
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71895
72006
  const src = [];
71896
72007
  src.push ('#version 300 es');
71897
72008
  src.push("// Points instancing occlusion vertex shader");
@@ -71909,7 +72020,7 @@ class PointsInstancingOcclusionRenderer extends VBOSceneModelPointInstancingRend
71909
72020
  if (clipping) {
71910
72021
  src.push("in vec4 vWorldPosition;");
71911
72022
  src.push("in float vFlags;");
71912
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
72023
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
71913
72024
  src.push("uniform bool sectionPlaneActive" + i + ";");
71914
72025
  src.push("uniform vec3 sectionPlanePos" + i + ";");
71915
72026
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -71928,7 +72039,7 @@ class PointsInstancingOcclusionRenderer extends VBOSceneModelPointInstancingRend
71928
72039
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
71929
72040
  src.push(" if (clippable) {");
71930
72041
  src.push(" float dist = 0.0;");
71931
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
72042
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
71932
72043
  src.push("if (sectionPlaneActive" + i + ") {");
71933
72044
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
71934
72045
  src.push("}");
@@ -71956,7 +72067,7 @@ class PointsInstancingDepthRenderer extends VBOSceneModelPointInstancingRenderer
71956
72067
  _buildVertexShader() {
71957
72068
  const scene = this._scene;
71958
72069
  const sectionPlanesState = scene._sectionPlanesState;
71959
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
72070
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71960
72071
  const pointsMaterial = scene.pointsMaterial._state;
71961
72072
  const src = [];
71962
72073
  src.push('#version 300 es');
@@ -72029,7 +72140,7 @@ class PointsInstancingDepthRenderer extends VBOSceneModelPointInstancingRenderer
72029
72140
  const sectionPlanesState = scene._sectionPlanesState;
72030
72141
  let i;
72031
72142
  let len;
72032
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
72143
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
72033
72144
  const src = [];
72034
72145
  src.push('#version 300 es');
72035
72146
  src.push("// Points instancing depth vertex shader");
@@ -72047,7 +72158,7 @@ class PointsInstancingDepthRenderer extends VBOSceneModelPointInstancingRenderer
72047
72158
  if (clipping) {
72048
72159
  src.push("in vec4 vWorldPosition;");
72049
72160
  src.push("in float vFlags;");
72050
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
72161
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
72051
72162
  src.push("uniform bool sectionPlaneActive" + i + ";");
72052
72163
  src.push("uniform vec3 sectionPlanePos" + i + ";");
72053
72164
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -72081,7 +72192,7 @@ class PointsInstancingDepthRenderer extends VBOSceneModelPointInstancingRenderer
72081
72192
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
72082
72193
  src.push(" if (clippable) {");
72083
72194
  src.push(" float dist = 0.0;");
72084
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
72195
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
72085
72196
  src.push("if (sectionPlaneActive" + i + ") {");
72086
72197
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
72087
72198
  src.push("}");
@@ -72108,7 +72219,7 @@ class PointsInstancingShadowRenderer extends VBOSceneModelPointInstancingRendere
72108
72219
  _buildVertexShader() {
72109
72220
  const scene = this._scene;
72110
72221
  const sectionPlanesState = scene._sectionPlanesState;
72111
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
72222
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
72112
72223
  const src = [];
72113
72224
  src.push ('#version 300 es');
72114
72225
  src.push("// Instancing geometry shadow drawing vertex shader");
@@ -72159,7 +72270,7 @@ class PointsInstancingShadowRenderer extends VBOSceneModelPointInstancingRendere
72159
72270
  _buildFragmentShader() {
72160
72271
  const scene = this._scene;
72161
72272
  const sectionPlanesState = scene._sectionPlanesState;
72162
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
72273
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
72163
72274
  const src = [];
72164
72275
  src.push ('#version 300 es');
72165
72276
  src.push("// Instancing geometry depth drawing fragment shader");
@@ -72178,7 +72289,7 @@ class PointsInstancingShadowRenderer extends VBOSceneModelPointInstancingRendere
72178
72289
  if (clipping) {
72179
72290
  src.push("in vec4 vWorldPosition;");
72180
72291
  src.push("in float vFlags;");
72181
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
72292
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
72182
72293
  src.push("uniform bool sectionPlaneActive" + i + ";");
72183
72294
  src.push("uniform vec3 sectionPlanePos" + i + ";");
72184
72295
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -72199,7 +72310,7 @@ class PointsInstancingShadowRenderer extends VBOSceneModelPointInstancingRendere
72199
72310
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
72200
72311
  src.push(" if (clippable) {");
72201
72312
  src.push(" float dist = 0.0;");
72202
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
72313
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
72203
72314
  src.push("if (sectionPlaneActive" + i + ") {");
72204
72315
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
72205
72316
  src.push("}");
@@ -74656,7 +74767,7 @@ function doCheckResult(buckets, mesh) {
74656
74767
  const tempVec3a$k = math.vec3();
74657
74768
  const tempVec3b$g = math.vec3();
74658
74769
  const tempVec3c$e = math.vec3();
74659
- const tempVec3d$a = math.vec3();
74770
+ math.vec3();
74660
74771
 
74661
74772
  const tempVec4a$6 = math.vec4();
74662
74773
 
@@ -74755,25 +74866,30 @@ class TrianglesDataTextureColorRenderer {
74755
74866
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
74756
74867
  }
74757
74868
 
74869
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
74758
74870
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
74759
- if (numSectionPlanes > 0) {
74871
+ if (numAllocatedSectionPlanes > 0) {
74760
74872
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
74761
74873
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
74762
74874
  const renderFlags = model.renderFlags;
74763
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
74875
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
74764
74876
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
74765
74877
  if (sectionPlaneUniforms) {
74766
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
74767
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
74768
- if (active) {
74769
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
74770
- if (origin) {
74771
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3d$a);
74772
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
74773
- } else {
74774
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
74878
+ if (sectionPlaneIndex < numSectionPlanes) {
74879
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
74880
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
74881
+ if (active) {
74882
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
74883
+ if (origin) {
74884
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$k);
74885
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
74886
+ } else {
74887
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
74888
+ }
74889
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
74775
74890
  }
74776
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
74891
+ } else {
74892
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
74777
74893
  }
74778
74894
  }
74779
74895
  }
@@ -74868,7 +74984,7 @@ class TrianglesDataTextureColorRenderer {
74868
74984
 
74869
74985
  this._uSectionPlanes = [];
74870
74986
 
74871
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
74987
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
74872
74988
  this._uSectionPlanes.push({
74873
74989
  active: program.getLocation("sectionPlaneActive" + i),
74874
74990
  pos: program.getLocation("sectionPlanePos" + i),
@@ -74958,7 +75074,7 @@ class TrianglesDataTextureColorRenderer {
74958
75074
  const scene = this._scene;
74959
75075
  const sectionPlanesState = scene._sectionPlanesState;
74960
75076
  const lightsState = scene._lightsState;
74961
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
75077
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
74962
75078
  let light;
74963
75079
  const src = [];
74964
75080
  src.push("#version 300 es");
@@ -75169,7 +75285,7 @@ class TrianglesDataTextureColorRenderer {
75169
75285
  _buildFragmentShader() {
75170
75286
  const scene = this._scene;
75171
75287
  const sectionPlanesState = scene._sectionPlanesState;
75172
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
75288
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
75173
75289
  const src = [];
75174
75290
  src.push('#version 300 es');
75175
75291
  src.push("// TrianglesDataTextureColorRenderer fragment shader");
@@ -75203,7 +75319,7 @@ class TrianglesDataTextureColorRenderer {
75203
75319
  if (clipping) {
75204
75320
  src.push("in vec4 vWorldPosition;");
75205
75321
  src.push("flat in uint vFlags2;");
75206
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
75322
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
75207
75323
  src.push("uniform bool sectionPlaneActive" + i + ";");
75208
75324
  src.push("uniform vec3 sectionPlanePos" + i + ";");
75209
75325
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -75217,7 +75333,7 @@ class TrianglesDataTextureColorRenderer {
75217
75333
  src.push(" bool clippable = vFlags2 > 0u;");
75218
75334
  src.push(" if (clippable) {");
75219
75335
  src.push(" float dist = 0.0;");
75220
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
75336
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
75221
75337
  src.push("if (sectionPlaneActive" + i + ") {");
75222
75338
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
75223
75339
  src.push("}");
@@ -75268,7 +75384,7 @@ const defaultColor$1 = new Float32Array([1, 1, 1]);
75268
75384
  const tempVec3a$j = math.vec3();
75269
75385
  const tempVec3b$f = math.vec3();
75270
75386
  const tempVec3c$d = math.vec3();
75271
- const tempVec3d$9 = math.vec3();
75387
+ math.vec3();
75272
75388
  const tempMat4a$b = math.mat4();
75273
75389
 
75274
75390
  /**
@@ -75383,25 +75499,30 @@ class TrianglesDataTextureSilhouetteRenderer {
75383
75499
  const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2);
75384
75500
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
75385
75501
  }
75502
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
75386
75503
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
75387
- if (numSectionPlanes > 0) {
75504
+ if (numAllocatedSectionPlanes > 0) {
75388
75505
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
75389
75506
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
75390
75507
  const renderFlags = model.renderFlags;
75391
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
75508
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
75392
75509
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
75393
75510
  if (sectionPlaneUniforms) {
75394
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
75395
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
75396
- if (active) {
75397
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
75398
- if (origin) {
75399
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3d$9);
75400
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
75401
- } else {
75402
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
75511
+ if (sectionPlaneIndex < numSectionPlanes) {
75512
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
75513
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
75514
+ if (active) {
75515
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
75516
+ if (origin) {
75517
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$j);
75518
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
75519
+ } else {
75520
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
75521
+ }
75522
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
75403
75523
  }
75404
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
75524
+ } else {
75525
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
75405
75526
  }
75406
75527
  }
75407
75528
  }
@@ -75458,7 +75579,7 @@ class TrianglesDataTextureSilhouetteRenderer {
75458
75579
  this._uViewMatrix = program.getLocation("viewMatrix");
75459
75580
  this._uProjMatrix = program.getLocation("projMatrix");
75460
75581
  this._uSectionPlanes = [];
75461
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
75582
+ for (let i = 0, len = scene.getMaxSectionPlanes(); i < len; i++) {
75462
75583
  this._uSectionPlanes.push({
75463
75584
  active: program.getLocation("sectionPlaneActive" + i),
75464
75585
  pos: program.getLocation("sectionPlanePos" + i),
@@ -75503,8 +75624,7 @@ class TrianglesDataTextureSilhouetteRenderer {
75503
75624
  _buildVertexShader() {
75504
75625
 
75505
75626
  const scene = this._scene;
75506
- const sectionPlanesState = scene._sectionPlanesState;
75507
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
75627
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
75508
75628
 
75509
75629
  const src = [];
75510
75630
  src.push("#version 300 es");
@@ -75658,8 +75778,7 @@ class TrianglesDataTextureSilhouetteRenderer {
75658
75778
 
75659
75779
  _buildFragmentShader() {
75660
75780
  const scene = this._scene;
75661
- const sectionPlanesState = scene._sectionPlanesState;
75662
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
75781
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
75663
75782
  const src = [];
75664
75783
  src.push('#version 300 es');
75665
75784
  src.push("// Triangles dataTexture draw fragment shader");
@@ -75678,7 +75797,7 @@ class TrianglesDataTextureSilhouetteRenderer {
75678
75797
  if (clipping) {
75679
75798
  src.push("in vec4 vWorldPosition;");
75680
75799
  src.push("flat in uint vFlags2;");
75681
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
75800
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
75682
75801
  src.push("uniform bool sectionPlaneActive" + i + ";");
75683
75802
  src.push("uniform vec3 sectionPlanePos" + i + ";");
75684
75803
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -75691,7 +75810,7 @@ class TrianglesDataTextureSilhouetteRenderer {
75691
75810
  src.push(" bool clippable = vFlags2 > 0u;");
75692
75811
  src.push(" if (clippable) {");
75693
75812
  src.push(" float dist = 0.0;");
75694
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
75813
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
75695
75814
  src.push("if (sectionPlaneActive" + i + ") {");
75696
75815
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
75697
75816
  src.push("}");
@@ -75725,7 +75844,7 @@ const defaultColor = new Float32Array([0, 0, 0, 1]);
75725
75844
 
75726
75845
  const tempVec3a$i = math.vec3();
75727
75846
  const tempVec3b$e = math.vec3();
75728
- const tempVec3d$8 = math.vec3();
75847
+ math.vec3();
75729
75848
  const tempMat4a$a = math.mat4();
75730
75849
 
75731
75850
  /**
@@ -75830,25 +75949,30 @@ class TrianglesDataTextureEdgesRenderer {
75830
75949
  gl.uniform4fv(this._uColor, defaultColor);
75831
75950
  }
75832
75951
 
75952
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
75833
75953
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
75834
- if (numSectionPlanes > 0) {
75954
+ if (numAllocatedSectionPlanes > 0) {
75835
75955
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
75836
75956
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
75837
75957
  const renderFlags = model.renderFlags;
75838
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
75958
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
75839
75959
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
75840
75960
  if (sectionPlaneUniforms) {
75841
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
75842
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
75843
- if (active) {
75844
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
75845
- if (origin) {
75846
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3d$8);
75847
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
75848
- } else {
75849
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
75961
+ if (sectionPlaneIndex < numSectionPlanes) {
75962
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
75963
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
75964
+ if (active) {
75965
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
75966
+ if (origin) {
75967
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$i);
75968
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
75969
+ } else {
75970
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
75971
+ }
75972
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
75850
75973
  }
75851
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
75974
+ } else {
75975
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
75852
75976
  }
75853
75977
  }
75854
75978
  }
@@ -75906,7 +76030,7 @@ class TrianglesDataTextureEdgesRenderer {
75906
76030
  this._uViewMatrix = program.getLocation("viewMatrix");
75907
76031
  this._uProjMatrix = program.getLocation("projMatrix");
75908
76032
  this._uSectionPlanes = [];
75909
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
76033
+ for (let i = 0, len = scene.getMaxSectionPlanes(); i < len; i++) {
75910
76034
  this._uSectionPlanes.push({
75911
76035
  active: program.getLocation("sectionPlaneActive" + i),
75912
76036
  pos: program.getLocation("sectionPlanePos" + i),
@@ -75945,8 +76069,7 @@ class TrianglesDataTextureEdgesRenderer {
75945
76069
 
75946
76070
  _buildVertexShader() {
75947
76071
  const scene = this._scene;
75948
- const sectionPlanesState = scene._sectionPlanesState;
75949
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
76072
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
75950
76073
  const src = [];
75951
76074
  src.push("#version 300 es");
75952
76075
  src.push("// Batched geometry edges drawing vertex shader");
@@ -76073,8 +76196,7 @@ class TrianglesDataTextureEdgesRenderer {
76073
76196
 
76074
76197
  _buildFragmentShader() {
76075
76198
  const scene = this._scene;
76076
- const sectionPlanesState = scene._sectionPlanesState;
76077
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
76199
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
76078
76200
  const src = [];
76079
76201
  src.push('#version 300 es');
76080
76202
  src.push("// Batched geometry edges drawing fragment shader");
@@ -76096,7 +76218,7 @@ class TrianglesDataTextureEdgesRenderer {
76096
76218
  if (clipping) {
76097
76219
  src.push("in vec4 vWorldPosition;");
76098
76220
  src.push("flat in uint vFlags2;");
76099
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
76221
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
76100
76222
  src.push("uniform bool sectionPlaneActive" + i + ";");
76101
76223
  src.push("uniform vec3 sectionPlanePos" + i + ";");
76102
76224
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -76109,7 +76231,7 @@ class TrianglesDataTextureEdgesRenderer {
76109
76231
  src.push(" bool clippable = vFlags2 > 0u;");
76110
76232
  src.push(" if (clippable) {");
76111
76233
  src.push(" float dist = 0.0;");
76112
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
76234
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
76113
76235
  src.push("if (sectionPlaneActive" + i + ") {");
76114
76236
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
76115
76237
  src.push("}");
@@ -76221,7 +76343,7 @@ class TrianglesDataTextureEdgesColorRenderer {
76221
76343
  gl.uniformMatrix4fv(this._uViewMatrix, false, rtcViewMatrix);
76222
76344
  gl.uniformMatrix4fv(this._uProjMatrix, false, camera.projMatrix);
76223
76345
 
76224
- const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
76346
+ const numSectionPlanes = scene.getMaxSectionPlanes();
76225
76347
  if (numSectionPlanes > 0) {
76226
76348
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
76227
76349
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
@@ -76301,7 +76423,7 @@ class TrianglesDataTextureEdgesColorRenderer {
76301
76423
  this._uProjMatrix = program.getLocation("projMatrix");
76302
76424
  this._uSectionPlanes = [];
76303
76425
 
76304
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
76426
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
76305
76427
  this._uSectionPlanes.push({
76306
76428
  active: program.getLocation("sectionPlaneActive" + i),
76307
76429
  pos: program.getLocation("sectionPlanePos" + i),
@@ -76347,8 +76469,7 @@ class TrianglesDataTextureEdgesColorRenderer {
76347
76469
 
76348
76470
  _buildVertexShader() {
76349
76471
  const scene = this._scene;
76350
- const sectionPlanesState = scene._sectionPlanesState;
76351
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
76472
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
76352
76473
  const src = [];
76353
76474
  src.push("#version 300 es");
76354
76475
  src.push("// TrianglesDataTextureEdgesColorRenderer");
@@ -76483,8 +76604,7 @@ class TrianglesDataTextureEdgesColorRenderer {
76483
76604
 
76484
76605
  _buildFragmentShader() {
76485
76606
  const scene = this._scene;
76486
- const sectionPlanesState = scene._sectionPlanesState;
76487
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
76607
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
76488
76608
  const src = [];
76489
76609
  src.push('#version 300 es');
76490
76610
  src.push("// TrianglesDataTextureEdgesColorRenderer");
@@ -76503,7 +76623,7 @@ class TrianglesDataTextureEdgesColorRenderer {
76503
76623
  if (clipping) {
76504
76624
  src.push("in vec4 vWorldPosition;");
76505
76625
  src.push("flat in uint vFlags2;");
76506
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
76626
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
76507
76627
  src.push("uniform bool sectionPlaneActive" + i + ";");
76508
76628
  src.push("uniform vec3 sectionPlanePos" + i + ";");
76509
76629
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -76516,7 +76636,7 @@ class TrianglesDataTextureEdgesColorRenderer {
76516
76636
  src.push(" bool clippable = vFlags2 > 0u;");
76517
76637
  src.push(" if (clippable) {");
76518
76638
  src.push(" float dist = 0.0;");
76519
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
76639
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
76520
76640
  src.push("if (sectionPlaneActive" + i + ") {");
76521
76641
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
76522
76642
  src.push("}");
@@ -76525,8 +76645,7 @@ class TrianglesDataTextureEdgesColorRenderer {
76525
76645
  src.push("}");
76526
76646
  }
76527
76647
  if (scene.logarithmicDepthBufferEnabled) {
76528
- // src.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;");
76529
- src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");
76648
+ src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");
76530
76649
  }
76531
76650
  src.push(" outColor = vColor;");
76532
76651
  src.push("}");
@@ -76634,25 +76753,30 @@ class TrianglesDataTexturePickMeshRenderer {
76634
76753
  const logDepthBufFC = 2.0 / (Math.log(camera.project.far + 1.0) / Math.LN2); // TODO: Far from pick project matrix?
76635
76754
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
76636
76755
  }
76756
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
76637
76757
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
76638
- if (numSectionPlanes > 0) {
76758
+ if (numAllocatedSectionPlanes > 0) {
76639
76759
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
76640
76760
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
76641
76761
  const renderFlags = model.renderFlags;
76642
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
76762
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
76643
76763
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
76644
76764
  if (sectionPlaneUniforms) {
76645
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
76646
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
76647
- if (active) {
76648
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
76649
- if (origin) {
76650
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$g);
76651
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
76652
- } else {
76653
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
76765
+ if (sectionPlaneIndex < numSectionPlanes) {
76766
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
76767
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
76768
+ if (active) {
76769
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
76770
+ if (origin) {
76771
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$g);
76772
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
76773
+ } else {
76774
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
76775
+ }
76776
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
76654
76777
  }
76655
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
76778
+ } else {
76779
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
76656
76780
  }
76657
76781
  }
76658
76782
  }
@@ -76660,8 +76784,8 @@ class TrianglesDataTexturePickMeshRenderer {
76660
76784
  if (state.numIndices8Bits > 0) {
76661
76785
  textureState.bindTriangleIndicesTextures(
76662
76786
  this._program,
76663
- this._uTexturePerPolygonIdPortionIds,
76664
- this._uTexturePerPolygonIdIndices,
76787
+ this._uTexturePerPolygonIdPortionIds,
76788
+ this._uTexturePerPolygonIdIndices,
76665
76789
  8 // 8 bits indices
76666
76790
  );
76667
76791
  gl.drawArrays(gl.TRIANGLES, 0, state.numIndices8Bits);
@@ -76669,8 +76793,8 @@ class TrianglesDataTexturePickMeshRenderer {
76669
76793
  if (state.numIndices16Bits > 0) {
76670
76794
  textureState.bindTriangleIndicesTextures(
76671
76795
  this._program,
76672
- this._uTexturePerPolygonIdPortionIds,
76673
- this._uTexturePerPolygonIdIndices,
76796
+ this._uTexturePerPolygonIdPortionIds,
76797
+ this._uTexturePerPolygonIdIndices,
76674
76798
  16 // 16 bits indices
76675
76799
  );
76676
76800
  gl.drawArrays(gl.TRIANGLES, 0, state.numIndices16Bits);
@@ -76678,8 +76802,8 @@ class TrianglesDataTexturePickMeshRenderer {
76678
76802
  if (state.numIndices32Bits > 0) {
76679
76803
  textureState.bindTriangleIndicesTextures(
76680
76804
  this._program,
76681
- this._uTexturePerPolygonIdPortionIds,
76682
- this._uTexturePerPolygonIdIndices,
76805
+ this._uTexturePerPolygonIdPortionIds,
76806
+ this._uTexturePerPolygonIdIndices,
76683
76807
  32 // 32 bits indices
76684
76808
  );
76685
76809
  gl.drawArrays(gl.TRIANGLES, 0, state.numIndices32Bits);
@@ -76704,7 +76828,7 @@ class TrianglesDataTexturePickMeshRenderer {
76704
76828
  this._uViewMatrix = program.getLocation("viewMatrix");
76705
76829
  this._uProjMatrix = program.getLocation("projMatrix");
76706
76830
  this._uSectionPlanes = [];
76707
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
76831
+ for (let i = 0, len = scene.getMaxSectionPlanes(); i < len; i++) {
76708
76832
  this._uSectionPlanes.push({
76709
76833
  active: program.getLocation("sectionPlaneActive" + i),
76710
76834
  pos: program.getLocation("sectionPlanePos" + i),
@@ -76714,14 +76838,14 @@ class TrianglesDataTexturePickMeshRenderer {
76714
76838
  if (scene.logarithmicDepthBufferEnabled) {
76715
76839
  this._uLogDepthBufFC = program.getLocation("logDepthBufFC");
76716
76840
  }
76717
- this.uTexturePerObjectPositionsDecodeMatrix = "uObjectPerObjectPositionsDecodeMatrix";
76718
- this.uTexturePerObjectColorsAndFlags = "uObjectPerObjectColorsAndFlags";
76719
- this._uTexturePerVertexIdCoordinates = "uTexturePerVertexIdCoordinates";
76720
- this._uTexturePerPolygonIdNormals = "uTexturePerPolygonIdNormals";
76721
- this._uTexturePerPolygonIdIndices = "uTexturePerPolygonIdIndices";
76841
+ this.uTexturePerObjectPositionsDecodeMatrix = "uObjectPerObjectPositionsDecodeMatrix";
76842
+ this.uTexturePerObjectColorsAndFlags = "uObjectPerObjectColorsAndFlags";
76843
+ this._uTexturePerVertexIdCoordinates = "uTexturePerVertexIdCoordinates";
76844
+ this._uTexturePerPolygonIdNormals = "uTexturePerPolygonIdNormals";
76845
+ this._uTexturePerPolygonIdIndices = "uTexturePerPolygonIdIndices";
76722
76846
  this._uTexturePerPolygonIdPortionIds = "uTexturePerPolygonIdPortionIds";
76723
- this._uTexturePerObjectMatrix= "uTexturePerObjectMatrix";
76724
- this._uCameraEyeRtc = program.getLocation("uCameraEyeRtc");
76847
+ this._uTexturePerObjectMatrix = "uTexturePerObjectMatrix";
76848
+ this._uCameraEyeRtc = program.getLocation("uCameraEyeRtc");
76725
76849
  }
76726
76850
 
76727
76851
  _bindProgram(frameCtx) {
@@ -76740,7 +76864,7 @@ class TrianglesDataTexturePickMeshRenderer {
76740
76864
 
76741
76865
  _buildVertexShader() {
76742
76866
  const scene = this._scene;
76743
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
76867
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
76744
76868
  const src = [];
76745
76869
  src.push("#version 300 es");
76746
76870
  src.push("// Batched geometry picking vertex shader");
@@ -76775,10 +76899,10 @@ class TrianglesDataTexturePickMeshRenderer {
76775
76899
  src.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;");
76776
76900
  src.push("uniform highp sampler2D uTexturePerObjectMatrix;");
76777
76901
  src.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;");
76778
- src.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;");
76779
- src.push("uniform highp usampler2D uTexturePerPolygonIdIndices;");
76902
+ src.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;");
76903
+ src.push("uniform highp usampler2D uTexturePerPolygonIdIndices;");
76780
76904
  src.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;");
76781
- src.push("uniform vec3 uCameraEyeRtc;");
76905
+ src.push("uniform vec3 uCameraEyeRtc;");
76782
76906
 
76783
76907
  src.push("vec3 positions[3];");
76784
76908
 
@@ -76821,9 +76945,9 @@ class TrianglesDataTexturePickMeshRenderer {
76821
76945
  src.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);");
76822
76946
 
76823
76947
  // get flags & flags2
76824
- src.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);");
76825
- src.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);");
76826
-
76948
+ src.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);");
76949
+ src.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);");
76950
+
76827
76951
  // flags.w = NOT_RENDERED | PICK
76828
76952
  // renderPass = PICK
76829
76953
 
@@ -76833,9 +76957,9 @@ class TrianglesDataTexturePickMeshRenderer {
76833
76957
  src.push("} else {");
76834
76958
 
76835
76959
  // get vertex base
76836
- src.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));");
76960
+ src.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));");
76837
76961
 
76838
- src.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));");
76962
+ src.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));");
76839
76963
 
76840
76964
  src.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;");
76841
76965
 
@@ -76844,7 +76968,7 @@ class TrianglesDataTexturePickMeshRenderer {
76844
76968
 
76845
76969
  src.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));");
76846
76970
  src.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;");
76847
-
76971
+
76848
76972
  src.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;");
76849
76973
  src.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;");
76850
76974
 
@@ -76852,7 +76976,7 @@ class TrianglesDataTexturePickMeshRenderer {
76852
76976
 
76853
76977
  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));");
76854
76978
 
76855
- src.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;");
76979
+ src.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;");
76856
76980
 
76857
76981
  // get position
76858
76982
  src.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));");
@@ -76860,7 +76984,7 @@ class TrianglesDataTexturePickMeshRenderer {
76860
76984
  src.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));");
76861
76985
 
76862
76986
  // get color
76863
- src.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);");
76987
+ src.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);");
76864
76988
 
76865
76989
  src.push(`if (color.a == 0u) {`);
76866
76990
  src.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"); // Cull vertex
@@ -76878,17 +77002,17 @@ class TrianglesDataTexturePickMeshRenderer {
76878
77002
 
76879
77003
  // when the geometry is not solid, if needed, flip the triangle winding
76880
77004
  src.push("if (solid != 1u) {");
76881
- src.push("if (isPerspectiveMatrix(projMatrix)) {");
76882
- src.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;");
76883
- src.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {");
76884
- src.push("position = positions[2 - (gl_VertexID % 3)];");
76885
- src.push("}");
76886
- src.push("} else {");
76887
- src.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);");
76888
- src.push("if (viewNormal.z < 0.0) {");
76889
- src.push("position = positions[2 - (gl_VertexID % 3)];");
76890
- src.push("}");
76891
- src.push("}");
77005
+ src.push("if (isPerspectiveMatrix(projMatrix)) {");
77006
+ src.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;");
77007
+ src.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {");
77008
+ src.push("position = positions[2 - (gl_VertexID % 3)];");
77009
+ src.push("}");
77010
+ src.push("} else {");
77011
+ src.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);");
77012
+ src.push("if (viewNormal.z < 0.0) {");
77013
+ src.push("position = positions[2 - (gl_VertexID % 3)];");
77014
+ src.push("}");
77015
+ src.push("}");
76892
77016
  src.push("}");
76893
77017
 
76894
77018
  src.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); ");
@@ -76912,10 +77036,9 @@ class TrianglesDataTexturePickMeshRenderer {
76912
77036
 
76913
77037
  _buildFragmentShader() {
76914
77038
  const scene = this._scene;
76915
- const sectionPlanesState = scene._sectionPlanesState;
76916
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
77039
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
76917
77040
  const src = [];
76918
- src.push ('#version 300 es');
77041
+ src.push('#version 300 es');
76919
77042
  src.push("// Batched geometry picking fragment shader");
76920
77043
  src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");
76921
77044
  src.push("precision highp float;");
@@ -76932,7 +77055,7 @@ class TrianglesDataTexturePickMeshRenderer {
76932
77055
  if (clipping) {
76933
77056
  src.push("in vec4 vWorldPosition;");
76934
77057
  src.push("flat in uvec4 vFlags2;");
76935
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
77058
+ for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
76936
77059
  src.push("uniform bool sectionPlaneActive" + i + ";");
76937
77060
  src.push("uniform vec3 sectionPlanePos" + i + ";");
76938
77061
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -76945,7 +77068,7 @@ class TrianglesDataTexturePickMeshRenderer {
76945
77068
  src.push(" bool clippable = (float(vFlags2.x) > 0.0);");
76946
77069
  src.push(" if (clippable) {");
76947
77070
  src.push(" float dist = 0.0;");
76948
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
77071
+ for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
76949
77072
  src.push(" if (sectionPlaneActive" + i + ") {");
76950
77073
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
76951
77074
  src.push(" }");
@@ -76954,7 +77077,7 @@ class TrianglesDataTexturePickMeshRenderer {
76954
77077
  src.push(" }");
76955
77078
  }
76956
77079
  if (scene.logarithmicDepthBufferEnabled) {
76957
- src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");
77080
+ src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");
76958
77081
  //src.push(" gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;");
76959
77082
  }
76960
77083
  src.push(" outPickColor = vPickColor; ");
@@ -76977,7 +77100,7 @@ class TrianglesDataTexturePickMeshRenderer {
76977
77100
  const tempVec3a$f = math.vec3();
76978
77101
  const tempVec3b$b = math.vec3();
76979
77102
  const tempVec3c$a = math.vec3();
76980
- const tempVec3d$7 = math.vec3();
77103
+ math.vec3();
76981
77104
  const tempMat4a$7 = math.mat4();
76982
77105
 
76983
77106
  /**
@@ -77078,25 +77201,30 @@ class TrianglesDataTexturePickDepthRenderer {
77078
77201
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
77079
77202
  }
77080
77203
 
77204
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
77081
77205
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
77082
- if (numSectionPlanes > 0) {
77206
+ if (numAllocatedSectionPlanes > 0) {
77083
77207
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
77084
77208
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
77085
77209
  const renderFlags = model.renderFlags;
77086
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
77210
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
77087
77211
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
77088
77212
  if (sectionPlaneUniforms) {
77089
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
77090
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
77091
- if (active) {
77092
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
77093
- if (origin) {
77094
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3d$7);
77095
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
77096
- } else {
77097
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
77213
+ if (sectionPlaneIndex < numSectionPlanes) {
77214
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
77215
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
77216
+ if (active) {
77217
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
77218
+ if (origin) {
77219
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$f);
77220
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
77221
+ } else {
77222
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
77223
+ }
77224
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
77098
77225
  }
77099
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
77226
+ } else {
77227
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
77100
77228
  }
77101
77229
  }
77102
77230
  }
@@ -77148,7 +77276,7 @@ class TrianglesDataTexturePickDepthRenderer {
77148
77276
  this._uViewMatrix = program.getLocation("viewMatrix");
77149
77277
  this._uProjMatrix = program.getLocation("projMatrix");
77150
77278
  this._uSectionPlanes = [];
77151
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
77279
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
77152
77280
  this._uSectionPlanes.push({
77153
77281
  active: program.getLocation("sectionPlaneActive" + i),
77154
77282
  pos: program.getLocation("sectionPlanePos" + i),
@@ -77184,7 +77312,7 @@ class TrianglesDataTexturePickDepthRenderer {
77184
77312
  _buildVertexShader() {
77185
77313
 
77186
77314
  const scene = this._scene;
77187
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
77315
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
77188
77316
  const src = [];
77189
77317
  src.push("#version 300 es");
77190
77318
  src.push("// Triangles dataTexture pick depth vertex shader");
@@ -77352,8 +77480,7 @@ class TrianglesDataTexturePickDepthRenderer {
77352
77480
  _buildFragmentShader() {
77353
77481
 
77354
77482
  const scene = this._scene;
77355
- const sectionPlanesState = scene._sectionPlanesState;
77356
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
77483
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
77357
77484
  const src = [];
77358
77485
  src.push('#version 300 es');
77359
77486
  src.push("// Triangles dataTexture pick depth fragment shader");
@@ -77378,7 +77505,7 @@ class TrianglesDataTexturePickDepthRenderer {
77378
77505
  if (clipping) {
77379
77506
  src.push("in vec4 vWorldPosition;");
77380
77507
  src.push("flat in uint vFlags2;");
77381
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
77508
+ for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
77382
77509
  src.push("uniform bool sectionPlaneActive" + i + ";");
77383
77510
  src.push("uniform vec3 sectionPlanePos" + i + ";");
77384
77511
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -77399,7 +77526,7 @@ class TrianglesDataTexturePickDepthRenderer {
77399
77526
  src.push(" bool clippable = vFlags2 > 0u;");
77400
77527
  src.push(" if (clippable) {");
77401
77528
  src.push(" float dist = 0.0;");
77402
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
77529
+ for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
77403
77530
  src.push(" if (sectionPlaneActive" + i + ") {");
77404
77531
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
77405
77532
  src.push(" }");
@@ -77431,8 +77558,8 @@ class TrianglesDataTexturePickDepthRenderer {
77431
77558
  const tempVec3a$e = math.vec3();
77432
77559
  const tempVec3b$a = math.vec3();
77433
77560
  const tempVec3c$9 = math.vec3();
77434
- const tempVec3d$6 = math.vec3();
77435
- const tempVec3e$1 = math.vec3();
77561
+ const tempVec3d$2 = math.vec3();
77562
+ math.vec3();
77436
77563
  const tempMat4a$6 = math.mat4();
77437
77564
 
77438
77565
  /**
@@ -77517,7 +77644,7 @@ class TrianglesDataTextureSnapDepthRenderer {
77517
77644
  rtcOrigin[1] += position[1];
77518
77645
  rtcOrigin[2] += position[2];
77519
77646
  rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a$6);
77520
- rtcCameraEye = tempVec3d$6;
77647
+ rtcCameraEye = tempVec3d$2;
77521
77648
  rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];
77522
77649
  rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];
77523
77650
  rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];
@@ -77546,25 +77673,30 @@ class TrianglesDataTextureSnapDepthRenderer {
77546
77673
  const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2);
77547
77674
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
77548
77675
  }
77676
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
77549
77677
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
77550
- if (numSectionPlanes > 0) {
77678
+ if (numAllocatedSectionPlanes > 0) {
77551
77679
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
77552
77680
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
77553
77681
  const renderFlags = model.renderFlags;
77554
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
77682
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
77555
77683
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
77556
77684
  if (sectionPlaneUniforms) {
77557
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
77558
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
77559
- if (active) {
77560
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
77561
- if (origin) {
77562
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3e$1);
77563
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
77564
- } else {
77565
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
77685
+ if (sectionPlaneIndex < numSectionPlanes) {
77686
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
77687
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
77688
+ if (active) {
77689
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
77690
+ if (origin) {
77691
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$e);
77692
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
77693
+ } else {
77694
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
77695
+ }
77696
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
77566
77697
  }
77567
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
77698
+ } else {
77699
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
77568
77700
  }
77569
77701
  }
77570
77702
  }
@@ -77615,7 +77747,7 @@ class TrianglesDataTextureSnapDepthRenderer {
77615
77747
  this._uViewMatrix = program.getLocation("viewMatrix");
77616
77748
  this._uProjMatrix = program.getLocation("projMatrix");
77617
77749
  this._uSectionPlanes = [];
77618
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
77750
+ for (let i = 0, len = scene.getMaxSectionPlanes(); i < len; i++) {
77619
77751
  this._uSectionPlanes.push({
77620
77752
  active: program.getLocation("sectionPlaneActive" + i),
77621
77753
  pos: program.getLocation("sectionPlanePos" + i),
@@ -77652,8 +77784,7 @@ class TrianglesDataTextureSnapDepthRenderer {
77652
77784
 
77653
77785
  _buildVertexShader() {
77654
77786
  const scene = this._scene;
77655
- const sectionPlanesState = scene._sectionPlanesState;
77656
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
77787
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
77657
77788
  const src = [];
77658
77789
  src.push("#version 300 es");
77659
77790
  src.push("// Batched geometry edges drawing vertex shader");
@@ -77784,8 +77915,7 @@ class TrianglesDataTextureSnapDepthRenderer {
77784
77915
  _buildFragmentShader() {
77785
77916
 
77786
77917
  const scene = this._scene;
77787
- const sectionPlanesState = scene._sectionPlanesState;
77788
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
77918
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
77789
77919
  const src = [];
77790
77920
  src.push('#version 300 es');
77791
77921
  src.push("// Triangles dataTexture pick depth fragment shader");
@@ -77806,7 +77936,7 @@ class TrianglesDataTextureSnapDepthRenderer {
77806
77936
  if (clipping) {
77807
77937
  src.push("in vec4 vWorldPosition;");
77808
77938
  src.push("flat in uint vFlags2;");
77809
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
77939
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
77810
77940
  src.push("uniform bool sectionPlaneActive" + i + ";");
77811
77941
  src.push("uniform vec3 sectionPlanePos" + i + ";");
77812
77942
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -77819,7 +77949,7 @@ class TrianglesDataTextureSnapDepthRenderer {
77819
77949
  src.push(" bool clippable = vFlags2 > 0u;");
77820
77950
  src.push(" if (clippable) {");
77821
77951
  src.push(" float dist = 0.0;");
77822
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
77952
+ for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
77823
77953
  src.push(" if (sectionPlaneActive" + i + ") {");
77824
77954
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
77825
77955
  src.push(" }");
@@ -77850,8 +77980,8 @@ class TrianglesDataTextureSnapDepthRenderer {
77850
77980
  const tempVec3a$d = math.vec3();
77851
77981
  const tempVec3b$9 = math.vec3();
77852
77982
  const tempVec3c$8 = math.vec3();
77853
- const tempVec3d$5 = math.vec3();
77854
- const tempVec3e = math.vec3();
77983
+ const tempVec3d$1 = math.vec3();
77984
+ math.vec3();
77855
77985
  const tempMat4a$5 = math.mat4();
77856
77986
  /**
77857
77987
  * @private
@@ -77931,7 +78061,7 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
77931
78061
  rtcOrigin[1] += position[1];
77932
78062
  rtcOrigin[2] += position[2];
77933
78063
  rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a$5);
77934
- rtcCameraEye = tempVec3d$5;
78064
+ rtcCameraEye = tempVec3d$1;
77935
78065
  rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];
77936
78066
  rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];
77937
78067
  rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];
@@ -77960,25 +78090,30 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
77960
78090
  const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2);
77961
78091
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
77962
78092
  }
78093
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
77963
78094
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
77964
- if (numSectionPlanes > 0) {
78095
+ if (numAllocatedSectionPlanes > 0) {
77965
78096
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
77966
78097
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
77967
78098
  const renderFlags = model.renderFlags;
77968
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
78099
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
77969
78100
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
77970
78101
  if (sectionPlaneUniforms) {
77971
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
77972
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
77973
- if (active) {
77974
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
77975
- if (origin) {
77976
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3e);
77977
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
77978
- } else {
77979
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
78102
+ if (sectionPlaneIndex < numSectionPlanes) {
78103
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
78104
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
78105
+ if (active) {
78106
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
78107
+ if (origin) {
78108
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$d);
78109
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
78110
+ } else {
78111
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
78112
+ }
78113
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
77980
78114
  }
77981
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
78115
+ } else {
78116
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
77982
78117
  }
77983
78118
  }
77984
78119
  }
@@ -78028,7 +78163,7 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
78028
78163
  this._uViewMatrix = program.getLocation("viewMatrix");
78029
78164
  this._uProjMatrix = program.getLocation("projMatrix");
78030
78165
  this._uSectionPlanes = [];
78031
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
78166
+ for (let i = 0, len = scene.getMaxSectionPlanes(); i < len; i++) {
78032
78167
  this._uSectionPlanes.push({
78033
78168
  active: program.getLocation("sectionPlaneActive" + i),
78034
78169
  pos: program.getLocation("sectionPlanePos" + i),
@@ -78064,8 +78199,7 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
78064
78199
 
78065
78200
  _buildVertexShader() {
78066
78201
  const scene = this._scene;
78067
- const sectionPlanesState = scene._sectionPlanesState;
78068
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
78202
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
78069
78203
  const src = [];
78070
78204
  src.push("#version 300 es");
78071
78205
  src.push("// TrianglesDataTextureSnapDepthBufInitRenderer vertex shader");
@@ -78227,8 +78361,7 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
78227
78361
 
78228
78362
  _buildFragmentShader() {
78229
78363
  const scene = this._scene;
78230
- const sectionPlanesState = scene._sectionPlanesState;
78231
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
78364
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
78232
78365
  const src = [];
78233
78366
  src.push('#version 300 es');
78234
78367
  src.push("// TrianglesDataTextureSnapDepthBufInitRenderer fragment shader");
@@ -78250,7 +78383,7 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
78250
78383
  src.push("flat in vec4 vPickColor;");
78251
78384
  if (clipping) {
78252
78385
  src.push("flat in uint vFlags2;");
78253
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
78386
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
78254
78387
  src.push("uniform bool sectionPlaneActive" + i + ";");
78255
78388
  src.push("uniform vec3 sectionPlanePos" + i + ";");
78256
78389
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -78265,7 +78398,7 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
78265
78398
  src.push(" bool clippable = vFlags2 > 0u;");
78266
78399
  src.push(" if (clippable) {");
78267
78400
  src.push(" float dist = 0.0;");
78268
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
78401
+ for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
78269
78402
  src.push(" if (sectionPlaneActive" + i + ") {");
78270
78403
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
78271
78404
  src.push(" }");
@@ -78305,7 +78438,7 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
78305
78438
  const tempVec3a$c = math.vec3();
78306
78439
  const tempVec3b$8 = math.vec3();
78307
78440
  const tempVec3c$7 = math.vec3();
78308
- const tempVec3d$4 = math.vec3();
78441
+ math.vec3();
78309
78442
  const tempMat4a$4 = math.mat4();
78310
78443
 
78311
78444
  /**
@@ -78395,25 +78528,30 @@ class TrianglesDataTextureOcclusionRenderer {
78395
78528
 
78396
78529
  gl.uniformMatrix4fv(this._uProjMatrix, false, camera.projMatrix);
78397
78530
 
78531
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
78398
78532
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
78399
- if (numSectionPlanes > 0) {
78533
+ if (numAllocatedSectionPlanes > 0) {
78400
78534
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
78401
78535
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
78402
78536
  const renderFlags = model.renderFlags;
78403
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
78537
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
78404
78538
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
78405
78539
  if (sectionPlaneUniforms) {
78406
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
78407
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
78408
- if (active) {
78409
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
78410
- if (origin) {
78411
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3d$4);
78412
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
78413
- } else {
78414
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
78540
+ if (sectionPlaneIndex < numSectionPlanes) {
78541
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
78542
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
78543
+ if (active) {
78544
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
78545
+ if (origin) {
78546
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$c);
78547
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
78548
+ } else {
78549
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
78550
+ }
78551
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
78415
78552
  }
78416
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
78553
+ } else {
78554
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
78417
78555
  }
78418
78556
  }
78419
78557
  }
@@ -78464,7 +78602,7 @@ class TrianglesDataTextureOcclusionRenderer {
78464
78602
  this._uViewMatrix = program.getLocation("viewMatrix");
78465
78603
  this._uProjMatrix = program.getLocation("projMatrix");
78466
78604
  this._uSectionPlanes = [];
78467
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
78605
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
78468
78606
  this._uSectionPlanes.push({
78469
78607
  active: program.getLocation("sectionPlaneActive" + i),
78470
78608
  pos: program.getLocation("sectionPlanePos" + i),
@@ -78504,7 +78642,7 @@ class TrianglesDataTextureOcclusionRenderer {
78504
78642
 
78505
78643
  _buildVertexShader() {
78506
78644
  const scene = this._scene;
78507
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
78645
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
78508
78646
  const src = [];
78509
78647
  src.push("#version 300 es");
78510
78648
  src.push("// TrianglesDataTextureOcclusionRenderer vertex shader");
@@ -78645,7 +78783,7 @@ class TrianglesDataTextureOcclusionRenderer {
78645
78783
  _buildFragmentShader() {
78646
78784
  const scene = this._scene;
78647
78785
  const sectionPlanesState = scene._sectionPlanesState;
78648
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
78786
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
78649
78787
  const src = [];
78650
78788
  src.push('#version 300 es');
78651
78789
  src.push("// TrianglesDataTextureColorRenderer fragment shader");
@@ -78659,7 +78797,7 @@ class TrianglesDataTextureOcclusionRenderer {
78659
78797
  if (clipping) {
78660
78798
  src.push("in vec4 vWorldPosition;");
78661
78799
  src.push("flat in uint vFlags2;");
78662
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
78800
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
78663
78801
  src.push("uniform bool sectionPlaneActive" + i + ";");
78664
78802
  src.push("uniform vec3 sectionPlanePos" + i + ";");
78665
78803
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -78671,7 +78809,7 @@ class TrianglesDataTextureOcclusionRenderer {
78671
78809
  src.push(" bool clippable = (float(vFlags2) > 0.0);");
78672
78810
  src.push(" if (clippable) {");
78673
78811
  src.push(" float dist = 0.0;");
78674
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
78812
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
78675
78813
  src.push(" if (sectionPlaneActive" + i + ") {");
78676
78814
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
78677
78815
  src.push(" }");
@@ -78699,7 +78837,7 @@ class TrianglesDataTextureOcclusionRenderer {
78699
78837
  const tempVec3a$b = math.vec3();
78700
78838
  const tempVec3b$7 = math.vec3();
78701
78839
  const tempVec3c$6 = math.vec3();
78702
- const tempVec3d$3 = math.vec3();
78840
+ math.vec3();
78703
78841
  const tempMat4a$3 = math.mat4();
78704
78842
 
78705
78843
  /**
@@ -78793,25 +78931,30 @@ class TrianglesDataTextureDepthRenderer {
78793
78931
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
78794
78932
  }
78795
78933
 
78934
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
78796
78935
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
78797
- if (numSectionPlanes > 0) {
78936
+ if (numAllocatedSectionPlanes > 0) {
78798
78937
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
78799
78938
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
78800
78939
  const renderFlags = model.renderFlags;
78801
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
78940
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
78802
78941
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
78803
78942
  if (sectionPlaneUniforms) {
78804
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
78805
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
78806
- if (active) {
78807
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
78808
- if (origin) {
78809
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3d$3);
78810
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
78811
- } else {
78812
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
78943
+ if (sectionPlaneIndex < numSectionPlanes) {
78944
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
78945
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
78946
+ if (active) {
78947
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
78948
+ if (origin) {
78949
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$b);
78950
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
78951
+ } else {
78952
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
78953
+ }
78954
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
78813
78955
  }
78814
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
78956
+ } else {
78957
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
78815
78958
  }
78816
78959
  }
78817
78960
  }
@@ -78874,7 +79017,7 @@ class TrianglesDataTextureDepthRenderer {
78874
79017
  this._uProjMatrix = program.getLocation("projMatrix");
78875
79018
  this._uSectionPlanes = [];
78876
79019
 
78877
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
79020
+ for (let i = 0, len = scene.getMaxSectionPlanes(); i < len; i++) {
78878
79021
  this._uSectionPlanes.push({
78879
79022
  active: program.getLocation("sectionPlaneActive" + i),
78880
79023
  pos: program.getLocation("sectionPlanePos" + i),
@@ -78922,9 +79065,7 @@ class TrianglesDataTextureDepthRenderer {
78922
79065
 
78923
79066
  _buildVertexShader() {
78924
79067
  const scene = this._scene;
78925
- const sectionPlanesState = scene._sectionPlanesState;
78926
- scene._lightsState;
78927
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
79068
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
78928
79069
  const src = [];
78929
79070
  src.push("#version 300 es");
78930
79071
  src.push("// Triangles dataTexture draw vertex shader");
@@ -79085,8 +79226,7 @@ class TrianglesDataTextureDepthRenderer {
79085
79226
 
79086
79227
  _buildFragmentShader() {
79087
79228
  const scene = this._scene;
79088
- const sectionPlanesState = scene._sectionPlanesState;
79089
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
79229
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
79090
79230
  const src = [];
79091
79231
  src.push('#version 300 es');
79092
79232
  src.push("// Triangles dataTexture draw fragment shader");
@@ -79109,7 +79249,7 @@ class TrianglesDataTextureDepthRenderer {
79109
79249
  if (clipping) {
79110
79250
  src.push("in vec4 vWorldPosition;");
79111
79251
  src.push("flat in uint vFlags2;");
79112
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
79252
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
79113
79253
  src.push("uniform bool sectionPlaneActive" + i + ";");
79114
79254
  src.push("uniform vec3 sectionPlanePos" + i + ";");
79115
79255
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -79121,7 +79261,7 @@ class TrianglesDataTextureDepthRenderer {
79121
79261
  src.push(" bool clippable = vFlags2 > 0u;");
79122
79262
  src.push(" if (clippable) {");
79123
79263
  src.push(" float dist = 0.0;");
79124
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
79264
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
79125
79265
  src.push("if (sectionPlaneActive" + i + ") {");
79126
79266
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
79127
79267
  src.push("}");
@@ -79157,7 +79297,7 @@ class TrianglesDataTextureDepthRenderer {
79157
79297
  const tempVec3a$a = math.vec3();
79158
79298
  const tempVec3b$6 = math.vec3();
79159
79299
  const tempVec3c$5 = math.vec3();
79160
- const tempVec3d$2 = math.vec3();
79300
+ math.vec3();
79161
79301
  const tempMat4a$2 = math.mat4();
79162
79302
 
79163
79303
  /**
@@ -79242,25 +79382,30 @@ class TrianglesDataTextureNormalsRenderer {
79242
79382
  gl.uniformMatrix4fv(this._uViewNormalMatrix, false, camera.viewNormalMatrix);
79243
79383
  gl.uniformMatrix4fv(this._uWorldNormalMatrix, false, model.worldNormalMatrix);
79244
79384
 
79385
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
79245
79386
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
79246
- if (numSectionPlanes > 0) {
79387
+ if (numAllocatedSectionPlanes > 0) {
79247
79388
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
79248
79389
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
79249
79390
  const renderFlags = model.renderFlags;
79250
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
79391
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
79251
79392
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
79252
79393
  if (sectionPlaneUniforms) {
79253
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
79254
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
79255
- if (active) {
79256
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
79257
- if (origin) {
79258
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3d$2);
79259
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
79260
- } else {
79261
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
79394
+ if (sectionPlaneIndex < numSectionPlanes) {
79395
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
79396
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
79397
+ if (active) {
79398
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
79399
+ if (origin) {
79400
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$a);
79401
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
79402
+ } else {
79403
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
79404
+ }
79405
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
79262
79406
  }
79263
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
79407
+ } else {
79408
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
79264
79409
  }
79265
79410
  }
79266
79411
  }
@@ -79298,7 +79443,7 @@ class TrianglesDataTextureNormalsRenderer {
79298
79443
  this._uViewNormalMatrix = program.getLocation("viewNormalMatrix");
79299
79444
  this._uProjMatrix = program.getLocation("projMatrix");
79300
79445
  this._uSectionPlanes = [];
79301
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
79446
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
79302
79447
  this._uSectionPlanes.push({
79303
79448
  active: program.getLocation("sectionPlaneActive" + i),
79304
79449
  pos: program.getLocation("sectionPlanePos" + i),
@@ -79339,7 +79484,7 @@ class TrianglesDataTextureNormalsRenderer {
79339
79484
 
79340
79485
  _buildVertexShader() {
79341
79486
  const scene = this._scene;
79342
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
79487
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
79343
79488
  const src = [];
79344
79489
  src.push("// Batched geometry normals vertex shader");
79345
79490
  if (scene.logarithmicDepthBufferEnabled && WEBGL_INFO.SUPPORTED_EXTENSIONS["EXT_frag_depth"]) {
@@ -79421,8 +79566,7 @@ class TrianglesDataTextureNormalsRenderer {
79421
79566
 
79422
79567
  _buildFragmentShader() {
79423
79568
  const scene = this._scene;
79424
- const sectionPlanesState = scene._sectionPlanesState;
79425
- const clipping = (sectionPlanesState.sectionPlanes.length > 0);
79569
+ const clipping = (scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0);
79426
79570
  const src = [];
79427
79571
  src.push("#version 300 es");
79428
79572
  src.push("// Batched geometry normals fragment shader");
@@ -79448,7 +79592,7 @@ class TrianglesDataTextureNormalsRenderer {
79448
79592
  if (clipping) {
79449
79593
  src.push("in vec4 vWorldPosition;");
79450
79594
  src.push("in vec4 vFlags2;");
79451
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
79595
+ for (let i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
79452
79596
  src.push("uniform bool sectionPlaneActive" + i + ";");
79453
79597
  src.push("uniform vec3 sectionPlanePos" + i + ";");
79454
79598
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -79463,7 +79607,7 @@ class TrianglesDataTextureNormalsRenderer {
79463
79607
  src.push(" bool clippable = (float(vFlags2.x) > 0.0);");
79464
79608
  src.push(" if (clippable) {");
79465
79609
  src.push(" float dist = 0.0;");
79466
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
79610
+ for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
79467
79611
  src.push(" if (sectionPlaneActive" + i + ") {");
79468
79612
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
79469
79613
  src.push(" }");
@@ -79494,7 +79638,7 @@ class TrianglesDataTextureNormalsRenderer {
79494
79638
  const tempVec3a$9 = math.vec3();
79495
79639
  const tempVec3b$5 = math.vec3();
79496
79640
  const tempVec3c$4 = math.vec3();
79497
- const tempVec3d$1 = math.vec3();
79641
+ math.vec3();
79498
79642
 
79499
79643
  math.vec4();
79500
79644
 
@@ -79592,25 +79736,30 @@ class TrianglesDataTexturePickNormalsFlatRenderer {
79592
79736
  const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2);
79593
79737
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
79594
79738
  }
79739
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
79595
79740
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
79596
- if (numSectionPlanes > 0) {
79741
+ if (numAllocatedSectionPlanes > 0) {
79597
79742
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
79598
79743
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
79599
79744
  const renderFlags = model.renderFlags;
79600
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
79745
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
79601
79746
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
79602
79747
  if (sectionPlaneUniforms) {
79603
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
79604
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
79605
- if (active) {
79606
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
79607
- if (origin) {
79608
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3d$1);
79609
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
79610
- } else {
79611
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
79748
+ if (sectionPlaneIndex < numSectionPlanes) {
79749
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
79750
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
79751
+ if (active) {
79752
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
79753
+ if (origin) {
79754
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$9);
79755
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
79756
+ } else {
79757
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
79758
+ }
79759
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
79612
79760
  }
79613
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
79761
+ } else {
79762
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
79614
79763
  }
79615
79764
  }
79616
79765
  }
@@ -79666,7 +79815,7 @@ class TrianglesDataTexturePickNormalsFlatRenderer {
79666
79815
  this._uViewMatrix = program.getLocation("viewMatrix");
79667
79816
  this._uProjMatrix = program.getLocation("projMatrix");
79668
79817
  this._uSectionPlanes = [];
79669
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
79818
+ for (let i = 0, len = scene.getMaxSectionPlanes(); i < len; i++) {
79670
79819
  this._uSectionPlanes.push({
79671
79820
  active: program.getLocation("sectionPlaneActive" + i),
79672
79821
  pos: program.getLocation("sectionPlanePos" + i),
@@ -79707,9 +79856,7 @@ class TrianglesDataTexturePickNormalsFlatRenderer {
79707
79856
 
79708
79857
  _buildVertexShader() {
79709
79858
  const scene = this._scene;
79710
- const sectionPlanesState = scene._sectionPlanesState;
79711
- scene._lightsState;
79712
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
79859
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
79713
79860
  const src = [];
79714
79861
  src.push("#version 300 es");
79715
79862
  src.push("// trianglesDatatextureNormalsRenderer vertex shader");
@@ -79875,8 +80022,7 @@ class TrianglesDataTexturePickNormalsFlatRenderer {
79875
80022
 
79876
80023
  _buildFragmentShader() {
79877
80024
  const scene = this._scene;
79878
- const sectionPlanesState = scene._sectionPlanesState;
79879
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
80025
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
79880
80026
  const src = [];
79881
80027
  src.push('#version 300 es');
79882
80028
  src.push("// TrianglesDataTexturePickNormalsRenderer fragment shader");
@@ -79895,7 +80041,7 @@ class TrianglesDataTexturePickNormalsFlatRenderer {
79895
80041
  src.push("in vec4 vWorldPosition;");
79896
80042
  if (clipping) {
79897
80043
  src.push("flat in uint vFlags2;");
79898
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
80044
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
79899
80045
  src.push("uniform bool sectionPlaneActive" + i + ";");
79900
80046
  src.push("uniform vec3 sectionPlanePos" + i + ";");
79901
80047
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -79907,7 +80053,7 @@ class TrianglesDataTexturePickNormalsFlatRenderer {
79907
80053
  src.push(" bool clippable = vFlags2 > 0u;");
79908
80054
  src.push(" if (clippable) {");
79909
80055
  src.push(" float dist = 0.0;");
79910
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
80056
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
79911
80057
  src.push("if (sectionPlaneActive" + i + ") {");
79912
80058
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
79913
80059
  src.push("}");
@@ -100250,6 +100396,11 @@ class Viewer {
100250
100396
  * 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
100251
100397
  * 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)
100252
100398
  * mode for storing geometry, which is the standard technique used in most graphics engines, and will work adequately on most low-end GPUs.
100399
+ * @param {number} [cfg.numCachedSectionPlanes=0] Enhances the efficiency of SectionPlane creation by proactively allocating Viewer resources for a specified quantity
100400
+ * of SectionPlanes. Introducing this parameter streamlines the initial creation speed of SectionPlanes, particularly up to the designated quantity. This parameter internally
100401
+ * configures renderer logic for the specified number of SectionPlanes, eliminating the need for setting up logic with each SectionPlane creation and thereby enhancing
100402
+ * 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
100403
+ * your expected usage.
100253
100404
  */
100254
100405
  constructor(cfg) {
100255
100406
 
@@ -100307,7 +100458,8 @@ class Viewer {
100307
100458
  logarithmicDepthBufferEnabled: (!!cfg.logarithmicDepthBufferEnabled),
100308
100459
  pbrEnabled: (!!cfg.pbrEnabled),
100309
100460
  colorTextureEnabled: (cfg.colorTextureEnabled !== false),
100310
- dtxEnabled: (!!cfg.dtxEnabled)
100461
+ dtxEnabled: (!!cfg.dtxEnabled),
100462
+ numCachedSectionPlanes: cfg.numCachedSectionPlanes
100311
100463
  });
100312
100464
 
100313
100465
  /**