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

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 +709 -588
  2. package/dist/xeokit-sdk.es.js +709 -588
  3. package/dist/xeokit-sdk.es5.js +203 -194
  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 +21 -20
  25. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureEdgesColorRenderer.js +6 -9
  26. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureEdgesRenderer.js +21 -18
  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 +58 -54
  31. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTexturePickNormalsFlatRenderer.js +21 -19
  32. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTexturePickNormalsRenderer.js +22 -18
  33. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureSilhouetteRenderer.js +21 -18
  34. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureSnapDepthBufInitRenderer.js +21 -18
  35. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureSnapDepthRenderer.js +21 -18
  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 +24 -9
  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.numPreallocatedSectionPlanes=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._numPreallocatedSectionPlanes = cfg.numPreallocatedSectionPlanes || 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 numPreallocatedSectionPlanes = this._numPreallocatedSectionPlanes;
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 > numPreallocatedSectionPlanes) ? num : numPreallocatedSectionPlanes;
28306
+ };
28292
28307
  })();
28293
28308
 
28294
28309
  this._lightsState = new (function () {
@@ -30165,12 +30180,12 @@ class Scene extends Component {
30165
30180
 
30166
30181
  /**
30167
30182
  * This method will "tickify" the provided `cb` function.
30168
- *
30183
+ *
30169
30184
  * This means, the function will be wrapped so:
30170
- *
30185
+ *
30171
30186
  * - it runs time-aligned to scene ticks
30172
30187
  * - it runs maximum once per scene-tick
30173
- *
30188
+ *
30174
30189
  * @param {Function} cb The function to tickify
30175
30190
  * @returns {Function)}
30176
30191
  */
@@ -30191,7 +30206,7 @@ class Scene extends Component {
30191
30206
 
30192
30207
  /**
30193
30208
  * The provided `cb` function is replaced with a "set-dirty" function
30194
- *
30209
+ *
30195
30210
  * @type {Function}
30196
30211
  */
30197
30212
  const wrapperFunc = function (...args) {
@@ -30201,7 +30216,7 @@ class Scene extends Component {
30201
30216
 
30202
30217
  /**
30203
30218
  * An each scene tick, if the "dirty-flag" is set, run the `cb` function.
30204
- *
30219
+ *
30205
30220
  * This will make it run time-aligned to the scene tick.
30206
30221
  */
30207
30222
  const tickSubId = this.on("tick", () => {
@@ -30215,7 +30230,7 @@ class Scene extends Component {
30215
30230
  /**
30216
30231
  * And, store the list of subscribers.
30217
30232
  */
30218
- this._tickifiedFunctions[cbString] = { tickSubId, wrapperFunc };
30233
+ this._tickifiedFunctions[cbString] = {tickSubId, wrapperFunc};
30219
30234
 
30220
30235
  return wrapperFunc;
30221
30236
  }
@@ -30708,7 +30723,7 @@ function buildVertexLambert(mesh) {
30708
30723
  const geometryState = mesh._geometry._state;
30709
30724
  const billboard = mesh._state.billboard;
30710
30725
  const stationary = mesh._state.stationary;
30711
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
30726
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
30712
30727
  const quantizedGeometry = !!geometryState.compressGeometry;
30713
30728
 
30714
30729
  const src = [];
@@ -30885,7 +30900,7 @@ function buildFragmentLambert(mesh) {
30885
30900
  const sectionPlanesState = scene._sectionPlanesState;
30886
30901
  mesh._material._state;
30887
30902
  const geometryState = mesh._geometry._state;
30888
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
30903
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
30889
30904
  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
30905
  const src = [];
30891
30906
  src.push("#version 300 es");
@@ -30905,7 +30920,7 @@ function buildFragmentLambert(mesh) {
30905
30920
  if (clipping) {
30906
30921
  src.push("in vec4 vWorldPosition;");
30907
30922
  src.push("uniform bool clippable;");
30908
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
30923
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
30909
30924
  src.push("uniform bool sectionPlaneActive" + i + ";");
30910
30925
  src.push("uniform vec3 sectionPlanePos" + i + ";");
30911
30926
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -30923,7 +30938,7 @@ function buildFragmentLambert(mesh) {
30923
30938
  if (clipping) {
30924
30939
  src.push("if (clippable) {");
30925
30940
  src.push(" float dist = 0.0;");
30926
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
30941
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
30927
30942
  src.push("if (sectionPlaneActive" + i + ") {");
30928
30943
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
30929
30944
  src.push("}");
@@ -30964,7 +30979,7 @@ function buildVertexDraw(mesh) {
30964
30979
  const stationary = meshState.stationary;
30965
30980
  const texturing = hasTextures(mesh);
30966
30981
  const normals = hasNormals$1(mesh);
30967
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
30982
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
30968
30983
  const receivesShadow = getReceivesShadow(mesh);
30969
30984
  const quantizedGeometry = !!geometryState.compressGeometry;
30970
30985
  const src = [];
@@ -31186,7 +31201,7 @@ function buildFragmentDraw(mesh) {
31186
31201
  const sectionPlanesState = mesh.scene._sectionPlanesState;
31187
31202
  const lightsState = mesh.scene._lightsState;
31188
31203
  const materialState = mesh._material._state;
31189
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
31204
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
31190
31205
  const normals = hasNormals$1(mesh);
31191
31206
  const uvs = geometryState.uvBuf;
31192
31207
  const phongMaterial = (materialState.type === "PhongMaterial");
@@ -31247,7 +31262,7 @@ function buildFragmentDraw(mesh) {
31247
31262
  if (clipping) {
31248
31263
  src.push("in vec4 vWorldPosition;");
31249
31264
  src.push("uniform bool clippable;");
31250
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
31265
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
31251
31266
  src.push("uniform bool sectionPlaneActive" + i + ";");
31252
31267
  src.push("uniform vec3 sectionPlanePos" + i + ";");
31253
31268
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -31737,7 +31752,7 @@ function buildFragmentDraw(mesh) {
31737
31752
  if (clipping) {
31738
31753
  src.push("if (clippable) {");
31739
31754
  src.push(" float dist = 0.0;");
31740
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
31755
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
31741
31756
  src.push("if (sectionPlaneActive" + i + ") {");
31742
31757
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
31743
31758
  src.push("}");
@@ -32271,19 +32286,29 @@ DrawRenderer.prototype.drawMesh = function (frameCtx, mesh) {
32271
32286
  gl.uniformMatrix4fv(this._uViewNormalMatrix, false, camera.viewNormalMatrix);
32272
32287
 
32273
32288
  if (meshState.clippable) {
32289
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
32274
32290
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
32275
- if (numSectionPlanes > 0) {
32291
+ if (numAllocatedSectionPlanes > 0) {
32276
32292
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
32277
32293
  const renderFlags = mesh.renderFlags;
32278
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
32294
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
32279
32295
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
32280
32296
  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);
32297
+ if (sectionPlaneIndex < numSectionPlanes) {
32298
+ const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];
32299
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
32300
+ if (active) {
32301
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
32302
+ if (origin) {
32303
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$A);
32304
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
32305
+ } else {
32306
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
32307
+ }
32308
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
32309
+ }
32310
+ } else {
32311
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
32287
32312
  }
32288
32313
  }
32289
32314
  }
@@ -33348,7 +33373,7 @@ function buildFragment$5(mesh) {
33348
33373
  const scene = mesh.scene;
33349
33374
  const sectionPlanesState = mesh.scene._sectionPlanesState;
33350
33375
  const gammaOutput = mesh.scene.gammaOutput;
33351
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
33376
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
33352
33377
  const src = [];
33353
33378
  src.push("#version 300 es");
33354
33379
  src.push("// Lambertian drawing fragment shader");
@@ -33375,7 +33400,7 @@ function buildFragment$5(mesh) {
33375
33400
  if (clipping) {
33376
33401
  src.push("in vec4 vWorldPosition;");
33377
33402
  src.push("uniform bool clippable;");
33378
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
33403
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
33379
33404
  src.push("uniform bool sectionPlaneActive" + i + ";");
33380
33405
  src.push("uniform vec3 sectionPlanePos" + i + ";");
33381
33406
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -33387,7 +33412,7 @@ function buildFragment$5(mesh) {
33387
33412
  if (clipping) {
33388
33413
  src.push("if (clippable) {");
33389
33414
  src.push(" float dist = 0.0;");
33390
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
33415
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
33391
33416
  src.push("if (sectionPlaneActive" + i + ") {");
33392
33417
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
33393
33418
  src.push("}");
@@ -33493,19 +33518,29 @@ EmphasisFillRenderer.prototype.drawMesh = function (frameCtx, mesh, mode) {
33493
33518
  gl.uniformMatrix4fv(this._uViewNormalMatrix, false, camera.viewNormalMatrix);
33494
33519
 
33495
33520
  if (meshState.clippable) {
33521
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
33496
33522
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
33497
- if (numSectionPlanes > 0) {
33523
+ if (numAllocatedSectionPlanes > 0) {
33498
33524
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
33499
33525
  const renderFlags = mesh.renderFlags;
33500
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
33526
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
33501
33527
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
33502
33528
  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);
33529
+ if (sectionPlaneIndex < numSectionPlanes) {
33530
+ const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];
33531
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
33532
+ if (active) {
33533
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
33534
+ if (origin) {
33535
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$z);
33536
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
33537
+ } else {
33538
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
33539
+ }
33540
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
33541
+ }
33542
+ } else {
33543
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
33509
33544
  }
33510
33545
  }
33511
33546
  }
@@ -33614,7 +33649,7 @@ EmphasisFillRenderer.prototype._allocate = function (mesh) {
33614
33649
  }
33615
33650
  }
33616
33651
  this._uSectionPlanes = [];
33617
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
33652
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
33618
33653
  this._uSectionPlanes.push({
33619
33654
  active: program.getLocation("sectionPlaneActive" + i),
33620
33655
  pos: program.getLocation("sectionPlanePos" + i),
@@ -33777,7 +33812,7 @@ function buildFragment$4(mesh) {
33777
33812
  const scene = mesh.scene;
33778
33813
  const sectionPlanesState = mesh.scene._sectionPlanesState;
33779
33814
  const gammaOutput = mesh.scene.gammaOutput;
33780
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
33815
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
33781
33816
  const src = [];
33782
33817
  src.push("#version 300 es");
33783
33818
  src.push("// Edges drawing fragment shader");
@@ -33802,7 +33837,7 @@ function buildFragment$4(mesh) {
33802
33837
  if (clipping) {
33803
33838
  src.push("in vec4 vWorldPosition;");
33804
33839
  src.push("uniform bool clippable;");
33805
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
33840
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
33806
33841
  src.push("uniform bool sectionPlaneActive" + i + ";");
33807
33842
  src.push("uniform vec3 sectionPlanePos" + i + ";");
33808
33843
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -33814,7 +33849,7 @@ function buildFragment$4(mesh) {
33814
33849
  if (clipping) {
33815
33850
  src.push("if (clippable) {");
33816
33851
  src.push(" float dist = 0.0;");
33817
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
33852
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
33818
33853
  src.push("if (sectionPlaneActive" + i + ") {");
33819
33854
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
33820
33855
  src.push("}");
@@ -33912,19 +33947,29 @@ EmphasisEdgesRenderer.prototype.drawMesh = function (frameCtx, mesh, mode) {
33912
33947
  gl.uniformMatrix4fv(this._uViewMatrix, false, origin ? frameCtx.getRTCViewMatrix(meshState.originHash, origin) : camera.viewMatrix);
33913
33948
 
33914
33949
  if (meshState.clippable) {
33950
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
33915
33951
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
33916
- if (numSectionPlanes > 0) {
33952
+ if (numAllocatedSectionPlanes > 0) {
33917
33953
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
33918
33954
  const renderFlags = mesh.renderFlags;
33919
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
33955
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
33920
33956
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
33921
33957
  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);
33958
+ if (sectionPlaneIndex < numSectionPlanes) {
33959
+ const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];
33960
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
33961
+ if (active) {
33962
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
33963
+ if (origin) {
33964
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$y);
33965
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
33966
+ } else {
33967
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
33968
+ }
33969
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
33970
+ }
33971
+ } else {
33972
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
33928
33973
  }
33929
33974
  }
33930
33975
  }
@@ -34025,7 +34070,7 @@ EmphasisEdgesRenderer.prototype._allocate = function (mesh) {
34025
34070
  this._uViewMatrix = program.getLocation("viewMatrix");
34026
34071
  this._uProjMatrix = program.getLocation("projMatrix");
34027
34072
  this._uSectionPlanes = [];
34028
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
34073
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
34029
34074
  this._uSectionPlanes.push({
34030
34075
  active: program.getLocation("sectionPlaneActive" + i),
34031
34076
  pos: program.getLocation("sectionPlanePos" + i),
@@ -34177,7 +34222,7 @@ function buildVertex$3(mesh) {
34177
34222
  function buildFragment$3(mesh) {
34178
34223
  const scene = mesh.scene;
34179
34224
  const sectionPlanesState = scene._sectionPlanesState;
34180
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
34225
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
34181
34226
  const src = [];
34182
34227
  src.push('#version 300 es');
34183
34228
  src.push("// Mesh picking fragment shader");
@@ -34197,7 +34242,7 @@ function buildFragment$3(mesh) {
34197
34242
  if (clipping) {
34198
34243
  src.push("uniform bool clippable;");
34199
34244
  src.push("in vec4 vWorldPosition;");
34200
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
34245
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
34201
34246
  src.push("uniform bool sectionPlaneActive" + i + ";");
34202
34247
  src.push("uniform vec3 sectionPlanePos" + i + ";");
34203
34248
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -34208,7 +34253,7 @@ function buildFragment$3(mesh) {
34208
34253
  if (clipping) {
34209
34254
  src.push("if (clippable) {");
34210
34255
  src.push(" float dist = 0.0;");
34211
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
34256
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
34212
34257
  src.push("if (sectionPlaneActive" + i + ") {");
34213
34258
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
34214
34259
  src.push("}");
@@ -34301,19 +34346,29 @@ PickMeshRenderer.prototype.drawMesh = function (frameCtx, mesh) {
34301
34346
  gl.uniformMatrix4fv(this._uViewMatrix, false, origin ? frameCtx.getRTCPickViewMatrix(meshState.originHash, origin) : frameCtx.pickViewMatrix);
34302
34347
 
34303
34348
  if (meshState.clippable) {
34349
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
34304
34350
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
34305
- if (numSectionPlanes > 0) {
34351
+ if (numAllocatedSectionPlanes > 0) {
34306
34352
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
34307
34353
  const renderFlags = mesh.renderFlags;
34308
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
34354
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
34309
34355
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
34310
34356
  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);
34357
+ if (sectionPlaneIndex < numSectionPlanes) {
34358
+ const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];
34359
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
34360
+ if (active) {
34361
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
34362
+ if (origin) {
34363
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$x);
34364
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
34365
+ } else {
34366
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
34367
+ }
34368
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
34369
+ }
34370
+ } else {
34371
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
34317
34372
  }
34318
34373
  }
34319
34374
  }
@@ -34505,7 +34560,7 @@ function buildVertex$2(mesh) {
34505
34560
  function buildFragment$2(mesh) {
34506
34561
  const scene = mesh.scene;
34507
34562
  const sectionPlanesState = scene._sectionPlanesState;
34508
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
34563
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
34509
34564
  const src = [];
34510
34565
  src.push('#version 300 es');
34511
34566
  src.push("// Surface picking fragment shader");
@@ -34525,7 +34580,7 @@ function buildFragment$2(mesh) {
34525
34580
  if (clipping) {
34526
34581
  src.push("uniform bool clippable;");
34527
34582
  src.push("in vec4 vWorldPosition;");
34528
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
34583
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
34529
34584
  src.push("uniform bool sectionPlaneActive" + i + ";");
34530
34585
  src.push("uniform vec3 sectionPlanePos" + i + ";");
34531
34586
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -34536,7 +34591,7 @@ function buildFragment$2(mesh) {
34536
34591
  if (clipping) {
34537
34592
  src.push("if (clippable) {");
34538
34593
  src.push(" float dist = 0.0;");
34539
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
34594
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
34540
34595
  src.push("if (sectionPlaneActive" + i + ") {");
34541
34596
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
34542
34597
  src.push("}");
@@ -34637,19 +34692,29 @@ PickTriangleRenderer.prototype.drawMesh = function (frameCtx, mesh) {
34637
34692
  gl.uniformMatrix4fv(this._uViewMatrix, false, origin ? frameCtx.getRTCPickViewMatrix(meshState.originHash, origin) : frameCtx.pickViewMatrix);
34638
34693
 
34639
34694
  if (meshState.clippable) {
34695
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
34640
34696
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
34641
- if (numSectionPlanes > 0) {
34697
+ if (numAllocatedSectionPlanes > 0) {
34642
34698
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
34643
34699
  const renderFlags = mesh.renderFlags;
34644
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
34700
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
34645
34701
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
34646
34702
  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);
34703
+ if (sectionPlaneIndex < numSectionPlanes) {
34704
+ const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];
34705
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
34706
+ if (active) {
34707
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
34708
+ if (origin) {
34709
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$w);
34710
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
34711
+ } else {
34712
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
34713
+ }
34714
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
34715
+ }
34716
+ } else {
34717
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
34653
34718
  }
34654
34719
  }
34655
34720
  }
@@ -34830,7 +34895,7 @@ function buildFragment$1(mesh) {
34830
34895
 
34831
34896
  const scene = mesh.scene;
34832
34897
  const sectionPlanesState = scene._sectionPlanesState;
34833
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
34898
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
34834
34899
  const src = [];
34835
34900
  src.push('#version 300 es');
34836
34901
  src.push("// Mesh occlusion fragment shader");
@@ -34851,7 +34916,7 @@ function buildFragment$1(mesh) {
34851
34916
  if (clipping) {
34852
34917
  src.push("uniform bool clippable;");
34853
34918
  src.push("in vec4 vWorldPosition;");
34854
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
34919
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
34855
34920
  src.push("uniform bool sectionPlaneActive" + i + ";");
34856
34921
  src.push("uniform vec3 sectionPlanePos" + i + ";");
34857
34922
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -34865,7 +34930,7 @@ function buildFragment$1(mesh) {
34865
34930
  if (clipping) {
34866
34931
  src.push("if (clippable) {");
34867
34932
  src.push(" float dist = 0.0;");
34868
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
34933
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
34869
34934
  src.push("if (sectionPlaneActive" + i + ") {");
34870
34935
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
34871
34936
  src.push("}");
@@ -34986,19 +35051,29 @@ OcclusionRenderer.prototype.drawMesh = function (frameCtx, mesh) {
34986
35051
  gl.uniformMatrix4fv(this._uViewMatrix, false, origin ? frameCtx.getRTCViewMatrix(meshState.originHash, origin) : camera.viewMatrix);
34987
35052
 
34988
35053
  if (meshState.clippable) {
35054
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
34989
35055
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
34990
- if (numSectionPlanes > 0) {
35056
+ if (numAllocatedSectionPlanes > 0) {
34991
35057
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
34992
35058
  const renderFlags = mesh.renderFlags;
34993
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
35059
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
34994
35060
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
34995
35061
  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);
35062
+ if (sectionPlaneIndex < numSectionPlanes) {
35063
+ const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];
35064
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
35065
+ if (active) {
35066
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
35067
+ if (origin) {
35068
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$v);
35069
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
35070
+ } else {
35071
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
35072
+ }
35073
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
35074
+ }
35075
+ } else {
35076
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
35002
35077
  }
35003
35078
  }
35004
35079
  }
@@ -35133,7 +35208,7 @@ function buildFragment(mesh) {
35133
35208
  const scene = mesh.scene;
35134
35209
  scene.canvas.gl;
35135
35210
  const sectionPlanesState = scene._sectionPlanesState;
35136
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
35211
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
35137
35212
  const src = [];
35138
35213
  src.push("// Mesh shadow fragment shader");
35139
35214
 
@@ -35148,7 +35223,7 @@ function buildFragment(mesh) {
35148
35223
  if (clipping) {
35149
35224
  src.push("uniform bool clippable;");
35150
35225
  src.push("in vec4 vWorldPosition;");
35151
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
35226
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
35152
35227
  src.push("uniform bool sectionPlaneActive" + i + ";");
35153
35228
  src.push("uniform vec3 sectionPlanePos" + i + ";");
35154
35229
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -35169,7 +35244,7 @@ function buildFragment(mesh) {
35169
35244
  if (clipping) {
35170
35245
  src.push("if (clippable) {");
35171
35246
  src.push(" float dist = 0.0;");
35172
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
35247
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
35173
35248
  src.push("if (sectionPlaneActive" + i + ") {");
35174
35249
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
35175
35250
  src.push("}");
@@ -35364,7 +35439,7 @@ ShadowRenderer.prototype._bindProgram = function (frame) {
35364
35439
  this._lastMaterialId = null;
35365
35440
  this._lastVertexBufsId = null;
35366
35441
  this._lastGeometryId = null;
35367
- if (sectionPlanesState.sectionPlanes.length > 0) {
35442
+ if (sectionPlanesState.getNumAllocatedSectionPlanes() > 0) {
35368
35443
  let sectionPlaneUniforms;
35369
35444
  let uSectionPlaneActive;
35370
35445
  let sectionPlane;
@@ -56581,32 +56656,38 @@ class VBOSceneModelRenderer {
56581
56656
  const {gl} = scene.canvas;
56582
56657
  const {model, layerIndex} = layer;
56583
56658
 
56659
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
56584
56660
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
56585
- if (numSectionPlanes > 0) {
56661
+ if (numAllocatedSectionPlanes > 0) {
56586
56662
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
56587
56663
  const baseIndex = layerIndex * numSectionPlanes;
56588
56664
  const renderFlags = model.renderFlags;
56589
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
56665
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
56590
56666
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
56591
56667
  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);
56668
+ if (sectionPlaneIndex < numSectionPlanes) {
56669
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
56670
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
56671
+ if (active) {
56672
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
56673
+ const origin = layer._state.origin;
56674
+ if (origin) {
56675
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$s);
56676
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
56677
+ } else {
56678
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
56679
+ }
56680
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
56602
56681
  }
56603
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
56682
+ } else {
56683
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
56604
56684
  }
56605
56685
  }
56606
56686
  }
56607
56687
  }
56608
56688
  }
56609
56689
 
56690
+
56610
56691
  _allocate() {
56611
56692
  const scene = this._scene;
56612
56693
  const gl = scene.canvas.gl;
@@ -56687,7 +56768,7 @@ class VBOSceneModelRenderer {
56687
56768
 
56688
56769
  this._uSectionPlanes = [];
56689
56770
 
56690
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
56771
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
56691
56772
  this._uSectionPlanes.push({
56692
56773
  active: program.getLocation("sectionPlaneActive" + i),
56693
56774
  pos: program.getLocation("sectionPlanePos" + i),
@@ -57153,12 +57234,11 @@ class VBOSceneModelTriangleBatchingEdgesRenderer extends VBOSceneModelTriangleBa
57153
57234
  }
57154
57235
 
57155
57236
 
57156
-
57157
57237
  /**
57158
57238
  * @private
57159
57239
  */
57160
57240
  class VBOSceneModelTriangleInstancingRenderer extends VBOSceneModelRenderer {
57161
- constructor(scene, withSAO, { edges = false} = {}) {
57241
+ constructor(scene, withSAO, {edges = false} = {}) {
57162
57242
  super(scene, withSAO, {instancing: true, edges});
57163
57243
  }
57164
57244
 
@@ -57305,7 +57385,7 @@ class TrianglesBatchingColorRenderer extends VBOSceneModelTriangleBatchingRender
57305
57385
  const scene = this._scene;
57306
57386
  const sectionPlanesState = scene._sectionPlanesState;
57307
57387
  const lightsState = scene._lightsState;
57308
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
57388
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57309
57389
  let light;
57310
57390
  const src = [];
57311
57391
  src.push("#version 300 es");
@@ -57444,7 +57524,7 @@ class TrianglesBatchingColorRenderer extends VBOSceneModelTriangleBatchingRender
57444
57524
  _buildFragmentShader() {
57445
57525
  const scene = this._scene;
57446
57526
  const sectionPlanesState = scene._sectionPlanesState;
57447
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
57527
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57448
57528
  const src = [];
57449
57529
  src.push("#version 300 es");
57450
57530
  src.push("// Triangles batching draw fragment shader");
@@ -57477,7 +57557,7 @@ class TrianglesBatchingColorRenderer extends VBOSceneModelTriangleBatchingRender
57477
57557
  if (clipping) {
57478
57558
  src.push("in vec4 vWorldPosition;");
57479
57559
  src.push("in float vFlags;");
57480
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
57560
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
57481
57561
  src.push("uniform bool sectionPlaneActive" + i + ";");
57482
57562
  src.push("uniform vec3 sectionPlanePos" + i + ";");
57483
57563
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -57491,7 +57571,7 @@ class TrianglesBatchingColorRenderer extends VBOSceneModelTriangleBatchingRender
57491
57571
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
57492
57572
  src.push(" if (clippable) {");
57493
57573
  src.push(" float dist = 0.0;");
57494
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
57574
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
57495
57575
  src.push("if (sectionPlaneActive" + i + ") {");
57496
57576
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
57497
57577
  src.push("}");
@@ -57537,7 +57617,7 @@ class TrianglesBatchingFlatColorRenderer extends VBOSceneModelTriangleBatchingRe
57537
57617
  _buildVertexShader() {
57538
57618
  const scene = this._scene;
57539
57619
  const sectionPlanesState = scene._sectionPlanesState;
57540
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
57620
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57541
57621
  const src = [];
57542
57622
  src.push("#version 300 es");
57543
57623
  src.push("// Triangles batching flat-shading draw vertex shader");
@@ -57609,7 +57689,7 @@ class TrianglesBatchingFlatColorRenderer extends VBOSceneModelTriangleBatchingRe
57609
57689
  const scene = this._scene;
57610
57690
  const lightsState = scene._lightsState;
57611
57691
  const sectionPlanesState = scene._sectionPlanesState;
57612
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
57692
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57613
57693
  const src = [];
57614
57694
  src.push("#version 300 es");
57615
57695
  src.push("// Triangles batching flat-shading draw fragment shader");
@@ -57645,7 +57725,7 @@ class TrianglesBatchingFlatColorRenderer extends VBOSceneModelTriangleBatchingRe
57645
57725
  if (clipping) {
57646
57726
  src.push("in vec4 vWorldPosition;");
57647
57727
  src.push("in float vFlags;");
57648
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
57728
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
57649
57729
  src.push("uniform bool sectionPlaneActive" + i + ";");
57650
57730
  src.push("uniform vec3 sectionPlanePos" + i + ";");
57651
57731
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -57683,7 +57763,7 @@ class TrianglesBatchingFlatColorRenderer extends VBOSceneModelTriangleBatchingRe
57683
57763
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
57684
57764
  src.push(" if (clippable) {");
57685
57765
  src.push(" float dist = 0.0;");
57686
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
57766
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
57687
57767
  src.push("if (sectionPlaneActive" + i + ") {");
57688
57768
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
57689
57769
  src.push("}");
@@ -57772,7 +57852,7 @@ class TrianglesBatchingSilhouetteRenderer extends VBOSceneModelTriangleBatchingR
57772
57852
 
57773
57853
  const scene = this._scene;
57774
57854
  const sectionPlanesState = scene._sectionPlanesState;
57775
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
57855
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57776
57856
 
57777
57857
  const src = [];
57778
57858
  src.push("#version 300 es");
@@ -57843,7 +57923,7 @@ class TrianglesBatchingSilhouetteRenderer extends VBOSceneModelTriangleBatchingR
57843
57923
  const sectionPlanesState = scene._sectionPlanesState;
57844
57924
  let i;
57845
57925
  let len;
57846
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
57926
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57847
57927
  const src = [];
57848
57928
  src.push("#version 300 es");
57849
57929
  src.push("// Triangles batching silhouette fragment shader");
@@ -57863,7 +57943,7 @@ class TrianglesBatchingSilhouetteRenderer extends VBOSceneModelTriangleBatchingR
57863
57943
  if (clipping) {
57864
57944
  src.push("in vec4 vWorldPosition;");
57865
57945
  src.push("in float vFlags;");
57866
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
57946
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
57867
57947
  src.push("uniform bool sectionPlaneActive" + i + ";");
57868
57948
  src.push("uniform vec3 sectionPlanePos" + i + ";");
57869
57949
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -57876,7 +57956,7 @@ class TrianglesBatchingSilhouetteRenderer extends VBOSceneModelTriangleBatchingR
57876
57956
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
57877
57957
  src.push(" if (clippable) {");
57878
57958
  src.push(" float dist = 0.0;");
57879
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
57959
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
57880
57960
  src.push("if (sectionPlaneActive" + i + ") {");
57881
57961
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
57882
57962
  src.push("}");
@@ -57905,7 +57985,7 @@ class TrianglesBatchingEdgesRenderer extends VBOSceneModelTriangleBatchingEdgesR
57905
57985
  _buildVertexShader() {
57906
57986
  const scene = this._scene;
57907
57987
  const sectionPlanesState = scene._sectionPlanesState;
57908
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
57988
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57909
57989
  const src = [];
57910
57990
 
57911
57991
  src.push("#version 300 es");
@@ -57974,7 +58054,7 @@ class TrianglesBatchingEdgesRenderer extends VBOSceneModelTriangleBatchingEdgesR
57974
58054
  _buildFragmentShader() {
57975
58055
  const scene = this._scene;
57976
58056
  const sectionPlanesState = scene._sectionPlanesState;
57977
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
58057
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57978
58058
  const src = [];
57979
58059
  src.push("#version 300 es");
57980
58060
  src.push("// Batched geometry edges drawing fragment shader");
@@ -57994,7 +58074,7 @@ class TrianglesBatchingEdgesRenderer extends VBOSceneModelTriangleBatchingEdgesR
57994
58074
  if (clipping) {
57995
58075
  src.push("in vec4 vWorldPosition;");
57996
58076
  src.push("in float vFlags;");
57997
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
58077
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
57998
58078
  src.push("uniform bool sectionPlaneActive" + i + ";");
57999
58079
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58000
58080
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58007,7 +58087,7 @@ class TrianglesBatchingEdgesRenderer extends VBOSceneModelTriangleBatchingEdgesR
58007
58087
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58008
58088
  src.push(" if (clippable) {");
58009
58089
  src.push(" float dist = 0.0;");
58010
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
58090
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
58011
58091
  src.push("if (sectionPlaneActive" + i + ") {");
58012
58092
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58013
58093
  src.push("}");
@@ -58032,7 +58112,7 @@ class TrianglesBatchingEdgesColorRenderer extends VBOSceneModelTriangleBatchingE
58032
58112
  _buildVertexShader() {
58033
58113
  const scene = this._scene;
58034
58114
  const sectionPlanesState = scene._sectionPlanesState;
58035
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
58115
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58036
58116
  const src = [];
58037
58117
  src.push("#version 300 es");
58038
58118
  src.push("// Batched geometry edges drawing vertex shader");
@@ -58101,7 +58181,7 @@ class TrianglesBatchingEdgesColorRenderer extends VBOSceneModelTriangleBatchingE
58101
58181
  _buildFragmentShader() {
58102
58182
  const scene = this._scene;
58103
58183
  const sectionPlanesState = scene._sectionPlanesState;
58104
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
58184
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58105
58185
  const src = [];
58106
58186
  src.push("#version 300 es");
58107
58187
  src.push("// Batched geometry edges drawing fragment shader");
@@ -58120,7 +58200,7 @@ class TrianglesBatchingEdgesColorRenderer extends VBOSceneModelTriangleBatchingE
58120
58200
  if (clipping) {
58121
58201
  src.push("in vec4 vWorldPosition;");
58122
58202
  src.push("in float vFlags;");
58123
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
58203
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
58124
58204
  src.push("uniform bool sectionPlaneActive" + i + ";");
58125
58205
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58126
58206
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58133,7 +58213,7 @@ class TrianglesBatchingEdgesColorRenderer extends VBOSceneModelTriangleBatchingE
58133
58213
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58134
58214
  src.push(" if (clippable) {");
58135
58215
  src.push(" float dist = 0.0;");
58136
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
58216
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
58137
58217
  src.push("if (sectionPlaneActive" + i + ") {");
58138
58218
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58139
58219
  src.push("}");
@@ -58157,7 +58237,7 @@ class TrianglesBatchingPickMeshRenderer extends VBOSceneModelTriangleBatchingRen
58157
58237
 
58158
58238
  _buildVertexShader() {
58159
58239
  const scene = this._scene;
58160
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
58240
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58161
58241
  const src = [];
58162
58242
  src.push("#version 300 es");
58163
58243
  src.push("// Batched geometry picking vertex shader");
@@ -58229,7 +58309,7 @@ class TrianglesBatchingPickMeshRenderer extends VBOSceneModelTriangleBatchingRen
58229
58309
  _buildFragmentShader() {
58230
58310
  const scene = this._scene;
58231
58311
  const sectionPlanesState = scene._sectionPlanesState;
58232
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
58312
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58233
58313
  const src = [];
58234
58314
  src.push("#version 300 es");
58235
58315
  src.push("// Batched geometry picking fragment shader");
@@ -58249,7 +58329,7 @@ class TrianglesBatchingPickMeshRenderer extends VBOSceneModelTriangleBatchingRen
58249
58329
  if (clipping) {
58250
58330
  src.push("in vec4 vWorldPosition;");
58251
58331
  src.push("in float vFlags;");
58252
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58332
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58253
58333
  src.push("uniform bool sectionPlaneActive" + i + ";");
58254
58334
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58255
58335
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58262,7 +58342,7 @@ class TrianglesBatchingPickMeshRenderer extends VBOSceneModelTriangleBatchingRen
58262
58342
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58263
58343
  src.push(" if (clippable) {");
58264
58344
  src.push(" float dist = 0.0;");
58265
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58345
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58266
58346
  src.push(" if (sectionPlaneActive" + i + ") {");
58267
58347
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58268
58348
  src.push(" }");
@@ -58287,7 +58367,7 @@ class TrianglesBatchingPickDepthRenderer extends VBOSceneModelTriangleBatchingRe
58287
58367
  _buildVertexShader() {
58288
58368
 
58289
58369
  const scene = this._scene;
58290
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
58370
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58291
58371
  const src = [];
58292
58372
  src.push("#version 300 es");
58293
58373
  src.push("// Triangles batching pick depth vertex shader");
@@ -58357,7 +58437,7 @@ class TrianglesBatchingPickDepthRenderer extends VBOSceneModelTriangleBatchingRe
58357
58437
 
58358
58438
  const scene = this._scene;
58359
58439
  const sectionPlanesState = scene._sectionPlanesState;
58360
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
58440
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58361
58441
  const src = [];
58362
58442
  src.push("#version 300 es");
58363
58443
  src.push("// Triangles batching pick depth fragment shader");
@@ -58384,7 +58464,7 @@ class TrianglesBatchingPickDepthRenderer extends VBOSceneModelTriangleBatchingRe
58384
58464
  if (clipping) {
58385
58465
  src.push("in vec4 vWorldPosition;");
58386
58466
  src.push("in float vFlags;");
58387
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58467
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58388
58468
  src.push("uniform bool sectionPlaneActive" + i + ";");
58389
58469
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58390
58470
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58404,7 +58484,7 @@ class TrianglesBatchingPickDepthRenderer extends VBOSceneModelTriangleBatchingRe
58404
58484
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58405
58485
  src.push(" if (clippable) {");
58406
58486
  src.push(" float dist = 0.0;");
58407
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58487
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58408
58488
  src.push(" if (sectionPlaneActive" + i + ") {");
58409
58489
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58410
58490
  src.push(" }");
@@ -58429,7 +58509,7 @@ class TrianglesBatchingPickNormalsRenderer extends VBOSceneModelTriangleBatching
58429
58509
 
58430
58510
  _buildVertexShader() {
58431
58511
  const scene = this._scene;
58432
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
58512
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58433
58513
  const src = [];
58434
58514
  src.push("#version 300 es");
58435
58515
  src.push("// Triangles batching pick normals vertex shader");
@@ -58500,7 +58580,7 @@ class TrianglesBatchingPickNormalsRenderer extends VBOSceneModelTriangleBatching
58500
58580
  _buildFragmentShader() {
58501
58581
  const scene = this._scene;
58502
58582
  const sectionPlanesState = scene._sectionPlanesState;
58503
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
58583
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58504
58584
  const src = [];
58505
58585
  src.push("#version 300 es");
58506
58586
  src.push("// Triangles batching pick normals fragment shader");
@@ -58520,7 +58600,7 @@ class TrianglesBatchingPickNormalsRenderer extends VBOSceneModelTriangleBatching
58520
58600
  if (clipping) {
58521
58601
  src.push("in vec4 vWorldPosition;");
58522
58602
  src.push("in float vFlags;");
58523
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58603
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58524
58604
  src.push("uniform bool sectionPlaneActive" + i + ";");
58525
58605
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58526
58606
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58533,7 +58613,7 @@ class TrianglesBatchingPickNormalsRenderer extends VBOSceneModelTriangleBatching
58533
58613
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58534
58614
  src.push(" if (clippable) {");
58535
58615
  src.push(" float dist = 0.0;");
58536
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58616
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58537
58617
  src.push(" if (sectionPlaneActive" + i + ") {");
58538
58618
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58539
58619
  src.push(" }");
@@ -58557,7 +58637,7 @@ class TrianglesBatchingOcclusionRenderer extends VBOSceneModelTriangleBatchingRe
58557
58637
 
58558
58638
  _buildVertexShader() {
58559
58639
  const scene = this._scene;
58560
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
58640
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58561
58641
  const src = [];
58562
58642
  src.push("#version 300 es");
58563
58643
  src.push("// Triangles batching occlusion vertex shader");
@@ -58606,7 +58686,7 @@ class TrianglesBatchingOcclusionRenderer extends VBOSceneModelTriangleBatchingRe
58606
58686
  _buildFragmentShader() {
58607
58687
  const scene = this._scene;
58608
58688
  const sectionPlanesState = scene._sectionPlanesState;
58609
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
58689
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58610
58690
  const src = [];
58611
58691
  src.push("#version 300 es");
58612
58692
  src.push("// Triangles batching occlusion fragment shader");
@@ -58621,7 +58701,7 @@ class TrianglesBatchingOcclusionRenderer extends VBOSceneModelTriangleBatchingRe
58621
58701
  if (clipping) {
58622
58702
  src.push("in vec4 vWorldPosition;");
58623
58703
  src.push("in float vFlags;");
58624
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58704
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58625
58705
  src.push("uniform bool sectionPlaneActive" + i + ";");
58626
58706
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58627
58707
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58633,7 +58713,7 @@ class TrianglesBatchingOcclusionRenderer extends VBOSceneModelTriangleBatchingRe
58633
58713
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58634
58714
  src.push(" if (clippable) {");
58635
58715
  src.push(" float dist = 0.0;");
58636
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58716
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58637
58717
  src.push(" if (sectionPlaneActive" + i + ") {");
58638
58718
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58639
58719
  src.push(" }");
@@ -58654,7 +58734,7 @@ class TrianglesBatchingDepthRenderer extends VBOSceneModelTriangleBatchingRender
58654
58734
 
58655
58735
  _buildVertexShader() {
58656
58736
  const scene = this._scene;
58657
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
58737
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58658
58738
  const src = [];
58659
58739
  src.push("#version 300 es");
58660
58740
  src.push("// Triangles batching depth vertex shader");
@@ -58714,7 +58794,7 @@ class TrianglesBatchingDepthRenderer extends VBOSceneModelTriangleBatchingRender
58714
58794
  _buildFragmentShader() {
58715
58795
  const scene = this._scene;
58716
58796
  const sectionPlanesState = scene._sectionPlanesState;
58717
- const clipping = (sectionPlanesState.sectionPlanes.length > 0);
58797
+ const clipping = (sectionPlanesState.getNumAllocatedSectionPlanes() > 0);
58718
58798
  const src = [];
58719
58799
  src.push("#version 300 es");
58720
58800
  src.push("// Triangles batching depth fragment shader");
@@ -58729,7 +58809,7 @@ class TrianglesBatchingDepthRenderer extends VBOSceneModelTriangleBatchingRender
58729
58809
  if (clipping) {
58730
58810
  src.push("in vec4 vWorldPosition;");
58731
58811
  src.push("in float vFlags;");
58732
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58812
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58733
58813
  src.push("uniform bool sectionPlaneActive" + i + ";");
58734
58814
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58735
58815
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58753,7 +58833,7 @@ class TrianglesBatchingDepthRenderer extends VBOSceneModelTriangleBatchingRender
58753
58833
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58754
58834
  src.push(" if (clippable) {");
58755
58835
  src.push(" float dist = 0.0;");
58756
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58836
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58757
58837
  src.push(" if (sectionPlaneActive" + i + ") {");
58758
58838
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58759
58839
  src.push(" }");
@@ -58778,7 +58858,7 @@ class TrianglesBatchingNormalsRenderer extends VBOSceneModelTriangleBatchingRend
58778
58858
 
58779
58859
  _buildVertexShader() {
58780
58860
  const scene = this._scene;
58781
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
58861
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58782
58862
  const src = [];
58783
58863
  src.push("#version 300 es");
58784
58864
  src.push("// Batched geometry normals vertex shader");
@@ -58849,7 +58929,7 @@ class TrianglesBatchingNormalsRenderer extends VBOSceneModelTriangleBatchingRend
58849
58929
  _buildFragmentShader() {
58850
58930
  const scene = this._scene;
58851
58931
  const sectionPlanesState = scene._sectionPlanesState;
58852
- const clipping = (sectionPlanesState.sectionPlanes.length > 0);
58932
+ const clipping = (sectionPlanesState.getNumAllocatedSectionPlanes() > 0);
58853
58933
  const src = [];
58854
58934
  src.push("#version 300 es");
58855
58935
  src.push("// Batched geometry normals fragment shader");
@@ -58873,7 +58953,7 @@ class TrianglesBatchingNormalsRenderer extends VBOSceneModelTriangleBatchingRend
58873
58953
  if (clipping) {
58874
58954
  src.push("in vec4 vWorldPosition;");
58875
58955
  src.push("in float vFlags;");
58876
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58956
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58877
58957
  src.push("uniform bool sectionPlaneActive" + i + ";");
58878
58958
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58879
58959
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58890,7 +58970,7 @@ class TrianglesBatchingNormalsRenderer extends VBOSceneModelTriangleBatchingRend
58890
58970
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58891
58971
  src.push(" if (clippable) {");
58892
58972
  src.push(" float dist = 0.0;");
58893
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58973
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58894
58974
  src.push(" if (sectionPlaneActive" + i + ") {");
58895
58975
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58896
58976
  src.push(" }");
@@ -58916,7 +58996,7 @@ class TrianglesBatchingShadowRenderer extends VBOSceneModelTriangleBatchingRende
58916
58996
 
58917
58997
  _buildVertexShader() {
58918
58998
  const scene = this._scene;
58919
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
58999
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58920
59000
  const src = [];
58921
59001
  src.push("#version 300 es");
58922
59002
  src.push("// Batched geometry shadow vertex shader");
@@ -58963,7 +59043,7 @@ class TrianglesBatchingShadowRenderer extends VBOSceneModelTriangleBatchingRende
58963
59043
  _buildFragmentShader() {
58964
59044
  const scene = this._scene;
58965
59045
  const sectionPlanesState = scene._sectionPlanesState;
58966
- const clipping = (sectionPlanesState.sectionPlanes.length > 0);
59046
+ const clipping = (sectionPlanesState.getNumAllocatedSectionPlanes() > 0);
58967
59047
  const src = [];
58968
59048
  src.push("#version 300 es");
58969
59049
  src.push("// Batched geometry shadow fragment shader");
@@ -58977,7 +59057,7 @@ class TrianglesBatchingShadowRenderer extends VBOSceneModelTriangleBatchingRende
58977
59057
  if (clipping) {
58978
59058
  src.push("in vec4 vWorldPosition;");
58979
59059
  src.push("in float vFlags;");
58980
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
59060
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58981
59061
  src.push("uniform bool sectionPlaneActive" + i + ";");
58982
59062
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58983
59063
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58998,7 +59078,7 @@ class TrianglesBatchingShadowRenderer extends VBOSceneModelTriangleBatchingRende
58998
59078
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58999
59079
  src.push(" if (clippable) {");
59000
59080
  src.push(" float dist = 0.0;");
59001
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
59081
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
59002
59082
  src.push(" if (sectionPlaneActive" + i + ") {");
59003
59083
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
59004
59084
  src.push(" }");
@@ -59034,7 +59114,7 @@ class TrianglesBatchingPBRRenderer extends VBOSceneModelTriangleBatchingRenderer
59034
59114
  const scene = this._scene;
59035
59115
  const sectionPlanesState = scene._sectionPlanesState;
59036
59116
  const lightsState = scene._lightsState;
59037
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
59117
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
59038
59118
  const clippingCaps = sectionPlanesState.clippingCaps;
59039
59119
 
59040
59120
  const src = [];
@@ -59164,7 +59244,7 @@ class TrianglesBatchingPBRRenderer extends VBOSceneModelTriangleBatchingRenderer
59164
59244
  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
59245
  const sectionPlanesState = scene._sectionPlanesState;
59166
59246
  const lightsState = scene._lightsState;
59167
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
59247
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
59168
59248
  const clippingCaps = sectionPlanesState.clippingCaps;
59169
59249
  const src = [];
59170
59250
 
@@ -59268,7 +59348,7 @@ class TrianglesBatchingPBRRenderer extends VBOSceneModelTriangleBatchingRenderer
59268
59348
  if (clippingCaps) {
59269
59349
  src.push("in vec4 vClipPosition;");
59270
59350
  }
59271
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
59351
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
59272
59352
  src.push("uniform bool sectionPlaneActive" + i + ";");
59273
59353
  src.push("uniform vec3 sectionPlanePos" + i + ";");
59274
59354
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -59441,7 +59521,7 @@ class TrianglesBatchingPBRRenderer extends VBOSceneModelTriangleBatchingRenderer
59441
59521
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
59442
59522
  src.push(" if (clippable) {");
59443
59523
  src.push(" float dist = 0.0;");
59444
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
59524
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
59445
59525
  src.push("if (sectionPlaneActive" + i + ") {");
59446
59526
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
59447
59527
  src.push("}");
@@ -59579,7 +59659,7 @@ class TrianglesBatchingPickNormalsFlatRenderer extends VBOSceneModelTriangleBatc
59579
59659
 
59580
59660
  _buildVertexShader() {
59581
59661
  const scene = this._scene;
59582
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
59662
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
59583
59663
  const src = [];
59584
59664
  src.push("#version 300 es");
59585
59665
  src.push("// Triangles batching pick flat normals vertex shader");
@@ -59638,7 +59718,7 @@ class TrianglesBatchingPickNormalsFlatRenderer extends VBOSceneModelTriangleBatc
59638
59718
  _buildFragmentShader() {
59639
59719
  const scene = this._scene;
59640
59720
  const sectionPlanesState = scene._sectionPlanesState;
59641
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
59721
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
59642
59722
  const src = [];
59643
59723
  src.push("#version 300 es");
59644
59724
  src.push("// Triangles batching pick flat normals fragment shader");
@@ -59658,7 +59738,7 @@ class TrianglesBatchingPickNormalsFlatRenderer extends VBOSceneModelTriangleBatc
59658
59738
  src.push("in vec4 vWorldPosition;");
59659
59739
  if (clipping) {
59660
59740
  src.push("in float vFlags;");
59661
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
59741
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
59662
59742
  src.push("uniform bool sectionPlaneActive" + i + ";");
59663
59743
  src.push("uniform vec3 sectionPlanePos" + i + ";");
59664
59744
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -59670,7 +59750,7 @@ class TrianglesBatchingPickNormalsFlatRenderer extends VBOSceneModelTriangleBatc
59670
59750
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
59671
59751
  src.push(" if (clippable) {");
59672
59752
  src.push(" float dist = 0.0;");
59673
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
59753
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
59674
59754
  src.push(" if (sectionPlaneActive" + i + ") {");
59675
59755
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
59676
59756
  src.push(" }");
@@ -59707,7 +59787,7 @@ class TrianglesBatchingColorTextureRenderer extends VBOSceneModelTriangleBatchin
59707
59787
 
59708
59788
  const scene = this._scene;
59709
59789
  const sectionPlanesState = scene._sectionPlanesState;
59710
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
59790
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
59711
59791
  const src = [];
59712
59792
  src.push("#version 300 es");
59713
59793
  src.push("// Triangles batching color texture vertex shader");
@@ -59784,7 +59864,7 @@ class TrianglesBatchingColorTextureRenderer extends VBOSceneModelTriangleBatchin
59784
59864
  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
59865
  const lightsState = scene._lightsState;
59786
59866
  const sectionPlanesState = scene._sectionPlanesState;
59787
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
59867
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
59788
59868
  const src = [];
59789
59869
  src.push("#version 300 es");
59790
59870
  src.push("// Triangles batching color texture fragment shader");
@@ -59834,7 +59914,7 @@ class TrianglesBatchingColorTextureRenderer extends VBOSceneModelTriangleBatchin
59834
59914
  if (clipping) {
59835
59915
  src.push("in vec4 vWorldPosition;");
59836
59916
  src.push("in float vFlags;");
59837
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
59917
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
59838
59918
  src.push("uniform bool sectionPlaneActive" + i + ";");
59839
59919
  src.push("uniform vec3 sectionPlanePos" + i + ";");
59840
59920
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -59871,7 +59951,7 @@ class TrianglesBatchingColorTextureRenderer extends VBOSceneModelTriangleBatchin
59871
59951
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
59872
59952
  src.push(" if (clippable) {");
59873
59953
  src.push(" float dist = 0.0;");
59874
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
59954
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
59875
59955
  src.push("if (sectionPlaneActive" + i + ") {");
59876
59956
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
59877
59957
  src.push("}");
@@ -60461,7 +60541,7 @@ function octDecodeVec2(oct) { // Decode an oct-encoded normal
60461
60541
  const tempVec3a$r = math.vec3();
60462
60542
  const tempVec3b$n = math.vec3();
60463
60543
  const tempVec3c$k = math.vec3();
60464
- const tempVec3d$g = math.vec3();
60544
+ const tempVec3d$8 = math.vec3();
60465
60545
  const tempMat4a$g = math.mat4();
60466
60546
 
60467
60547
  /**
@@ -60527,7 +60607,7 @@ class SnapBatchingDepthBufInitRenderer extends VBOSceneModelRenderer {
60527
60607
  rtcOrigin[1] += position[1];
60528
60608
  rtcOrigin[2] += position[2];
60529
60609
  rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a$g);
60530
- rtcCameraEye = tempVec3d$g;
60610
+ rtcCameraEye = tempVec3d$8;
60531
60611
  rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];
60532
60612
  rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];
60533
60613
  rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];
@@ -60602,7 +60682,7 @@ class SnapBatchingDepthBufInitRenderer extends VBOSceneModelRenderer {
60602
60682
 
60603
60683
  _buildVertexShader() {
60604
60684
  const scene = this._scene;
60605
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
60685
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
60606
60686
  const src = [];
60607
60687
  src.push ('#version 300 es');
60608
60688
  src.push("// VBO SnapBatchingDepthBufInitRenderer vertex shader");
@@ -60689,7 +60769,7 @@ class SnapBatchingDepthBufInitRenderer extends VBOSceneModelRenderer {
60689
60769
  _buildFragmentShader() {
60690
60770
  const scene = this._scene;
60691
60771
  const sectionPlanesState = scene._sectionPlanesState;
60692
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
60772
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
60693
60773
  const src = [];
60694
60774
  src.push ('#version 300 es');
60695
60775
  src.push("// VBO SnapBatchingDepthBufInitRenderer fragment shader");
@@ -60711,7 +60791,7 @@ class SnapBatchingDepthBufInitRenderer extends VBOSceneModelRenderer {
60711
60791
  src.push("flat in vec4 vPickColor;");
60712
60792
  if (clipping) {
60713
60793
  src.push("in float vFlags;");
60714
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
60794
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
60715
60795
  src.push("uniform bool sectionPlaneActive" + i + ";");
60716
60796
  src.push("uniform vec3 sectionPlanePos" + i + ";");
60717
60797
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -60726,7 +60806,7 @@ class SnapBatchingDepthBufInitRenderer extends VBOSceneModelRenderer {
60726
60806
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
60727
60807
  src.push(" if (clippable) {");
60728
60808
  src.push(" float dist = 0.0;");
60729
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
60809
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
60730
60810
  src.push(" if (sectionPlaneActive" + i + ") {");
60731
60811
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
60732
60812
  src.push(" }");
@@ -60766,7 +60846,7 @@ class SnapBatchingDepthBufInitRenderer extends VBOSceneModelRenderer {
60766
60846
  const tempVec3a$q = math.vec3();
60767
60847
  const tempVec3b$m = math.vec3();
60768
60848
  const tempVec3c$j = math.vec3();
60769
- const tempVec3d$f = math.vec3();
60849
+ const tempVec3d$7 = math.vec3();
60770
60850
  const tempMat4a$f = math.mat4();
60771
60851
 
60772
60852
  /**
@@ -60836,7 +60916,7 @@ class SnapBatchingDepthRenderer extends VBOSceneModelRenderer{
60836
60916
  rtcOrigin[1] += position[1];
60837
60917
  rtcOrigin[2] += position[2];
60838
60918
  rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a$f);
60839
- rtcCameraEye = tempVec3d$f;
60919
+ rtcCameraEye = tempVec3d$7;
60840
60920
  rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];
60841
60921
  rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];
60842
60922
  rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];
@@ -60917,7 +60997,7 @@ class SnapBatchingDepthRenderer extends VBOSceneModelRenderer{
60917
60997
 
60918
60998
  _buildVertexShader() {
60919
60999
  const scene = this._scene;
60920
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
61000
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
60921
61001
  scene.pointsMaterial._state;
60922
61002
  const src = [];
60923
61003
  src.push ('#version 300 es');
@@ -61004,7 +61084,7 @@ class SnapBatchingDepthRenderer extends VBOSceneModelRenderer{
61004
61084
  _buildFragmentShader() {
61005
61085
  const scene = this._scene;
61006
61086
  const sectionPlanesState = scene._sectionPlanesState;
61007
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
61087
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
61008
61088
  const src = [];
61009
61089
  src.push ('#version 300 es');
61010
61090
  src.push("// SnapBatchingDepthRenderer fragment shader");
@@ -61025,7 +61105,7 @@ class SnapBatchingDepthRenderer extends VBOSceneModelRenderer{
61025
61105
  if (clipping) {
61026
61106
  src.push("in vec4 vWorldPosition;");
61027
61107
  src.push("in float vFlags;");
61028
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
61108
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
61029
61109
  src.push("uniform bool sectionPlaneActive" + i + ";");
61030
61110
  src.push("uniform vec3 sectionPlanePos" + i + ";");
61031
61111
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -61038,7 +61118,7 @@ class SnapBatchingDepthRenderer extends VBOSceneModelRenderer{
61038
61118
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
61039
61119
  src.push(" if (clippable) {");
61040
61120
  src.push(" float dist = 0.0;");
61041
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
61121
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
61042
61122
  src.push(" if (sectionPlaneActive" + i + ") {");
61043
61123
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
61044
61124
  src.push(" }");
@@ -61159,8 +61239,8 @@ math.OBB3();
61159
61239
  const tempVec3a$p = math.vec3();
61160
61240
  const tempVec3b$l = math.vec3();
61161
61241
  const tempVec3c$i = math.vec3();
61162
- const tempVec3d$e = math.vec3();
61163
- const tempVec3e$3 = math.vec3();
61242
+ const tempVec3d$6 = math.vec3();
61243
+ const tempVec3e$1 = math.vec3();
61164
61244
  const tempVec3f$1 = math.vec3();
61165
61245
  const tempVec3g$1 = math.vec3();
61166
61246
 
@@ -62351,8 +62431,8 @@ class TrianglesBatchingLayer {
62351
62431
 
62352
62432
  math.transformRay(this.model.worldNormalMatrix, rtcRayOrigin, rtcRayDir, rtcRayOrigin, rtcRayDir); // RTC -> local
62353
62433
 
62354
- const a = tempVec3d$e;
62355
- const b = tempVec3e$3;
62434
+ const a = tempVec3d$6;
62435
+ const b = tempVec3e$1;
62356
62436
  const c = tempVec3f$1;
62357
62437
 
62358
62438
  let gotIntersect = false;
@@ -62475,7 +62555,7 @@ class TrianglesInstancingColorRenderer extends VBOSceneModelTriangleInstancingRe
62475
62555
  const scene = this._scene;
62476
62556
  const sectionPlanesState = scene._sectionPlanesState;
62477
62557
  const lightsState = scene._lightsState;
62478
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
62558
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
62479
62559
  let i;
62480
62560
  let len;
62481
62561
  let light;
@@ -62627,7 +62707,7 @@ class TrianglesInstancingColorRenderer extends VBOSceneModelTriangleInstancingRe
62627
62707
  _buildFragmentShader() {
62628
62708
  const scene = this._scene;
62629
62709
  const sectionPlanesState = scene._sectionPlanesState;
62630
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
62710
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
62631
62711
  const src = [];
62632
62712
  src.push("#version 300 es");
62633
62713
  src.push("// Instancing geometry drawing fragment shader");
@@ -62660,7 +62740,7 @@ class TrianglesInstancingColorRenderer extends VBOSceneModelTriangleInstancingRe
62660
62740
  if (clipping) {
62661
62741
  src.push("in vec4 vWorldPosition;");
62662
62742
  src.push("in float vFlags;");
62663
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
62743
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
62664
62744
  src.push("uniform bool sectionPlaneActive" + i + ";");
62665
62745
  src.push("uniform vec3 sectionPlanePos" + i + ";");
62666
62746
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -62674,7 +62754,7 @@ class TrianglesInstancingColorRenderer extends VBOSceneModelTriangleInstancingRe
62674
62754
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
62675
62755
  src.push(" if (clippable) {");
62676
62756
  src.push(" float dist = 0.0;");
62677
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
62757
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
62678
62758
  src.push("if (sectionPlaneActive" + i + ") {");
62679
62759
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
62680
62760
  src.push("}");
@@ -62720,7 +62800,7 @@ class TrianglesInstancingFlatColorRenderer extends VBOSceneModelTriangleInstanci
62720
62800
  _buildVertexShader() {
62721
62801
  const scene = this._scene;
62722
62802
  const sectionPlanesState = scene._sectionPlanesState;
62723
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
62803
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
62724
62804
  const src = [];
62725
62805
  src.push("#version 300 es");
62726
62806
  src.push("// Instancing geometry flat-shading drawing vertex shader");
@@ -62802,7 +62882,7 @@ class TrianglesInstancingFlatColorRenderer extends VBOSceneModelTriangleInstanci
62802
62882
  const lightsState = scene._lightsState;
62803
62883
  let i;
62804
62884
  let len;
62805
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
62885
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
62806
62886
  const src = [];
62807
62887
  src.push("#version 300 es");
62808
62888
  src.push("// Instancing geometry flat-shading drawing fragment shader");
@@ -62835,7 +62915,7 @@ class TrianglesInstancingFlatColorRenderer extends VBOSceneModelTriangleInstanci
62835
62915
  if (clipping) {
62836
62916
  src.push("in vec4 vWorldPosition;");
62837
62917
  src.push("in float vFlags;");
62838
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
62918
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
62839
62919
  src.push("uniform bool sectionPlaneActive" + i + ";");
62840
62920
  src.push("uniform vec3 sectionPlanePos" + i + ";");
62841
62921
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -62874,7 +62954,7 @@ class TrianglesInstancingFlatColorRenderer extends VBOSceneModelTriangleInstanci
62874
62954
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
62875
62955
  src.push(" if (clippable) {");
62876
62956
  src.push(" float dist = 0.0;");
62877
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
62957
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
62878
62958
  src.push("if (sectionPlaneActive" + i + ") {");
62879
62959
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
62880
62960
  src.push("}");
@@ -62962,7 +63042,7 @@ class TrianglesInstancingSilhouetteRenderer extends VBOSceneModelTriangleInstanc
62962
63042
  _buildVertexShader() {
62963
63043
  const scene = this._scene;
62964
63044
  const sectionPlanesState = scene._sectionPlanesState;
62965
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63045
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
62966
63046
  const src = [];
62967
63047
  src.push("#version 300 es");
62968
63048
  src.push("// Instancing silhouette vertex shader");
@@ -63037,7 +63117,7 @@ class TrianglesInstancingSilhouetteRenderer extends VBOSceneModelTriangleInstanc
63037
63117
  _buildFragmentShader() {
63038
63118
  const scene = this._scene;
63039
63119
  const sectionPlanesState = scene._sectionPlanesState;
63040
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63120
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63041
63121
  const src = [];
63042
63122
  src.push("#version 300 es");
63043
63123
  src.push("// Instancing fill fragment shader");
@@ -63057,7 +63137,7 @@ class TrianglesInstancingSilhouetteRenderer extends VBOSceneModelTriangleInstanc
63057
63137
  if (clipping) {
63058
63138
  src.push("in vec4 vWorldPosition;");
63059
63139
  src.push("in float vFlags;");
63060
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
63140
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63061
63141
  src.push("uniform bool sectionPlaneActive" + i + ";");
63062
63142
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63063
63143
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63070,7 +63150,7 @@ class TrianglesInstancingSilhouetteRenderer extends VBOSceneModelTriangleInstanc
63070
63150
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63071
63151
  src.push(" if (clippable) {");
63072
63152
  src.push(" float dist = 0.0;");
63073
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
63153
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63074
63154
  src.push("if (sectionPlaneActive" + i + ") {");
63075
63155
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63076
63156
  src.push("}");
@@ -63099,7 +63179,7 @@ class TrianglesInstancingEdgesRenderer extends VBOSceneModelTriangleInstancingEd
63099
63179
  _buildVertexShader() {
63100
63180
  const scene = this._scene;
63101
63181
  const sectionPlanesState = scene._sectionPlanesState;
63102
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63182
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63103
63183
  const src = [];
63104
63184
  src.push("#version 300 es");
63105
63185
  src.push("// Triangles instancing edges vertex shader");
@@ -63168,7 +63248,7 @@ class TrianglesInstancingEdgesRenderer extends VBOSceneModelTriangleInstancingEd
63168
63248
  _buildFragmentShader() {
63169
63249
  const scene = this._scene;
63170
63250
  const sectionPlanesState = scene._sectionPlanesState;
63171
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63251
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63172
63252
  const src = [];
63173
63253
  src.push("#version 300 es");
63174
63254
  src.push("// Batched geometry edges drawing fragment shader");
@@ -63188,7 +63268,7 @@ class TrianglesInstancingEdgesRenderer extends VBOSceneModelTriangleInstancingEd
63188
63268
  if (clipping) {
63189
63269
  src.push("in vec4 vWorldPosition;");
63190
63270
  src.push("in float vFlags;");
63191
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
63271
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63192
63272
  src.push("uniform bool sectionPlaneActive" + i + ";");
63193
63273
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63194
63274
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63201,7 +63281,7 @@ class TrianglesInstancingEdgesRenderer extends VBOSceneModelTriangleInstancingEd
63201
63281
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63202
63282
  src.push(" if (clippable) {");
63203
63283
  src.push(" float dist = 0.0;");
63204
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
63284
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63205
63285
  src.push("if (sectionPlaneActive" + i + ") {");
63206
63286
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63207
63287
  src.push("}");
@@ -63226,7 +63306,7 @@ class TrianglesInstancingEdgesColorRenderer extends VBOSceneModelTriangleInstanc
63226
63306
  _buildVertexShader() {
63227
63307
  const scene = this._scene;
63228
63308
  const sectionPlanesState = scene._sectionPlanesState;
63229
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63309
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63230
63310
  const src = [];
63231
63311
  src.push("#version 300 es");
63232
63312
  src.push("// Triangles instancing edges vertex shader");
@@ -63296,7 +63376,7 @@ class TrianglesInstancingEdgesColorRenderer extends VBOSceneModelTriangleInstanc
63296
63376
  _buildFragmentShader() {
63297
63377
  const scene = this._scene;
63298
63378
  const sectionPlanesState = scene._sectionPlanesState;
63299
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63379
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63300
63380
  const src = [];
63301
63381
  src.push("#version 300 es");
63302
63382
  src.push("// Batched geometry edges drawing fragment shader");
@@ -63316,7 +63396,7 @@ class TrianglesInstancingEdgesColorRenderer extends VBOSceneModelTriangleInstanc
63316
63396
  if (clipping) {
63317
63397
  src.push("in vec4 vWorldPosition;");
63318
63398
  src.push("in float vFlags;");
63319
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
63399
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63320
63400
  src.push("uniform bool sectionPlaneActive" + i + ";");
63321
63401
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63322
63402
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63329,7 +63409,7 @@ class TrianglesInstancingEdgesColorRenderer extends VBOSceneModelTriangleInstanc
63329
63409
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63330
63410
  src.push(" if (clippable) {");
63331
63411
  src.push(" float dist = 0.0;");
63332
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
63412
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63333
63413
  src.push("if (sectionPlaneActive" + i + ") {");
63334
63414
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63335
63415
  src.push("}");
@@ -63354,7 +63434,7 @@ class TrianglesInstancingPickMeshRenderer extends VBOSceneModelTriangleInstancin
63354
63434
  _buildVertexShader() {
63355
63435
  const scene = this._scene;
63356
63436
  const sectionPlanesState = scene._sectionPlanesState;
63357
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63437
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63358
63438
  const src = [];
63359
63439
  src.push("#version 300 es");
63360
63440
  src.push("// Instancing geometry picking vertex shader");
@@ -63430,7 +63510,7 @@ class TrianglesInstancingPickMeshRenderer extends VBOSceneModelTriangleInstancin
63430
63510
  _buildFragmentShader() {
63431
63511
  const scene = this._scene;
63432
63512
  const sectionPlanesState = scene._sectionPlanesState;
63433
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63513
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63434
63514
  const src = [];
63435
63515
  src.push("#version 300 es");
63436
63516
  src.push("// Batched geometry picking fragment shader");
@@ -63450,7 +63530,7 @@ class TrianglesInstancingPickMeshRenderer extends VBOSceneModelTriangleInstancin
63450
63530
  if (clipping) {
63451
63531
  src.push("in vec4 vWorldPosition;");
63452
63532
  src.push("in float vFlags;");
63453
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63533
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63454
63534
  src.push("uniform bool sectionPlaneActive" + i + ";");
63455
63535
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63456
63536
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63463,7 +63543,7 @@ class TrianglesInstancingPickMeshRenderer extends VBOSceneModelTriangleInstancin
63463
63543
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63464
63544
  src.push(" if (clippable) {");
63465
63545
  src.push(" float dist = 0.0;");
63466
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63546
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63467
63547
  src.push("if (sectionPlaneActive" + i + ") {");
63468
63548
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63469
63549
  src.push("}");
@@ -63488,7 +63568,7 @@ class TrianglesInstancingPickDepthRenderer extends VBOSceneModelTriangleInstanci
63488
63568
  _buildVertexShader() {
63489
63569
  const scene = this._scene;
63490
63570
  const sectionPlanesState = scene._sectionPlanesState;
63491
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63571
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63492
63572
  const src = [];
63493
63573
  src.push("#version 300 es");
63494
63574
  src.push("// Instancing geometry depth vertex shader");
@@ -63564,7 +63644,7 @@ class TrianglesInstancingPickDepthRenderer extends VBOSceneModelTriangleInstanci
63564
63644
  _buildFragmentShader() {
63565
63645
  const scene = this._scene;
63566
63646
  const sectionPlanesState = scene._sectionPlanesState;
63567
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63647
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63568
63648
  const src = [];
63569
63649
  src.push("#version 300 es");
63570
63650
  src.push("// Batched geometry depth fragment shader");
@@ -63590,7 +63670,7 @@ class TrianglesInstancingPickDepthRenderer extends VBOSceneModelTriangleInstanci
63590
63670
  if (clipping) {
63591
63671
  src.push("in vec4 vWorldPosition;");
63592
63672
  src.push("in float vFlags;");
63593
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63673
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63594
63674
  src.push("uniform bool sectionPlaneActive" + i + ";");
63595
63675
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63596
63676
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63610,7 +63690,7 @@ class TrianglesInstancingPickDepthRenderer extends VBOSceneModelTriangleInstanci
63610
63690
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63611
63691
  src.push(" if (clippable) {");
63612
63692
  src.push(" float dist = 0.0;");
63613
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63693
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63614
63694
  src.push("if (sectionPlaneActive" + i + ") {");
63615
63695
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63616
63696
  src.push("}");
@@ -63636,7 +63716,7 @@ class TrianglesInstancingPickNormalsRenderer extends VBOSceneModelTriangleInstan
63636
63716
  _buildVertexShader() {
63637
63717
  const scene = this._scene;
63638
63718
  const sectionPlanesState = scene._sectionPlanesState;
63639
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63719
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63640
63720
  const src = [];
63641
63721
  src.push("#version 300 es");
63642
63722
  src.push("// Instancing geometry normals vertex shader");
@@ -63717,7 +63797,7 @@ class TrianglesInstancingPickNormalsRenderer extends VBOSceneModelTriangleInstan
63717
63797
  _buildFragmentShader() {
63718
63798
  const scene = this._scene;
63719
63799
  const sectionPlanesState = scene._sectionPlanesState;
63720
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63800
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63721
63801
  const src = [];
63722
63802
  src.push("#version 300 es");
63723
63803
  src.push("// Batched geometry normals fragment shader");
@@ -63741,7 +63821,7 @@ class TrianglesInstancingPickNormalsRenderer extends VBOSceneModelTriangleInstan
63741
63821
  if (clipping) {
63742
63822
  src.push("in vec4 vWorldPosition;");
63743
63823
  src.push("in float vFlags;");
63744
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63824
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63745
63825
  src.push("uniform bool sectionPlaneActive" + i + ";");
63746
63826
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63747
63827
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63754,7 +63834,7 @@ class TrianglesInstancingPickNormalsRenderer extends VBOSceneModelTriangleInstan
63754
63834
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63755
63835
  src.push(" if (clippable) {");
63756
63836
  src.push(" float dist = 0.0;");
63757
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63837
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63758
63838
  src.push("if (sectionPlaneActive" + i + ") {");
63759
63839
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63760
63840
  src.push("}");
@@ -63779,7 +63859,7 @@ class TrianglesInstancingOcclusionRenderer extends VBOSceneModelTriangleInstanci
63779
63859
  _buildVertexShader() {
63780
63860
  const scene = this._scene;
63781
63861
  const sectionPlanesState = scene._sectionPlanesState;
63782
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63862
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63783
63863
  const src = [];
63784
63864
  src.push("#version 300 es");
63785
63865
  src.push("// TrianglesInstancingOcclusionRenderer vertex shader");
@@ -63830,7 +63910,7 @@ class TrianglesInstancingOcclusionRenderer extends VBOSceneModelTriangleInstanci
63830
63910
  _buildFragmentShader() {
63831
63911
  const scene = this._scene;
63832
63912
  const sectionPlanesState = scene._sectionPlanesState;
63833
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63913
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63834
63914
  const src = [];
63835
63915
  src.push("#version 300 es");
63836
63916
  src.push("// TrianglesInstancingOcclusionRenderer fragment shader");
@@ -63845,7 +63925,7 @@ class TrianglesInstancingOcclusionRenderer extends VBOSceneModelTriangleInstanci
63845
63925
  if (clipping) {
63846
63926
  src.push("in vec4 vWorldPosition;");
63847
63927
  src.push("in float vFlags;");
63848
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63928
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63849
63929
  src.push("uniform bool sectionPlaneActive" + i + ";");
63850
63930
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63851
63931
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63857,7 +63937,7 @@ class TrianglesInstancingOcclusionRenderer extends VBOSceneModelTriangleInstanci
63857
63937
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63858
63938
  src.push(" if (clippable) {");
63859
63939
  src.push(" float dist = 0.0;");
63860
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63940
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63861
63941
  src.push("if (sectionPlaneActive" + i + ") {");
63862
63942
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63863
63943
  src.push("}");
@@ -63879,7 +63959,7 @@ class TrianglesInstancingDepthRenderer extends VBOSceneModelTriangleInstancingRe
63879
63959
  _buildVertexShader() {
63880
63960
  const scene = this._scene;
63881
63961
  const sectionPlanesState = scene._sectionPlanesState;
63882
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63962
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63883
63963
  const src = [];
63884
63964
  src.push("#version 300 es");
63885
63965
  src.push("// Instancing geometry depth drawing vertex shader");
@@ -63947,7 +64027,7 @@ class TrianglesInstancingDepthRenderer extends VBOSceneModelTriangleInstancingRe
63947
64027
  const sectionPlanesState = scene._sectionPlanesState;
63948
64028
  let i;
63949
64029
  let len;
63950
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64030
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63951
64031
  const src = [];
63952
64032
  src.push("#version 300 es");
63953
64033
  src.push("// Instancing geometry depth drawing fragment shader");
@@ -63962,7 +64042,7 @@ class TrianglesInstancingDepthRenderer extends VBOSceneModelTriangleInstancingRe
63962
64042
  if (clipping) {
63963
64043
  src.push("in vec4 vWorldPosition;");
63964
64044
  src.push("in float vFlags;");
63965
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64045
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63966
64046
  src.push("uniform bool sectionPlaneActive" + i + ";");
63967
64047
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63968
64048
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63975,7 +64055,7 @@ class TrianglesInstancingDepthRenderer extends VBOSceneModelTriangleInstancingRe
63975
64055
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63976
64056
  src.push(" if (clippable) {");
63977
64057
  src.push(" float dist = 0.0;");
63978
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64058
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63979
64059
  src.push("if (sectionPlaneActive" + i + ") {");
63980
64060
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63981
64061
  src.push("}");
@@ -64001,7 +64081,7 @@ class TrianglesInstancingNormalsRenderer extends VBOSceneModelTriangleInstancing
64001
64081
  _buildVertexShader() {
64002
64082
  const scene = this._scene;
64003
64083
  const sectionPlanesState = scene._sectionPlanesState;
64004
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64084
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64005
64085
  const src = [];
64006
64086
  src.push("#version 300 es");
64007
64087
  src.push("// Instancing geometry normals drawing vertex shader");
@@ -64077,7 +64157,7 @@ class TrianglesInstancingNormalsRenderer extends VBOSceneModelTriangleInstancing
64077
64157
  _buildFragmentShader() {
64078
64158
  const scene = this._scene;
64079
64159
  const sectionPlanesState = scene._sectionPlanesState;
64080
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64160
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64081
64161
  const src = [];
64082
64162
  src.push("#version 300 es");
64083
64163
  src.push("// Instancing geometry depth drawing fragment shader");
@@ -64097,7 +64177,7 @@ class TrianglesInstancingNormalsRenderer extends VBOSceneModelTriangleInstancing
64097
64177
  if (clipping) {
64098
64178
  src.push("in vec4 vWorldPosition;");
64099
64179
  src.push("in float vFlags;");
64100
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64180
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
64101
64181
  src.push("uniform bool sectionPlaneActive" + i + ";");
64102
64182
  src.push("uniform vec3 sectionPlanePos" + i + ";");
64103
64183
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -64113,7 +64193,7 @@ class TrianglesInstancingNormalsRenderer extends VBOSceneModelTriangleInstancing
64113
64193
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
64114
64194
  src.push(" if (clippable) {");
64115
64195
  src.push(" float dist = 0.0;");
64116
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64196
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
64117
64197
  src.push("if (sectionPlaneActive" + i + ") {");
64118
64198
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
64119
64199
  src.push("}");
@@ -64140,7 +64220,7 @@ class TrianglesInstancingShadowRenderer extends VBOSceneModelTriangleInstancingR
64140
64220
  _buildVertexShader() {
64141
64221
  const scene = this._scene;
64142
64222
  const sectionPlanesState = scene._sectionPlanesState;
64143
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64223
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64144
64224
  const src = [];
64145
64225
  src.push("#version 300 es");
64146
64226
  src.push("// Instancing geometry shadow drawing vertex shader");
@@ -64189,7 +64269,7 @@ class TrianglesInstancingShadowRenderer extends VBOSceneModelTriangleInstancingR
64189
64269
  _buildFragmentShader() {
64190
64270
  const scene = this._scene;
64191
64271
  const sectionPlanesState = scene._sectionPlanesState;
64192
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64272
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64193
64273
  const src = [];
64194
64274
  src.push("#version 300 es");
64195
64275
  src.push("// Instancing geometry depth drawing fragment shader");
@@ -64208,7 +64288,7 @@ class TrianglesInstancingShadowRenderer extends VBOSceneModelTriangleInstancingR
64208
64288
  if (clipping) {
64209
64289
  src.push("in vec4 vWorldPosition;");
64210
64290
  src.push("in float vFlags;");
64211
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64291
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
64212
64292
  src.push("uniform bool sectionPlaneActive" + i + ";");
64213
64293
  src.push("uniform vec3 sectionPlanePos" + i + ";");
64214
64294
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -64224,7 +64304,7 @@ class TrianglesInstancingShadowRenderer extends VBOSceneModelTriangleInstancingR
64224
64304
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
64225
64305
  src.push(" if (clippable) {");
64226
64306
  src.push(" float dist = 0.0;");
64227
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64307
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
64228
64308
  src.push("if (sectionPlaneActive" + i + ") {");
64229
64309
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
64230
64310
  src.push("}");
@@ -64263,7 +64343,7 @@ class TrianglesInstancingPBRRenderer extends VBOSceneModelTriangleInstancingRend
64263
64343
  const scene = this._scene;
64264
64344
  const sectionPlanesState = scene._sectionPlanesState;
64265
64345
  const lightsState = scene._lightsState;
64266
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64346
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64267
64347
  const clippingCaps = sectionPlanesState.clippingCaps;
64268
64348
  const src = [];
64269
64349
  src.push("#version 300 es");
@@ -64389,7 +64469,7 @@ class TrianglesInstancingPBRRenderer extends VBOSceneModelTriangleInstancingRend
64389
64469
  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
64470
  const sectionPlanesState = scene._sectionPlanesState;
64391
64471
  const lightsState = scene._lightsState;
64392
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64472
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64393
64473
  const clippingCaps = sectionPlanesState.clippingCaps;
64394
64474
  const src = [];
64395
64475
  src.push("#version 300 es");
@@ -64479,7 +64559,7 @@ class TrianglesInstancingPBRRenderer extends VBOSceneModelTriangleInstancingRend
64479
64559
  if (clippingCaps) {
64480
64560
  src.push("in vec4 vClipPosition;");
64481
64561
  }
64482
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64562
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
64483
64563
  src.push("uniform bool sectionPlaneActive" + i + ";");
64484
64564
  src.push("uniform vec3 sectionPlanePos" + i + ";");
64485
64565
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -64668,7 +64748,7 @@ class TrianglesInstancingPBRRenderer extends VBOSceneModelTriangleInstancingRend
64668
64748
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
64669
64749
  src.push(" if (clippable) {");
64670
64750
  src.push(" float dist = 0.0;");
64671
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64751
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
64672
64752
  src.push("if (sectionPlaneActive" + i + ") {");
64673
64753
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
64674
64754
  src.push("}");
@@ -64808,7 +64888,7 @@ class TrianglesInstancingPickNormalsFlatRenderer extends VBOSceneModelTriangleIn
64808
64888
  _buildVertexShader() {
64809
64889
  const scene = this._scene;
64810
64890
  const sectionPlanesState = scene._sectionPlanesState;
64811
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64891
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64812
64892
  const src = [];
64813
64893
  src.push("#version 300 es");
64814
64894
  src.push("// Instancing geometry normals vertex shader");
@@ -64875,7 +64955,7 @@ class TrianglesInstancingPickNormalsFlatRenderer extends VBOSceneModelTriangleIn
64875
64955
  _buildFragmentShader() {
64876
64956
  const scene = this._scene;
64877
64957
  const sectionPlanesState = scene._sectionPlanesState;
64878
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64958
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64879
64959
  const src = [];
64880
64960
  src.push("#version 300 es");
64881
64961
  src.push("// Batched geometry normals fragment shader");
@@ -64896,7 +64976,7 @@ class TrianglesInstancingPickNormalsFlatRenderer extends VBOSceneModelTriangleIn
64896
64976
  src.push("in vec4 vWorldPosition;");
64897
64977
  if (clipping) {
64898
64978
  src.push("in float vFlags;");
64899
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
64979
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
64900
64980
  src.push("uniform bool sectionPlaneActive" + i + ";");
64901
64981
  src.push("uniform vec3 sectionPlanePos" + i + ";");
64902
64982
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -64908,7 +64988,7 @@ class TrianglesInstancingPickNormalsFlatRenderer extends VBOSceneModelTriangleIn
64908
64988
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
64909
64989
  src.push(" if (clippable) {");
64910
64990
  src.push(" float dist = 0.0;");
64911
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
64991
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
64912
64992
  src.push("if (sectionPlaneActive" + i + ") {");
64913
64993
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
64914
64994
  src.push("}");
@@ -64944,7 +65024,7 @@ class TrianglesInstancingColorTextureRenderer extends VBOSceneModelTriangleInsta
64944
65024
  _buildVertexShader() {
64945
65025
  const scene = this._scene;
64946
65026
  const sectionPlanesState = scene._sectionPlanesState;
64947
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
65027
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64948
65028
  const src = [];
64949
65029
  src.push("#version 300 es");
64950
65030
  src.push("// Instancing geometry drawing vertex shader");
@@ -65031,7 +65111,7 @@ class TrianglesInstancingColorTextureRenderer extends VBOSceneModelTriangleInsta
65031
65111
  const lightsState = scene._lightsState;
65032
65112
  let i;
65033
65113
  let len;
65034
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
65114
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
65035
65115
  const src = [];
65036
65116
  src.push("#version 300 es");
65037
65117
  src.push("// Instancing geometry drawing fragment shader");
@@ -65080,7 +65160,7 @@ class TrianglesInstancingColorTextureRenderer extends VBOSceneModelTriangleInsta
65080
65160
  if (clipping) {
65081
65161
  src.push("in vec4 vWorldPosition;");
65082
65162
  src.push("in float vFlags;");
65083
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
65163
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
65084
65164
  src.push("uniform bool sectionPlaneActive" + i + ";");
65085
65165
  src.push("uniform vec3 sectionPlanePos" + i + ";");
65086
65166
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -65118,7 +65198,7 @@ class TrianglesInstancingColorTextureRenderer extends VBOSceneModelTriangleInsta
65118
65198
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
65119
65199
  src.push(" if (clippable) {");
65120
65200
  src.push(" float dist = 0.0;");
65121
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
65201
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
65122
65202
  src.push("if (sectionPlaneActive" + i + ") {");
65123
65203
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
65124
65204
  src.push("}");
@@ -65530,7 +65610,7 @@ function getInstancingRenderers$1(scene) {
65530
65610
  const tempVec3a$o = math.vec3();
65531
65611
  const tempVec3b$k = math.vec3();
65532
65612
  const tempVec3c$h = math.vec3();
65533
- const tempVec3d$d = math.vec3();
65613
+ const tempVec3d$5 = math.vec3();
65534
65614
  const tempMat4a$e = math.mat4();
65535
65615
 
65536
65616
  /**
@@ -65599,7 +65679,7 @@ class SnapInstancingDepthBufInitRenderer extends VBOSceneModelRenderer {
65599
65679
  rtcOrigin[1] += position[1];
65600
65680
  rtcOrigin[2] += position[2];
65601
65681
  rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a$e);
65602
- rtcCameraEye = tempVec3d$d;
65682
+ rtcCameraEye = tempVec3d$5;
65603
65683
  rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];
65604
65684
  rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];
65605
65685
  rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];
@@ -65699,7 +65779,7 @@ class SnapInstancingDepthBufInitRenderer extends VBOSceneModelRenderer {
65699
65779
  _buildVertexShader() {
65700
65780
  const scene = this._scene;
65701
65781
  const sectionPlanesState = scene._sectionPlanesState;
65702
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
65782
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
65703
65783
  const src = [];
65704
65784
  src.push ('#version 300 es');
65705
65785
  src.push("// SnapInstancingDepthBufInitRenderer vertex shader");
@@ -65789,7 +65869,7 @@ class SnapInstancingDepthBufInitRenderer extends VBOSceneModelRenderer {
65789
65869
  _buildFragmentShader() {
65790
65870
  const scene = this._scene;
65791
65871
  const sectionPlanesState = scene._sectionPlanesState;
65792
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
65872
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
65793
65873
  const src = [];
65794
65874
  src.push ('#version 300 es');
65795
65875
  src.push("// Points instancing pick depth fragment shader");
@@ -65811,7 +65891,7 @@ class SnapInstancingDepthBufInitRenderer extends VBOSceneModelRenderer {
65811
65891
  src.push("flat in vec4 vPickColor;");
65812
65892
  if (clipping) {
65813
65893
  src.push("in float vFlags;");
65814
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
65894
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
65815
65895
  src.push("uniform bool sectionPlaneActive" + i + ";");
65816
65896
  src.push("uniform vec3 sectionPlanePos" + i + ";");
65817
65897
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -65826,7 +65906,7 @@ class SnapInstancingDepthBufInitRenderer extends VBOSceneModelRenderer {
65826
65906
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
65827
65907
  src.push(" if (clippable) {");
65828
65908
  src.push(" float dist = 0.0;");
65829
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
65909
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
65830
65910
  src.push("if (sectionPlaneActive" + i + ") {");
65831
65911
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
65832
65912
  src.push("}");
@@ -65866,7 +65946,7 @@ class SnapInstancingDepthBufInitRenderer extends VBOSceneModelRenderer {
65866
65946
  const tempVec3a$n = math.vec3();
65867
65947
  const tempVec3b$j = math.vec3();
65868
65948
  const tempVec3c$g = math.vec3();
65869
- const tempVec3d$c = math.vec3();
65949
+ const tempVec3d$4 = math.vec3();
65870
65950
  const tempMat4a$d = math.mat4();
65871
65951
 
65872
65952
  /**
@@ -65936,7 +66016,7 @@ class SnapInstancingDepthRenderer extends VBOSceneModelRenderer {
65936
66016
  rtcOrigin[1] += position[1];
65937
66017
  rtcOrigin[2] += position[2];
65938
66018
  rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a$d);
65939
- rtcCameraEye = tempVec3d$c;
66019
+ rtcCameraEye = tempVec3d$4;
65940
66020
  rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];
65941
66021
  rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];
65942
66022
  rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];
@@ -66033,7 +66113,7 @@ class SnapInstancingDepthRenderer extends VBOSceneModelRenderer {
66033
66113
  _buildVertexShader() {
66034
66114
  const scene = this._scene;
66035
66115
  const sectionPlanesState = scene._sectionPlanesState;
66036
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
66116
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
66037
66117
  const src = [];
66038
66118
  src.push ('#version 300 es');
66039
66119
  src.push("// SnapInstancingDepthRenderer vertex shader");
@@ -66121,7 +66201,7 @@ class SnapInstancingDepthRenderer extends VBOSceneModelRenderer {
66121
66201
  _buildFragmentShader() {
66122
66202
  const scene = this._scene;
66123
66203
  const sectionPlanesState = scene._sectionPlanesState;
66124
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
66204
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
66125
66205
  const src = [];
66126
66206
  src.push ('#version 300 es');
66127
66207
  src.push("// SnapInstancingDepthRenderer fragment shader");
@@ -66142,7 +66222,7 @@ class SnapInstancingDepthRenderer extends VBOSceneModelRenderer {
66142
66222
  if (clipping) {
66143
66223
  src.push("in vec4 vWorldPosition;");
66144
66224
  src.push("in float vFlags;");
66145
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
66225
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
66146
66226
  src.push("uniform bool sectionPlaneActive" + i + ";");
66147
66227
  src.push("uniform vec3 sectionPlanePos" + i + ";");
66148
66228
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -66155,7 +66235,7 @@ class SnapInstancingDepthRenderer extends VBOSceneModelRenderer {
66155
66235
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
66156
66236
  src.push(" if (clippable) {");
66157
66237
  src.push(" float dist = 0.0;");
66158
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
66238
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
66159
66239
  src.push("if (sectionPlaneActive" + i + ") {");
66160
66240
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
66161
66241
  src.push("}");
@@ -66276,8 +66356,8 @@ const tempVec3fa$2 = new Float32Array(3);
66276
66356
  const tempVec3a$m = math.vec3();
66277
66357
  const tempVec3b$i = math.vec3();
66278
66358
  const tempVec3c$f = math.vec3();
66279
- const tempVec3d$b = math.vec3();
66280
- const tempVec3e$2 = math.vec3();
66359
+ const tempVec3d$3 = math.vec3();
66360
+ const tempVec3e = math.vec3();
66281
66361
  const tempVec3f = math.vec3();
66282
66362
  const tempVec3g = math.vec3();
66283
66363
 
@@ -67353,8 +67433,8 @@ class TrianglesInstancingLayer {
67353
67433
 
67354
67434
  math.transformRay(portion.inverseMatrix, rtcRayOrigin, rtcRayDir, rtcRayOrigin, rtcRayDir);
67355
67435
 
67356
- const a = tempVec3d$b;
67357
- const b = tempVec3e$2;
67436
+ const a = tempVec3d$3;
67437
+ const b = tempVec3e;
67358
67438
  const c = tempVec3f;
67359
67439
 
67360
67440
  let gotIntersect = false;
@@ -67484,7 +67564,7 @@ class LinesBatchingColorRenderer extends VBOSceneModelLineBatchingRenderer {
67484
67564
  _buildVertexShader() {
67485
67565
  const scene = this._scene;
67486
67566
  const sectionPlanesState = scene._sectionPlanesState;
67487
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
67567
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
67488
67568
  const src = [];
67489
67569
  src.push('#version 300 es');
67490
67570
  src.push("// Lines batching color vertex shader");
@@ -67537,7 +67617,7 @@ class LinesBatchingColorRenderer extends VBOSceneModelLineBatchingRenderer {
67537
67617
  _buildFragmentShader() {
67538
67618
  const scene = this._scene;
67539
67619
  const sectionPlanesState = scene._sectionPlanesState;
67540
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
67620
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
67541
67621
  const src = [];
67542
67622
  src.push('#version 300 es');
67543
67623
  src.push("// Lines batching color fragment shader");
@@ -67555,7 +67635,7 @@ class LinesBatchingColorRenderer extends VBOSceneModelLineBatchingRenderer {
67555
67635
  if (clipping) {
67556
67636
  src.push("in vec4 vWorldPosition;");
67557
67637
  src.push("in float vFlags;");
67558
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
67638
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
67559
67639
  src.push("uniform bool sectionPlaneActive" + i + ";");
67560
67640
  src.push("uniform vec3 sectionPlanePos" + i + ";");
67561
67641
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -67568,7 +67648,7 @@ class LinesBatchingColorRenderer extends VBOSceneModelLineBatchingRenderer {
67568
67648
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
67569
67649
  src.push(" if (clippable) {");
67570
67650
  src.push(" float dist = 0.0;");
67571
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
67651
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
67572
67652
  src.push("if (sectionPlaneActive" + i + ") {");
67573
67653
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
67574
67654
  src.push("}");
@@ -67598,7 +67678,7 @@ class LinesBatchingSilhouetteRenderer extends VBOSceneModelLineBatchingRenderer
67598
67678
 
67599
67679
  const scene = this._scene;
67600
67680
  const sectionPlanesState = scene._sectionPlanesState;
67601
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
67681
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
67602
67682
 
67603
67683
  const src = [];
67604
67684
  src.push('#version 300 es');
@@ -67659,7 +67739,7 @@ class LinesBatchingSilhouetteRenderer extends VBOSceneModelLineBatchingRenderer
67659
67739
 
67660
67740
  const scene = this._scene;
67661
67741
  const sectionPlanesState = scene._sectionPlanesState;
67662
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
67742
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
67663
67743
  const src = [];
67664
67744
  src.push('#version 300 es');
67665
67745
  src.push("// Lines batching silhouette fragment shader");
@@ -67678,7 +67758,7 @@ class LinesBatchingSilhouetteRenderer extends VBOSceneModelLineBatchingRenderer
67678
67758
  if (clipping) {
67679
67759
  src.push("in vec4 vWorldPosition;");
67680
67760
  src.push("in float vFlags;");
67681
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
67761
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
67682
67762
  src.push("uniform bool sectionPlaneActive" + i + ";");
67683
67763
  src.push("uniform vec3 sectionPlanePos" + i + ";");
67684
67764
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -67691,7 +67771,7 @@ class LinesBatchingSilhouetteRenderer extends VBOSceneModelLineBatchingRenderer
67691
67771
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
67692
67772
  src.push(" if (clippable) {");
67693
67773
  src.push(" float dist = 0.0;");
67694
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
67774
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
67695
67775
  src.push("if (sectionPlaneActive" + i + ") {");
67696
67776
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
67697
67777
  src.push("}");
@@ -68539,7 +68619,7 @@ class LinesInstancingColorRenderer extends VBOSceneModelLineInstancingRenderer {
68539
68619
  _buildVertexShader() {
68540
68620
  const scene = this._scene;
68541
68621
  const sectionPlanesState = scene._sectionPlanesState;
68542
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
68622
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
68543
68623
  const src = [];
68544
68624
  src.push('#version 300 es');
68545
68625
  src.push("// Lines instancing color vertex shader");
@@ -68612,7 +68692,7 @@ class LinesInstancingColorRenderer extends VBOSceneModelLineInstancingRenderer {
68612
68692
  const sectionPlanesState = scene._sectionPlanesState;
68613
68693
  let i;
68614
68694
  let len;
68615
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
68695
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
68616
68696
  const src = [];
68617
68697
  src.push('#version 300 es');
68618
68698
  src.push("// Lines instancing color fragment shader");
@@ -68630,7 +68710,7 @@ class LinesInstancingColorRenderer extends VBOSceneModelLineInstancingRenderer {
68630
68710
  if (clipping) {
68631
68711
  src.push("in vec4 vWorldPosition;");
68632
68712
  src.push("in float vFlags;");
68633
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
68713
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
68634
68714
  src.push("uniform bool sectionPlaneActive" + i + ";");
68635
68715
  src.push("uniform vec3 sectionPlanePos" + i + ";");
68636
68716
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -68643,7 +68723,7 @@ class LinesInstancingColorRenderer extends VBOSceneModelLineInstancingRenderer {
68643
68723
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
68644
68724
  src.push(" if (clippable) {");
68645
68725
  src.push(" float dist = 0.0;");
68646
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
68726
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
68647
68727
  src.push("if (sectionPlaneActive" + i + ") {");
68648
68728
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
68649
68729
  src.push("}");
@@ -68686,7 +68766,7 @@ class LinesInstancingSilhouetteRenderer extends VBOSceneModelLineInstancingRende
68686
68766
  _buildVertexShader() {
68687
68767
  const scene = this._scene;
68688
68768
  const sectionPlanesState = scene._sectionPlanesState;
68689
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
68769
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
68690
68770
  const src = [];
68691
68771
  src.push('#version 300 es');
68692
68772
  src.push("// Lines instancing silhouette vertex shader");
@@ -68751,7 +68831,7 @@ class LinesInstancingSilhouetteRenderer extends VBOSceneModelLineInstancingRende
68751
68831
  _buildFragmentShader() {
68752
68832
  const scene = this._scene;
68753
68833
  const sectionPlanesState = scene._sectionPlanesState;
68754
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
68834
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
68755
68835
  const src = [];
68756
68836
  src.push('#version 300 es');
68757
68837
  src.push("// Lines instancing silhouette fragment shader");
@@ -68769,7 +68849,7 @@ class LinesInstancingSilhouetteRenderer extends VBOSceneModelLineInstancingRende
68769
68849
  if (clipping) {
68770
68850
  src.push("in vec4 vWorldPosition;");
68771
68851
  src.push("in float vFlags;");
68772
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
68852
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
68773
68853
  src.push("uniform bool sectionPlaneActive" + i + ";");
68774
68854
  src.push("uniform vec3 sectionPlanePos" + i + ";");
68775
68855
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -68782,7 +68862,7 @@ class LinesInstancingSilhouetteRenderer extends VBOSceneModelLineInstancingRende
68782
68862
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
68783
68863
  src.push(" if (clippable) {");
68784
68864
  src.push(" float dist = 0.0;");
68785
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
68865
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
68786
68866
  src.push("if (sectionPlaneActive" + i + ") {");
68787
68867
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
68788
68868
  src.push("}");
@@ -69561,7 +69641,7 @@ class PointsBatchingColorRenderer extends VBOSceneModelPointBatchingRenderer {
69561
69641
 
69562
69642
  const scene = this._scene;
69563
69643
  const sectionPlanesState = scene._sectionPlanesState;
69564
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
69644
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
69565
69645
  const pointsMaterial = scene.pointsMaterial;
69566
69646
  const src = [];
69567
69647
  src.push('#version 300 es');
@@ -69654,7 +69734,7 @@ class PointsBatchingColorRenderer extends VBOSceneModelPointBatchingRenderer {
69654
69734
 
69655
69735
  const scene = this._scene;
69656
69736
  const sectionPlanesState = scene._sectionPlanesState;
69657
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
69737
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
69658
69738
  const src = [];
69659
69739
  src.push('#version 300 es');
69660
69740
  src.push("// Points batching color fragment shader");
@@ -69673,7 +69753,7 @@ class PointsBatchingColorRenderer extends VBOSceneModelPointBatchingRenderer {
69673
69753
  if (clipping) {
69674
69754
  src.push("in vec4 vWorldPosition;");
69675
69755
  src.push("in float vFlags;");
69676
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
69756
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
69677
69757
  src.push("uniform bool sectionPlaneActive" + i + ";");
69678
69758
  src.push("uniform vec3 sectionPlanePos" + i + ";");
69679
69759
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -69693,7 +69773,7 @@ class PointsBatchingColorRenderer extends VBOSceneModelPointBatchingRenderer {
69693
69773
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
69694
69774
  src.push(" if (clippable) {");
69695
69775
  src.push(" float dist = 0.0;");
69696
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
69776
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
69697
69777
  src.push("if (sectionPlaneActive" + i + ") {");
69698
69778
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
69699
69779
  src.push("}");
@@ -69726,7 +69806,7 @@ class PointsBatchingSilhouetteRenderer extends VBOSceneModelPointBatchingRendere
69726
69806
 
69727
69807
  const scene = this._scene;
69728
69808
  const sectionPlanesState = scene._sectionPlanesState;
69729
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
69809
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
69730
69810
  const pointsMaterial = scene.pointsMaterial._state;
69731
69811
  const src = [];
69732
69812
  src.push ('#version 300 es');
@@ -69799,7 +69879,7 @@ class PointsBatchingSilhouetteRenderer extends VBOSceneModelPointBatchingRendere
69799
69879
  const sectionPlanesState = scene._sectionPlanesState;
69800
69880
  let i;
69801
69881
  let len;
69802
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
69882
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
69803
69883
  const src = [];
69804
69884
  src.push ('#version 300 es');
69805
69885
  src.push("// Points batching silhouette vertex shader");
@@ -69817,7 +69897,7 @@ class PointsBatchingSilhouetteRenderer extends VBOSceneModelPointBatchingRendere
69817
69897
  if (clipping) {
69818
69898
  src.push("in vec4 vWorldPosition;");
69819
69899
  src.push("in float vFlags;");
69820
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
69900
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
69821
69901
  src.push("uniform bool sectionPlaneActive" + i + ";");
69822
69902
  src.push("uniform vec3 sectionPlanePos" + i + ";");
69823
69903
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -69837,7 +69917,7 @@ class PointsBatchingSilhouetteRenderer extends VBOSceneModelPointBatchingRendere
69837
69917
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
69838
69918
  src.push(" if (clippable) {");
69839
69919
  src.push(" float dist = 0.0;");
69840
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
69920
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
69841
69921
  src.push("if (sectionPlaneActive" + i + ") {");
69842
69922
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
69843
69923
  src.push("}");
@@ -69865,7 +69945,7 @@ class PointsBatchingPickMeshRenderer extends VBOSceneModelPointBatchingRenderer
69865
69945
  _buildVertexShader() {
69866
69946
 
69867
69947
  const scene = this._scene;
69868
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
69948
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
69869
69949
  const pointsMaterial = scene.pointsMaterial._state;
69870
69950
  const src = [];
69871
69951
  src.push ('#version 300 es');
@@ -69944,7 +70024,7 @@ class PointsBatchingPickMeshRenderer extends VBOSceneModelPointBatchingRenderer
69944
70024
  _buildFragmentShader() {
69945
70025
  const scene = this._scene;
69946
70026
  const sectionPlanesState = scene._sectionPlanesState;
69947
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
70027
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
69948
70028
  const src = [];
69949
70029
  src.push ('#version 300 es');
69950
70030
  src.push("// Points batching pick mesh vertex shader");
@@ -69962,7 +70042,7 @@ class PointsBatchingPickMeshRenderer extends VBOSceneModelPointBatchingRenderer
69962
70042
  if (clipping) {
69963
70043
  src.push("in vec4 vWorldPosition;");
69964
70044
  src.push("in float vFlags;");
69965
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
70045
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
69966
70046
  src.push("uniform bool sectionPlaneActive" + i + ";");
69967
70047
  src.push("uniform vec3 sectionPlanePos" + i + ";");
69968
70048
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -69982,7 +70062,7 @@ class PointsBatchingPickMeshRenderer extends VBOSceneModelPointBatchingRenderer
69982
70062
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
69983
70063
  src.push(" if (clippable) {");
69984
70064
  src.push(" float dist = 0.0;");
69985
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
70065
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
69986
70066
  src.push(" if (sectionPlaneActive" + i + ") {");
69987
70067
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
69988
70068
  src.push(" }");
@@ -70009,7 +70089,7 @@ class PointsBatchingPickDepthRenderer extends VBOSceneModelPointBatchingRenderer
70009
70089
 
70010
70090
  _buildVertexShader() {
70011
70091
  const scene = this._scene;
70012
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
70092
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
70013
70093
  const pointsMaterial = scene.pointsMaterial._state;
70014
70094
  const src = [];
70015
70095
  src.push ('#version 300 es');
@@ -70083,7 +70163,7 @@ class PointsBatchingPickDepthRenderer extends VBOSceneModelPointBatchingRenderer
70083
70163
  _buildFragmentShader() {
70084
70164
  const scene = this._scene;
70085
70165
  const sectionPlanesState = scene._sectionPlanesState;
70086
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
70166
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
70087
70167
  const src = [];
70088
70168
  src.push ('#version 300 es');
70089
70169
  src.push("// Points batched pick depth fragment shader");
@@ -70107,7 +70187,7 @@ class PointsBatchingPickDepthRenderer extends VBOSceneModelPointBatchingRenderer
70107
70187
  if (clipping) {
70108
70188
  src.push("in vec4 vWorldPosition;");
70109
70189
  src.push("in float vFlags;");
70110
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
70190
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
70111
70191
  src.push("uniform bool sectionPlaneActive" + i + ";");
70112
70192
  src.push("uniform vec3 sectionPlanePos" + i + ";");
70113
70193
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -70134,7 +70214,7 @@ class PointsBatchingPickDepthRenderer extends VBOSceneModelPointBatchingRenderer
70134
70214
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
70135
70215
  src.push(" if (clippable) {");
70136
70216
  src.push(" float dist = 0.0;");
70137
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
70217
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
70138
70218
  src.push(" if (sectionPlaneActive" + i + ") {");
70139
70219
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
70140
70220
  src.push(" }");
@@ -70162,7 +70242,7 @@ class PointsBatchingOcclusionRenderer extends VBOSceneModelPointBatchingRenderer
70162
70242
 
70163
70243
  _buildVertexShader() {
70164
70244
  const scene = this._scene;
70165
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
70245
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
70166
70246
  const pointsMaterial = scene.pointsMaterial._state;
70167
70247
  const src = [];
70168
70248
  src.push ('#version 300 es');
@@ -70230,7 +70310,7 @@ class PointsBatchingOcclusionRenderer extends VBOSceneModelPointBatchingRenderer
70230
70310
  _buildFragmentShader() {
70231
70311
  const scene = this._scene;
70232
70312
  const sectionPlanesState = scene._sectionPlanesState;
70233
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
70313
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
70234
70314
  const src = [];
70235
70315
  src.push ('#version 300 es');
70236
70316
  src.push("// Points batching occlusion fragment shader");
@@ -70248,7 +70328,7 @@ class PointsBatchingOcclusionRenderer extends VBOSceneModelPointBatchingRenderer
70248
70328
  if (clipping) {
70249
70329
  src.push("in vec4 vWorldPosition;");
70250
70330
  src.push("in float vFlags;");
70251
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
70331
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
70252
70332
  src.push("uniform bool sectionPlaneActive" + i + ";");
70253
70333
  src.push("uniform vec3 sectionPlanePos" + i + ";");
70254
70334
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -70267,7 +70347,7 @@ class PointsBatchingOcclusionRenderer extends VBOSceneModelPointBatchingRenderer
70267
70347
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
70268
70348
  src.push(" if (clippable) {");
70269
70349
  src.push(" float dist = 0.0;");
70270
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
70350
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
70271
70351
  src.push(" if (sectionPlaneActive" + i + ") {");
70272
70352
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
70273
70353
  src.push(" }");
@@ -71170,7 +71250,7 @@ class PointsInstancingColorRenderer extends VBOSceneModelPointInstancingRenderer
71170
71250
  _buildVertexShader() {
71171
71251
  const scene = this._scene;
71172
71252
  const sectionPlanesState = scene._sectionPlanesState;
71173
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71253
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71174
71254
  const pointsMaterial = scene.pointsMaterial._state;
71175
71255
  const src = [];
71176
71256
  src.push('#version 300 es');
@@ -71270,7 +71350,7 @@ class PointsInstancingColorRenderer extends VBOSceneModelPointInstancingRenderer
71270
71350
  _buildFragmentShader() {
71271
71351
  const scene = this._scene;
71272
71352
  const sectionPlanesState = scene._sectionPlanesState;
71273
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71353
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71274
71354
  const src = [];
71275
71355
  src.push('#version 300 es');
71276
71356
  src.push("// Points instancing color fragment shader");
@@ -71289,7 +71369,7 @@ class PointsInstancingColorRenderer extends VBOSceneModelPointInstancingRenderer
71289
71369
  if (clipping) {
71290
71370
  src.push("in vec4 vWorldPosition;");
71291
71371
  src.push("in float vFlags;");
71292
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
71372
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
71293
71373
  src.push("uniform bool sectionPlaneActive" + i + ";");
71294
71374
  src.push("uniform vec3 sectionPlanePos" + i + ";");
71295
71375
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -71309,7 +71389,7 @@ class PointsInstancingColorRenderer extends VBOSceneModelPointInstancingRenderer
71309
71389
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
71310
71390
  src.push(" if (clippable) {");
71311
71391
  src.push(" float dist = 0.0;");
71312
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
71392
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
71313
71393
  src.push("if (sectionPlaneActive" + i + ") {");
71314
71394
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
71315
71395
  src.push("}");
@@ -71342,7 +71422,7 @@ class PointsInstancingSilhouetteRenderer extends VBOSceneModelPointInstancingRen
71342
71422
 
71343
71423
  const scene = this._scene;
71344
71424
  const sectionPlanesState = scene._sectionPlanesState;
71345
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71425
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71346
71426
  const pointsMaterial = scene.pointsMaterial._state;
71347
71427
  const src = [];
71348
71428
  src.push ('#version 300 es');
@@ -71424,7 +71504,7 @@ class PointsInstancingSilhouetteRenderer extends VBOSceneModelPointInstancingRen
71424
71504
  _buildFragmentShader() {
71425
71505
  const scene = this._scene;
71426
71506
  const sectionPlanesState = scene._sectionPlanesState;
71427
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71507
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71428
71508
  const src = [];
71429
71509
  src.push ('#version 300 es');
71430
71510
  src.push("// Points instancing silhouette fragment shader");
@@ -71442,7 +71522,7 @@ class PointsInstancingSilhouetteRenderer extends VBOSceneModelPointInstancingRen
71442
71522
  if (clipping) {
71443
71523
  src.push("in vec4 vWorldPosition;");
71444
71524
  src.push("in float vFlags;");
71445
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
71525
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
71446
71526
  src.push("uniform bool sectionPlaneActive" + i + ";");
71447
71527
  src.push("uniform vec3 sectionPlanePos" + i + ";");
71448
71528
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -71462,7 +71542,7 @@ class PointsInstancingSilhouetteRenderer extends VBOSceneModelPointInstancingRen
71462
71542
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
71463
71543
  src.push(" if (clippable) {");
71464
71544
  src.push(" float dist = 0.0;");
71465
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
71545
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
71466
71546
  src.push("if (sectionPlaneActive" + i + ") {");
71467
71547
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
71468
71548
  src.push("}");
@@ -71490,7 +71570,7 @@ class PointsInstancingPickMeshRenderer extends VBOSceneModelPointInstancingRende
71490
71570
  _buildVertexShader() {
71491
71571
  const scene = this._scene;
71492
71572
  const sectionPlanesState = scene._sectionPlanesState;
71493
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71573
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71494
71574
  const pointsMaterial = scene.pointsMaterial._state;
71495
71575
  const src = [];
71496
71576
  src.push ('#version 300 es');
@@ -71573,7 +71653,7 @@ class PointsInstancingPickMeshRenderer extends VBOSceneModelPointInstancingRende
71573
71653
  _buildFragmentShader() {
71574
71654
  const scene = this._scene;
71575
71655
  const sectionPlanesState = scene._sectionPlanesState;
71576
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71656
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71577
71657
  const src = [];
71578
71658
  src.push ('#version 300 es');
71579
71659
  src.push("// Points instancing pick mesh fragment shader");
@@ -71591,7 +71671,7 @@ class PointsInstancingPickMeshRenderer extends VBOSceneModelPointInstancingRende
71591
71671
  if (clipping) {
71592
71672
  src.push("in vec4 vWorldPosition;");
71593
71673
  src.push("in float vFlags;");
71594
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
71674
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
71595
71675
  src.push("uniform bool sectionPlaneActive" + i + ";");
71596
71676
  src.push("uniform vec3 sectionPlanePos" + i + ";");
71597
71677
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -71613,7 +71693,7 @@ class PointsInstancingPickMeshRenderer extends VBOSceneModelPointInstancingRende
71613
71693
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
71614
71694
  src.push(" if (clippable) {");
71615
71695
  src.push(" float dist = 0.0;");
71616
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
71696
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
71617
71697
  src.push("if (sectionPlaneActive" + i + ") {");
71618
71698
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
71619
71699
  src.push("}");
@@ -71641,7 +71721,7 @@ class PointsInstancingPickDepthRenderer extends VBOSceneModelPointInstancingRend
71641
71721
  _buildVertexShader() {
71642
71722
  const scene = this._scene;
71643
71723
  const sectionPlanesState = scene._sectionPlanesState;
71644
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71724
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71645
71725
  const pointsMaterial = scene.pointsMaterial._state;
71646
71726
  const src = [];
71647
71727
 
@@ -71726,7 +71806,7 @@ class PointsInstancingPickDepthRenderer extends VBOSceneModelPointInstancingRend
71726
71806
  _buildFragmentShader() {
71727
71807
  const scene = this._scene;
71728
71808
  const sectionPlanesState = scene._sectionPlanesState;
71729
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71809
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71730
71810
  const src = [];
71731
71811
  src.push ('#version 300 es');
71732
71812
  src.push("// Points instancing pick depth fragment shader");
@@ -71750,7 +71830,7 @@ class PointsInstancingPickDepthRenderer extends VBOSceneModelPointInstancingRend
71750
71830
  if (clipping) {
71751
71831
  src.push("in vec4 vWorldPosition;");
71752
71832
  src.push("in float vFlags;");
71753
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
71833
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
71754
71834
  src.push("uniform bool sectionPlaneActive" + i + ";");
71755
71835
  src.push("uniform vec3 sectionPlanePos" + i + ";");
71756
71836
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -71779,7 +71859,7 @@ class PointsInstancingPickDepthRenderer extends VBOSceneModelPointInstancingRend
71779
71859
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
71780
71860
  src.push(" if (clippable) {");
71781
71861
  src.push(" float dist = 0.0;");
71782
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
71862
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
71783
71863
  src.push("if (sectionPlaneActive" + i + ") {");
71784
71864
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
71785
71865
  src.push("}");
@@ -71809,7 +71889,7 @@ class PointsInstancingOcclusionRenderer extends VBOSceneModelPointInstancingRend
71809
71889
 
71810
71890
  const scene = this._scene;
71811
71891
  const sectionPlanesState = scene._sectionPlanesState;
71812
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71892
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71813
71893
  const pointsMaterial = scene.pointsMaterial._state;
71814
71894
  const src = [];
71815
71895
 
@@ -71891,7 +71971,7 @@ class PointsInstancingOcclusionRenderer extends VBOSceneModelPointInstancingRend
71891
71971
  _buildFragmentShader() {
71892
71972
  const scene = this._scene;
71893
71973
  const sectionPlanesState = scene._sectionPlanesState;
71894
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71974
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71895
71975
  const src = [];
71896
71976
  src.push ('#version 300 es');
71897
71977
  src.push("// Points instancing occlusion vertex shader");
@@ -71909,7 +71989,7 @@ class PointsInstancingOcclusionRenderer extends VBOSceneModelPointInstancingRend
71909
71989
  if (clipping) {
71910
71990
  src.push("in vec4 vWorldPosition;");
71911
71991
  src.push("in float vFlags;");
71912
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
71992
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
71913
71993
  src.push("uniform bool sectionPlaneActive" + i + ";");
71914
71994
  src.push("uniform vec3 sectionPlanePos" + i + ";");
71915
71995
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -71928,7 +72008,7 @@ class PointsInstancingOcclusionRenderer extends VBOSceneModelPointInstancingRend
71928
72008
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
71929
72009
  src.push(" if (clippable) {");
71930
72010
  src.push(" float dist = 0.0;");
71931
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
72011
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
71932
72012
  src.push("if (sectionPlaneActive" + i + ") {");
71933
72013
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
71934
72014
  src.push("}");
@@ -71956,7 +72036,7 @@ class PointsInstancingDepthRenderer extends VBOSceneModelPointInstancingRenderer
71956
72036
  _buildVertexShader() {
71957
72037
  const scene = this._scene;
71958
72038
  const sectionPlanesState = scene._sectionPlanesState;
71959
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
72039
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71960
72040
  const pointsMaterial = scene.pointsMaterial._state;
71961
72041
  const src = [];
71962
72042
  src.push('#version 300 es');
@@ -72029,7 +72109,7 @@ class PointsInstancingDepthRenderer extends VBOSceneModelPointInstancingRenderer
72029
72109
  const sectionPlanesState = scene._sectionPlanesState;
72030
72110
  let i;
72031
72111
  let len;
72032
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
72112
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
72033
72113
  const src = [];
72034
72114
  src.push('#version 300 es');
72035
72115
  src.push("// Points instancing depth vertex shader");
@@ -72047,7 +72127,7 @@ class PointsInstancingDepthRenderer extends VBOSceneModelPointInstancingRenderer
72047
72127
  if (clipping) {
72048
72128
  src.push("in vec4 vWorldPosition;");
72049
72129
  src.push("in float vFlags;");
72050
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
72130
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
72051
72131
  src.push("uniform bool sectionPlaneActive" + i + ";");
72052
72132
  src.push("uniform vec3 sectionPlanePos" + i + ";");
72053
72133
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -72081,7 +72161,7 @@ class PointsInstancingDepthRenderer extends VBOSceneModelPointInstancingRenderer
72081
72161
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
72082
72162
  src.push(" if (clippable) {");
72083
72163
  src.push(" float dist = 0.0;");
72084
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
72164
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
72085
72165
  src.push("if (sectionPlaneActive" + i + ") {");
72086
72166
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
72087
72167
  src.push("}");
@@ -72108,7 +72188,7 @@ class PointsInstancingShadowRenderer extends VBOSceneModelPointInstancingRendere
72108
72188
  _buildVertexShader() {
72109
72189
  const scene = this._scene;
72110
72190
  const sectionPlanesState = scene._sectionPlanesState;
72111
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
72191
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
72112
72192
  const src = [];
72113
72193
  src.push ('#version 300 es');
72114
72194
  src.push("// Instancing geometry shadow drawing vertex shader");
@@ -72159,7 +72239,7 @@ class PointsInstancingShadowRenderer extends VBOSceneModelPointInstancingRendere
72159
72239
  _buildFragmentShader() {
72160
72240
  const scene = this._scene;
72161
72241
  const sectionPlanesState = scene._sectionPlanesState;
72162
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
72242
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
72163
72243
  const src = [];
72164
72244
  src.push ('#version 300 es');
72165
72245
  src.push("// Instancing geometry depth drawing fragment shader");
@@ -72178,7 +72258,7 @@ class PointsInstancingShadowRenderer extends VBOSceneModelPointInstancingRendere
72178
72258
  if (clipping) {
72179
72259
  src.push("in vec4 vWorldPosition;");
72180
72260
  src.push("in float vFlags;");
72181
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
72261
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
72182
72262
  src.push("uniform bool sectionPlaneActive" + i + ";");
72183
72263
  src.push("uniform vec3 sectionPlanePos" + i + ";");
72184
72264
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -72199,7 +72279,7 @@ class PointsInstancingShadowRenderer extends VBOSceneModelPointInstancingRendere
72199
72279
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
72200
72280
  src.push(" if (clippable) {");
72201
72281
  src.push(" float dist = 0.0;");
72202
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
72282
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
72203
72283
  src.push("if (sectionPlaneActive" + i + ") {");
72204
72284
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
72205
72285
  src.push("}");
@@ -74656,7 +74736,7 @@ function doCheckResult(buckets, mesh) {
74656
74736
  const tempVec3a$k = math.vec3();
74657
74737
  const tempVec3b$g = math.vec3();
74658
74738
  const tempVec3c$e = math.vec3();
74659
- const tempVec3d$a = math.vec3();
74739
+ math.vec3();
74660
74740
 
74661
74741
  const tempVec4a$6 = math.vec4();
74662
74742
 
@@ -74755,25 +74835,30 @@ class TrianglesDataTextureColorRenderer {
74755
74835
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
74756
74836
  }
74757
74837
 
74838
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
74758
74839
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
74759
- if (numSectionPlanes > 0) {
74840
+ if (numAllocatedSectionPlanes > 0) {
74760
74841
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
74761
74842
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
74762
74843
  const renderFlags = model.renderFlags;
74763
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
74844
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
74764
74845
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
74765
74846
  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);
74847
+ if (sectionPlaneIndex < numSectionPlanes) {
74848
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
74849
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
74850
+ if (active) {
74851
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
74852
+ if (origin) {
74853
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$k);
74854
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
74855
+ } else {
74856
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
74857
+ }
74858
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
74775
74859
  }
74776
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
74860
+ } else {
74861
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
74777
74862
  }
74778
74863
  }
74779
74864
  }
@@ -74868,7 +74953,7 @@ class TrianglesDataTextureColorRenderer {
74868
74953
 
74869
74954
  this._uSectionPlanes = [];
74870
74955
 
74871
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
74956
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
74872
74957
  this._uSectionPlanes.push({
74873
74958
  active: program.getLocation("sectionPlaneActive" + i),
74874
74959
  pos: program.getLocation("sectionPlanePos" + i),
@@ -74958,7 +75043,7 @@ class TrianglesDataTextureColorRenderer {
74958
75043
  const scene = this._scene;
74959
75044
  const sectionPlanesState = scene._sectionPlanesState;
74960
75045
  const lightsState = scene._lightsState;
74961
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
75046
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
74962
75047
  let light;
74963
75048
  const src = [];
74964
75049
  src.push("#version 300 es");
@@ -75169,7 +75254,7 @@ class TrianglesDataTextureColorRenderer {
75169
75254
  _buildFragmentShader() {
75170
75255
  const scene = this._scene;
75171
75256
  const sectionPlanesState = scene._sectionPlanesState;
75172
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
75257
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
75173
75258
  const src = [];
75174
75259
  src.push('#version 300 es');
75175
75260
  src.push("// TrianglesDataTextureColorRenderer fragment shader");
@@ -75203,7 +75288,7 @@ class TrianglesDataTextureColorRenderer {
75203
75288
  if (clipping) {
75204
75289
  src.push("in vec4 vWorldPosition;");
75205
75290
  src.push("flat in uint vFlags2;");
75206
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
75291
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
75207
75292
  src.push("uniform bool sectionPlaneActive" + i + ";");
75208
75293
  src.push("uniform vec3 sectionPlanePos" + i + ";");
75209
75294
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -75217,7 +75302,7 @@ class TrianglesDataTextureColorRenderer {
75217
75302
  src.push(" bool clippable = vFlags2 > 0u;");
75218
75303
  src.push(" if (clippable) {");
75219
75304
  src.push(" float dist = 0.0;");
75220
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
75305
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
75221
75306
  src.push("if (sectionPlaneActive" + i + ") {");
75222
75307
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
75223
75308
  src.push("}");
@@ -75268,7 +75353,7 @@ const defaultColor$1 = new Float32Array([1, 1, 1]);
75268
75353
  const tempVec3a$j = math.vec3();
75269
75354
  const tempVec3b$f = math.vec3();
75270
75355
  const tempVec3c$d = math.vec3();
75271
- const tempVec3d$9 = math.vec3();
75356
+ math.vec3();
75272
75357
  const tempMat4a$b = math.mat4();
75273
75358
 
75274
75359
  /**
@@ -75383,25 +75468,30 @@ class TrianglesDataTextureSilhouetteRenderer {
75383
75468
  const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2);
75384
75469
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
75385
75470
  }
75471
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
75386
75472
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
75387
- if (numSectionPlanes > 0) {
75473
+ if (numAllocatedSectionPlanes > 0) {
75388
75474
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
75389
75475
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
75390
75476
  const renderFlags = model.renderFlags;
75391
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
75477
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
75392
75478
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
75393
75479
  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);
75480
+ if (sectionPlaneIndex < numSectionPlanes) {
75481
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
75482
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
75483
+ if (active) {
75484
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
75485
+ if (origin) {
75486
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$j);
75487
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
75488
+ } else {
75489
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
75490
+ }
75491
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
75403
75492
  }
75404
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
75493
+ } else {
75494
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
75405
75495
  }
75406
75496
  }
75407
75497
  }
@@ -75503,8 +75593,7 @@ class TrianglesDataTextureSilhouetteRenderer {
75503
75593
  _buildVertexShader() {
75504
75594
 
75505
75595
  const scene = this._scene;
75506
- const sectionPlanesState = scene._sectionPlanesState;
75507
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
75596
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
75508
75597
 
75509
75598
  const src = [];
75510
75599
  src.push("#version 300 es");
@@ -75658,8 +75747,7 @@ class TrianglesDataTextureSilhouetteRenderer {
75658
75747
 
75659
75748
  _buildFragmentShader() {
75660
75749
  const scene = this._scene;
75661
- const sectionPlanesState = scene._sectionPlanesState;
75662
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
75750
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
75663
75751
  const src = [];
75664
75752
  src.push('#version 300 es');
75665
75753
  src.push("// Triangles dataTexture draw fragment shader");
@@ -75678,7 +75766,7 @@ class TrianglesDataTextureSilhouetteRenderer {
75678
75766
  if (clipping) {
75679
75767
  src.push("in vec4 vWorldPosition;");
75680
75768
  src.push("flat in uint vFlags2;");
75681
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
75769
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
75682
75770
  src.push("uniform bool sectionPlaneActive" + i + ";");
75683
75771
  src.push("uniform vec3 sectionPlanePos" + i + ";");
75684
75772
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -75691,7 +75779,7 @@ class TrianglesDataTextureSilhouetteRenderer {
75691
75779
  src.push(" bool clippable = vFlags2 > 0u;");
75692
75780
  src.push(" if (clippable) {");
75693
75781
  src.push(" float dist = 0.0;");
75694
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
75782
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
75695
75783
  src.push("if (sectionPlaneActive" + i + ") {");
75696
75784
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
75697
75785
  src.push("}");
@@ -75725,7 +75813,7 @@ const defaultColor = new Float32Array([0, 0, 0, 1]);
75725
75813
 
75726
75814
  const tempVec3a$i = math.vec3();
75727
75815
  const tempVec3b$e = math.vec3();
75728
- const tempVec3d$8 = math.vec3();
75816
+ math.vec3();
75729
75817
  const tempMat4a$a = math.mat4();
75730
75818
 
75731
75819
  /**
@@ -75830,25 +75918,30 @@ class TrianglesDataTextureEdgesRenderer {
75830
75918
  gl.uniform4fv(this._uColor, defaultColor);
75831
75919
  }
75832
75920
 
75921
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
75833
75922
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
75834
- if (numSectionPlanes > 0) {
75923
+ if (numAllocatedSectionPlanes > 0) {
75835
75924
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
75836
75925
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
75837
75926
  const renderFlags = model.renderFlags;
75838
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
75927
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
75839
75928
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
75840
75929
  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);
75930
+ if (sectionPlaneIndex < numSectionPlanes) {
75931
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
75932
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
75933
+ if (active) {
75934
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
75935
+ if (origin) {
75936
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$i);
75937
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
75938
+ } else {
75939
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
75940
+ }
75941
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
75850
75942
  }
75851
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
75943
+ } else {
75944
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
75852
75945
  }
75853
75946
  }
75854
75947
  }
@@ -75945,8 +76038,7 @@ class TrianglesDataTextureEdgesRenderer {
75945
76038
 
75946
76039
  _buildVertexShader() {
75947
76040
  const scene = this._scene;
75948
- const sectionPlanesState = scene._sectionPlanesState;
75949
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
76041
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
75950
76042
  const src = [];
75951
76043
  src.push("#version 300 es");
75952
76044
  src.push("// Batched geometry edges drawing vertex shader");
@@ -76073,8 +76165,7 @@ class TrianglesDataTextureEdgesRenderer {
76073
76165
 
76074
76166
  _buildFragmentShader() {
76075
76167
  const scene = this._scene;
76076
- const sectionPlanesState = scene._sectionPlanesState;
76077
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
76168
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
76078
76169
  const src = [];
76079
76170
  src.push('#version 300 es');
76080
76171
  src.push("// Batched geometry edges drawing fragment shader");
@@ -76096,7 +76187,7 @@ class TrianglesDataTextureEdgesRenderer {
76096
76187
  if (clipping) {
76097
76188
  src.push("in vec4 vWorldPosition;");
76098
76189
  src.push("flat in uint vFlags2;");
76099
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
76190
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
76100
76191
  src.push("uniform bool sectionPlaneActive" + i + ";");
76101
76192
  src.push("uniform vec3 sectionPlanePos" + i + ";");
76102
76193
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -76109,7 +76200,7 @@ class TrianglesDataTextureEdgesRenderer {
76109
76200
  src.push(" bool clippable = vFlags2 > 0u;");
76110
76201
  src.push(" if (clippable) {");
76111
76202
  src.push(" float dist = 0.0;");
76112
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
76203
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
76113
76204
  src.push("if (sectionPlaneActive" + i + ") {");
76114
76205
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
76115
76206
  src.push("}");
@@ -76301,7 +76392,7 @@ class TrianglesDataTextureEdgesColorRenderer {
76301
76392
  this._uProjMatrix = program.getLocation("projMatrix");
76302
76393
  this._uSectionPlanes = [];
76303
76394
 
76304
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
76395
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
76305
76396
  this._uSectionPlanes.push({
76306
76397
  active: program.getLocation("sectionPlaneActive" + i),
76307
76398
  pos: program.getLocation("sectionPlanePos" + i),
@@ -76347,8 +76438,7 @@ class TrianglesDataTextureEdgesColorRenderer {
76347
76438
 
76348
76439
  _buildVertexShader() {
76349
76440
  const scene = this._scene;
76350
- const sectionPlanesState = scene._sectionPlanesState;
76351
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
76441
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
76352
76442
  const src = [];
76353
76443
  src.push("#version 300 es");
76354
76444
  src.push("// TrianglesDataTextureEdgesColorRenderer");
@@ -76483,8 +76573,7 @@ class TrianglesDataTextureEdgesColorRenderer {
76483
76573
 
76484
76574
  _buildFragmentShader() {
76485
76575
  const scene = this._scene;
76486
- const sectionPlanesState = scene._sectionPlanesState;
76487
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
76576
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
76488
76577
  const src = [];
76489
76578
  src.push('#version 300 es');
76490
76579
  src.push("// TrianglesDataTextureEdgesColorRenderer");
@@ -76503,7 +76592,7 @@ class TrianglesDataTextureEdgesColorRenderer {
76503
76592
  if (clipping) {
76504
76593
  src.push("in vec4 vWorldPosition;");
76505
76594
  src.push("flat in uint vFlags2;");
76506
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
76595
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
76507
76596
  src.push("uniform bool sectionPlaneActive" + i + ";");
76508
76597
  src.push("uniform vec3 sectionPlanePos" + i + ";");
76509
76598
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -76516,7 +76605,7 @@ class TrianglesDataTextureEdgesColorRenderer {
76516
76605
  src.push(" bool clippable = vFlags2 > 0u;");
76517
76606
  src.push(" if (clippable) {");
76518
76607
  src.push(" float dist = 0.0;");
76519
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
76608
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
76520
76609
  src.push("if (sectionPlaneActive" + i + ") {");
76521
76610
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
76522
76611
  src.push("}");
@@ -76525,8 +76614,7 @@ class TrianglesDataTextureEdgesColorRenderer {
76525
76614
  src.push("}");
76526
76615
  }
76527
76616
  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;");
76617
+ src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");
76530
76618
  }
76531
76619
  src.push(" outColor = vColor;");
76532
76620
  src.push("}");
@@ -76634,25 +76722,30 @@ class TrianglesDataTexturePickMeshRenderer {
76634
76722
  const logDepthBufFC = 2.0 / (Math.log(camera.project.far + 1.0) / Math.LN2); // TODO: Far from pick project matrix?
76635
76723
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
76636
76724
  }
76725
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
76637
76726
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
76638
- if (numSectionPlanes > 0) {
76727
+ if (numAllocatedSectionPlanes > 0) {
76639
76728
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
76640
76729
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
76641
76730
  const renderFlags = model.renderFlags;
76642
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
76731
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
76643
76732
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
76644
76733
  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);
76734
+ if (sectionPlaneIndex < numSectionPlanes) {
76735
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
76736
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
76737
+ if (active) {
76738
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
76739
+ if (origin) {
76740
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$g);
76741
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
76742
+ } else {
76743
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
76744
+ }
76745
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
76654
76746
  }
76655
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
76747
+ } else {
76748
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
76656
76749
  }
76657
76750
  }
76658
76751
  }
@@ -76660,8 +76753,8 @@ class TrianglesDataTexturePickMeshRenderer {
76660
76753
  if (state.numIndices8Bits > 0) {
76661
76754
  textureState.bindTriangleIndicesTextures(
76662
76755
  this._program,
76663
- this._uTexturePerPolygonIdPortionIds,
76664
- this._uTexturePerPolygonIdIndices,
76756
+ this._uTexturePerPolygonIdPortionIds,
76757
+ this._uTexturePerPolygonIdIndices,
76665
76758
  8 // 8 bits indices
76666
76759
  );
76667
76760
  gl.drawArrays(gl.TRIANGLES, 0, state.numIndices8Bits);
@@ -76669,8 +76762,8 @@ class TrianglesDataTexturePickMeshRenderer {
76669
76762
  if (state.numIndices16Bits > 0) {
76670
76763
  textureState.bindTriangleIndicesTextures(
76671
76764
  this._program,
76672
- this._uTexturePerPolygonIdPortionIds,
76673
- this._uTexturePerPolygonIdIndices,
76765
+ this._uTexturePerPolygonIdPortionIds,
76766
+ this._uTexturePerPolygonIdIndices,
76674
76767
  16 // 16 bits indices
76675
76768
  );
76676
76769
  gl.drawArrays(gl.TRIANGLES, 0, state.numIndices16Bits);
@@ -76678,8 +76771,8 @@ class TrianglesDataTexturePickMeshRenderer {
76678
76771
  if (state.numIndices32Bits > 0) {
76679
76772
  textureState.bindTriangleIndicesTextures(
76680
76773
  this._program,
76681
- this._uTexturePerPolygonIdPortionIds,
76682
- this._uTexturePerPolygonIdIndices,
76774
+ this._uTexturePerPolygonIdPortionIds,
76775
+ this._uTexturePerPolygonIdIndices,
76683
76776
  32 // 32 bits indices
76684
76777
  );
76685
76778
  gl.drawArrays(gl.TRIANGLES, 0, state.numIndices32Bits);
@@ -76714,14 +76807,14 @@ class TrianglesDataTexturePickMeshRenderer {
76714
76807
  if (scene.logarithmicDepthBufferEnabled) {
76715
76808
  this._uLogDepthBufFC = program.getLocation("logDepthBufFC");
76716
76809
  }
76717
- this.uTexturePerObjectPositionsDecodeMatrix = "uObjectPerObjectPositionsDecodeMatrix";
76718
- this.uTexturePerObjectColorsAndFlags = "uObjectPerObjectColorsAndFlags";
76719
- this._uTexturePerVertexIdCoordinates = "uTexturePerVertexIdCoordinates";
76720
- this._uTexturePerPolygonIdNormals = "uTexturePerPolygonIdNormals";
76721
- this._uTexturePerPolygonIdIndices = "uTexturePerPolygonIdIndices";
76810
+ this.uTexturePerObjectPositionsDecodeMatrix = "uObjectPerObjectPositionsDecodeMatrix";
76811
+ this.uTexturePerObjectColorsAndFlags = "uObjectPerObjectColorsAndFlags";
76812
+ this._uTexturePerVertexIdCoordinates = "uTexturePerVertexIdCoordinates";
76813
+ this._uTexturePerPolygonIdNormals = "uTexturePerPolygonIdNormals";
76814
+ this._uTexturePerPolygonIdIndices = "uTexturePerPolygonIdIndices";
76722
76815
  this._uTexturePerPolygonIdPortionIds = "uTexturePerPolygonIdPortionIds";
76723
- this._uTexturePerObjectMatrix= "uTexturePerObjectMatrix";
76724
- this._uCameraEyeRtc = program.getLocation("uCameraEyeRtc");
76816
+ this._uTexturePerObjectMatrix = "uTexturePerObjectMatrix";
76817
+ this._uCameraEyeRtc = program.getLocation("uCameraEyeRtc");
76725
76818
  }
76726
76819
 
76727
76820
  _bindProgram(frameCtx) {
@@ -76740,7 +76833,7 @@ class TrianglesDataTexturePickMeshRenderer {
76740
76833
 
76741
76834
  _buildVertexShader() {
76742
76835
  const scene = this._scene;
76743
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
76836
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
76744
76837
  const src = [];
76745
76838
  src.push("#version 300 es");
76746
76839
  src.push("// Batched geometry picking vertex shader");
@@ -76775,10 +76868,10 @@ class TrianglesDataTexturePickMeshRenderer {
76775
76868
  src.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;");
76776
76869
  src.push("uniform highp sampler2D uTexturePerObjectMatrix;");
76777
76870
  src.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;");
76778
- src.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;");
76779
- src.push("uniform highp usampler2D uTexturePerPolygonIdIndices;");
76871
+ src.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;");
76872
+ src.push("uniform highp usampler2D uTexturePerPolygonIdIndices;");
76780
76873
  src.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;");
76781
- src.push("uniform vec3 uCameraEyeRtc;");
76874
+ src.push("uniform vec3 uCameraEyeRtc;");
76782
76875
 
76783
76876
  src.push("vec3 positions[3];");
76784
76877
 
@@ -76821,9 +76914,9 @@ class TrianglesDataTexturePickMeshRenderer {
76821
76914
  src.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);");
76822
76915
 
76823
76916
  // 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
-
76917
+ src.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);");
76918
+ src.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);");
76919
+
76827
76920
  // flags.w = NOT_RENDERED | PICK
76828
76921
  // renderPass = PICK
76829
76922
 
@@ -76833,9 +76926,9 @@ class TrianglesDataTexturePickMeshRenderer {
76833
76926
  src.push("} else {");
76834
76927
 
76835
76928
  // get vertex base
76836
- src.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));");
76929
+ src.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));");
76837
76930
 
76838
- src.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));");
76931
+ src.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));");
76839
76932
 
76840
76933
  src.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;");
76841
76934
 
@@ -76844,7 +76937,7 @@ class TrianglesDataTexturePickMeshRenderer {
76844
76937
 
76845
76938
  src.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));");
76846
76939
  src.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;");
76847
-
76940
+
76848
76941
  src.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;");
76849
76942
  src.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;");
76850
76943
 
@@ -76852,7 +76945,7 @@ class TrianglesDataTexturePickMeshRenderer {
76852
76945
 
76853
76946
  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
76947
 
76855
- src.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;");
76948
+ src.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;");
76856
76949
 
76857
76950
  // get position
76858
76951
  src.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));");
@@ -76860,7 +76953,7 @@ class TrianglesDataTexturePickMeshRenderer {
76860
76953
  src.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));");
76861
76954
 
76862
76955
  // get color
76863
- src.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);");
76956
+ src.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);");
76864
76957
 
76865
76958
  src.push(`if (color.a == 0u) {`);
76866
76959
  src.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"); // Cull vertex
@@ -76878,17 +76971,17 @@ class TrianglesDataTexturePickMeshRenderer {
76878
76971
 
76879
76972
  // when the geometry is not solid, if needed, flip the triangle winding
76880
76973
  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("}");
76974
+ src.push("if (isPerspectiveMatrix(projMatrix)) {");
76975
+ src.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;");
76976
+ src.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {");
76977
+ src.push("position = positions[2 - (gl_VertexID % 3)];");
76978
+ src.push("}");
76979
+ src.push("} else {");
76980
+ src.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);");
76981
+ src.push("if (viewNormal.z < 0.0) {");
76982
+ src.push("position = positions[2 - (gl_VertexID % 3)];");
76983
+ src.push("}");
76984
+ src.push("}");
76892
76985
  src.push("}");
76893
76986
 
76894
76987
  src.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); ");
@@ -76912,10 +77005,9 @@ class TrianglesDataTexturePickMeshRenderer {
76912
77005
 
76913
77006
  _buildFragmentShader() {
76914
77007
  const scene = this._scene;
76915
- const sectionPlanesState = scene._sectionPlanesState;
76916
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
77008
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
76917
77009
  const src = [];
76918
- src.push ('#version 300 es');
77010
+ src.push('#version 300 es');
76919
77011
  src.push("// Batched geometry picking fragment shader");
76920
77012
  src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");
76921
77013
  src.push("precision highp float;");
@@ -76932,7 +77024,7 @@ class TrianglesDataTexturePickMeshRenderer {
76932
77024
  if (clipping) {
76933
77025
  src.push("in vec4 vWorldPosition;");
76934
77026
  src.push("flat in uvec4 vFlags2;");
76935
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
77027
+ for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
76936
77028
  src.push("uniform bool sectionPlaneActive" + i + ";");
76937
77029
  src.push("uniform vec3 sectionPlanePos" + i + ";");
76938
77030
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -76945,7 +77037,7 @@ class TrianglesDataTexturePickMeshRenderer {
76945
77037
  src.push(" bool clippable = (float(vFlags2.x) > 0.0);");
76946
77038
  src.push(" if (clippable) {");
76947
77039
  src.push(" float dist = 0.0;");
76948
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
77040
+ for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
76949
77041
  src.push(" if (sectionPlaneActive" + i + ") {");
76950
77042
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
76951
77043
  src.push(" }");
@@ -76954,7 +77046,7 @@ class TrianglesDataTexturePickMeshRenderer {
76954
77046
  src.push(" }");
76955
77047
  }
76956
77048
  if (scene.logarithmicDepthBufferEnabled) {
76957
- src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");
77049
+ src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");
76958
77050
  //src.push(" gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;");
76959
77051
  }
76960
77052
  src.push(" outPickColor = vPickColor; ");
@@ -76977,7 +77069,7 @@ class TrianglesDataTexturePickMeshRenderer {
76977
77069
  const tempVec3a$f = math.vec3();
76978
77070
  const tempVec3b$b = math.vec3();
76979
77071
  const tempVec3c$a = math.vec3();
76980
- const tempVec3d$7 = math.vec3();
77072
+ math.vec3();
76981
77073
  const tempMat4a$7 = math.mat4();
76982
77074
 
76983
77075
  /**
@@ -77078,25 +77170,30 @@ class TrianglesDataTexturePickDepthRenderer {
77078
77170
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
77079
77171
  }
77080
77172
 
77173
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
77081
77174
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
77082
- if (numSectionPlanes > 0) {
77175
+ if (numAllocatedSectionPlanes > 0) {
77083
77176
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
77084
77177
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
77085
77178
  const renderFlags = model.renderFlags;
77086
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
77179
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
77087
77180
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
77088
77181
  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);
77182
+ if (sectionPlaneIndex < numSectionPlanes) {
77183
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
77184
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
77185
+ if (active) {
77186
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
77187
+ if (origin) {
77188
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$f);
77189
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
77190
+ } else {
77191
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
77192
+ }
77193
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
77098
77194
  }
77099
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
77195
+ } else {
77196
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
77100
77197
  }
77101
77198
  }
77102
77199
  }
@@ -77148,7 +77245,7 @@ class TrianglesDataTexturePickDepthRenderer {
77148
77245
  this._uViewMatrix = program.getLocation("viewMatrix");
77149
77246
  this._uProjMatrix = program.getLocation("projMatrix");
77150
77247
  this._uSectionPlanes = [];
77151
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
77248
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
77152
77249
  this._uSectionPlanes.push({
77153
77250
  active: program.getLocation("sectionPlaneActive" + i),
77154
77251
  pos: program.getLocation("sectionPlanePos" + i),
@@ -77184,7 +77281,7 @@ class TrianglesDataTexturePickDepthRenderer {
77184
77281
  _buildVertexShader() {
77185
77282
 
77186
77283
  const scene = this._scene;
77187
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
77284
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
77188
77285
  const src = [];
77189
77286
  src.push("#version 300 es");
77190
77287
  src.push("// Triangles dataTexture pick depth vertex shader");
@@ -77352,8 +77449,7 @@ class TrianglesDataTexturePickDepthRenderer {
77352
77449
  _buildFragmentShader() {
77353
77450
 
77354
77451
  const scene = this._scene;
77355
- const sectionPlanesState = scene._sectionPlanesState;
77356
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
77452
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
77357
77453
  const src = [];
77358
77454
  src.push('#version 300 es');
77359
77455
  src.push("// Triangles dataTexture pick depth fragment shader");
@@ -77378,7 +77474,7 @@ class TrianglesDataTexturePickDepthRenderer {
77378
77474
  if (clipping) {
77379
77475
  src.push("in vec4 vWorldPosition;");
77380
77476
  src.push("flat in uint vFlags2;");
77381
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
77477
+ for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
77382
77478
  src.push("uniform bool sectionPlaneActive" + i + ";");
77383
77479
  src.push("uniform vec3 sectionPlanePos" + i + ";");
77384
77480
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -77399,7 +77495,7 @@ class TrianglesDataTexturePickDepthRenderer {
77399
77495
  src.push(" bool clippable = vFlags2 > 0u;");
77400
77496
  src.push(" if (clippable) {");
77401
77497
  src.push(" float dist = 0.0;");
77402
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
77498
+ for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
77403
77499
  src.push(" if (sectionPlaneActive" + i + ") {");
77404
77500
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
77405
77501
  src.push(" }");
@@ -77431,8 +77527,8 @@ class TrianglesDataTexturePickDepthRenderer {
77431
77527
  const tempVec3a$e = math.vec3();
77432
77528
  const tempVec3b$a = math.vec3();
77433
77529
  const tempVec3c$9 = math.vec3();
77434
- const tempVec3d$6 = math.vec3();
77435
- const tempVec3e$1 = math.vec3();
77530
+ const tempVec3d$2 = math.vec3();
77531
+ math.vec3();
77436
77532
  const tempMat4a$6 = math.mat4();
77437
77533
 
77438
77534
  /**
@@ -77517,7 +77613,7 @@ class TrianglesDataTextureSnapDepthRenderer {
77517
77613
  rtcOrigin[1] += position[1];
77518
77614
  rtcOrigin[2] += position[2];
77519
77615
  rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a$6);
77520
- rtcCameraEye = tempVec3d$6;
77616
+ rtcCameraEye = tempVec3d$2;
77521
77617
  rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];
77522
77618
  rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];
77523
77619
  rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];
@@ -77546,25 +77642,30 @@ class TrianglesDataTextureSnapDepthRenderer {
77546
77642
  const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2);
77547
77643
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
77548
77644
  }
77645
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
77549
77646
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
77550
- if (numSectionPlanes > 0) {
77647
+ if (numAllocatedSectionPlanes > 0) {
77551
77648
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
77552
77649
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
77553
77650
  const renderFlags = model.renderFlags;
77554
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
77651
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
77555
77652
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
77556
77653
  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);
77654
+ if (sectionPlaneIndex < numSectionPlanes) {
77655
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
77656
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
77657
+ if (active) {
77658
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
77659
+ if (origin) {
77660
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$e);
77661
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
77662
+ } else {
77663
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
77664
+ }
77665
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
77566
77666
  }
77567
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
77667
+ } else {
77668
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
77568
77669
  }
77569
77670
  }
77570
77671
  }
@@ -77652,8 +77753,7 @@ class TrianglesDataTextureSnapDepthRenderer {
77652
77753
 
77653
77754
  _buildVertexShader() {
77654
77755
  const scene = this._scene;
77655
- const sectionPlanesState = scene._sectionPlanesState;
77656
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
77756
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
77657
77757
  const src = [];
77658
77758
  src.push("#version 300 es");
77659
77759
  src.push("// Batched geometry edges drawing vertex shader");
@@ -77784,8 +77884,7 @@ class TrianglesDataTextureSnapDepthRenderer {
77784
77884
  _buildFragmentShader() {
77785
77885
 
77786
77886
  const scene = this._scene;
77787
- const sectionPlanesState = scene._sectionPlanesState;
77788
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
77887
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
77789
77888
  const src = [];
77790
77889
  src.push('#version 300 es');
77791
77890
  src.push("// Triangles dataTexture pick depth fragment shader");
@@ -77806,7 +77905,7 @@ class TrianglesDataTextureSnapDepthRenderer {
77806
77905
  if (clipping) {
77807
77906
  src.push("in vec4 vWorldPosition;");
77808
77907
  src.push("flat in uint vFlags2;");
77809
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
77908
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
77810
77909
  src.push("uniform bool sectionPlaneActive" + i + ";");
77811
77910
  src.push("uniform vec3 sectionPlanePos" + i + ";");
77812
77911
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -77819,7 +77918,7 @@ class TrianglesDataTextureSnapDepthRenderer {
77819
77918
  src.push(" bool clippable = vFlags2 > 0u;");
77820
77919
  src.push(" if (clippable) {");
77821
77920
  src.push(" float dist = 0.0;");
77822
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
77921
+ for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
77823
77922
  src.push(" if (sectionPlaneActive" + i + ") {");
77824
77923
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
77825
77924
  src.push(" }");
@@ -77850,8 +77949,8 @@ class TrianglesDataTextureSnapDepthRenderer {
77850
77949
  const tempVec3a$d = math.vec3();
77851
77950
  const tempVec3b$9 = math.vec3();
77852
77951
  const tempVec3c$8 = math.vec3();
77853
- const tempVec3d$5 = math.vec3();
77854
- const tempVec3e = math.vec3();
77952
+ const tempVec3d$1 = math.vec3();
77953
+ math.vec3();
77855
77954
  const tempMat4a$5 = math.mat4();
77856
77955
  /**
77857
77956
  * @private
@@ -77931,7 +78030,7 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
77931
78030
  rtcOrigin[1] += position[1];
77932
78031
  rtcOrigin[2] += position[2];
77933
78032
  rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a$5);
77934
- rtcCameraEye = tempVec3d$5;
78033
+ rtcCameraEye = tempVec3d$1;
77935
78034
  rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];
77936
78035
  rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];
77937
78036
  rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];
@@ -77960,25 +78059,30 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
77960
78059
  const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2);
77961
78060
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
77962
78061
  }
78062
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
77963
78063
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
77964
- if (numSectionPlanes > 0) {
78064
+ if (numAllocatedSectionPlanes > 0) {
77965
78065
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
77966
78066
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
77967
78067
  const renderFlags = model.renderFlags;
77968
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
78068
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
77969
78069
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
77970
78070
  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);
78071
+ if (sectionPlaneIndex < numSectionPlanes) {
78072
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
78073
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
78074
+ if (active) {
78075
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
78076
+ if (origin) {
78077
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$d);
78078
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
78079
+ } else {
78080
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
78081
+ }
78082
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
77980
78083
  }
77981
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
78084
+ } else {
78085
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
77982
78086
  }
77983
78087
  }
77984
78088
  }
@@ -78064,8 +78168,7 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
78064
78168
 
78065
78169
  _buildVertexShader() {
78066
78170
  const scene = this._scene;
78067
- const sectionPlanesState = scene._sectionPlanesState;
78068
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
78171
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
78069
78172
  const src = [];
78070
78173
  src.push("#version 300 es");
78071
78174
  src.push("// TrianglesDataTextureSnapDepthBufInitRenderer vertex shader");
@@ -78227,8 +78330,7 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
78227
78330
 
78228
78331
  _buildFragmentShader() {
78229
78332
  const scene = this._scene;
78230
- const sectionPlanesState = scene._sectionPlanesState;
78231
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
78333
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
78232
78334
  const src = [];
78233
78335
  src.push('#version 300 es');
78234
78336
  src.push("// TrianglesDataTextureSnapDepthBufInitRenderer fragment shader");
@@ -78250,7 +78352,7 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
78250
78352
  src.push("flat in vec4 vPickColor;");
78251
78353
  if (clipping) {
78252
78354
  src.push("flat in uint vFlags2;");
78253
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
78355
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
78254
78356
  src.push("uniform bool sectionPlaneActive" + i + ";");
78255
78357
  src.push("uniform vec3 sectionPlanePos" + i + ";");
78256
78358
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -78265,7 +78367,7 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
78265
78367
  src.push(" bool clippable = vFlags2 > 0u;");
78266
78368
  src.push(" if (clippable) {");
78267
78369
  src.push(" float dist = 0.0;");
78268
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
78370
+ for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
78269
78371
  src.push(" if (sectionPlaneActive" + i + ") {");
78270
78372
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
78271
78373
  src.push(" }");
@@ -78305,7 +78407,7 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
78305
78407
  const tempVec3a$c = math.vec3();
78306
78408
  const tempVec3b$8 = math.vec3();
78307
78409
  const tempVec3c$7 = math.vec3();
78308
- const tempVec3d$4 = math.vec3();
78410
+ math.vec3();
78309
78411
  const tempMat4a$4 = math.mat4();
78310
78412
 
78311
78413
  /**
@@ -78395,25 +78497,30 @@ class TrianglesDataTextureOcclusionRenderer {
78395
78497
 
78396
78498
  gl.uniformMatrix4fv(this._uProjMatrix, false, camera.projMatrix);
78397
78499
 
78500
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
78398
78501
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
78399
- if (numSectionPlanes > 0) {
78502
+ if (numAllocatedSectionPlanes > 0) {
78400
78503
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
78401
78504
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
78402
78505
  const renderFlags = model.renderFlags;
78403
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
78506
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
78404
78507
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
78405
78508
  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);
78509
+ if (sectionPlaneIndex < numSectionPlanes) {
78510
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
78511
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
78512
+ if (active) {
78513
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
78514
+ if (origin) {
78515
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$c);
78516
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
78517
+ } else {
78518
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
78519
+ }
78520
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
78415
78521
  }
78416
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
78522
+ } else {
78523
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
78417
78524
  }
78418
78525
  }
78419
78526
  }
@@ -78464,7 +78571,7 @@ class TrianglesDataTextureOcclusionRenderer {
78464
78571
  this._uViewMatrix = program.getLocation("viewMatrix");
78465
78572
  this._uProjMatrix = program.getLocation("projMatrix");
78466
78573
  this._uSectionPlanes = [];
78467
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
78574
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
78468
78575
  this._uSectionPlanes.push({
78469
78576
  active: program.getLocation("sectionPlaneActive" + i),
78470
78577
  pos: program.getLocation("sectionPlanePos" + i),
@@ -78504,7 +78611,7 @@ class TrianglesDataTextureOcclusionRenderer {
78504
78611
 
78505
78612
  _buildVertexShader() {
78506
78613
  const scene = this._scene;
78507
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
78614
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
78508
78615
  const src = [];
78509
78616
  src.push("#version 300 es");
78510
78617
  src.push("// TrianglesDataTextureOcclusionRenderer vertex shader");
@@ -78645,7 +78752,7 @@ class TrianglesDataTextureOcclusionRenderer {
78645
78752
  _buildFragmentShader() {
78646
78753
  const scene = this._scene;
78647
78754
  const sectionPlanesState = scene._sectionPlanesState;
78648
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
78755
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
78649
78756
  const src = [];
78650
78757
  src.push('#version 300 es');
78651
78758
  src.push("// TrianglesDataTextureColorRenderer fragment shader");
@@ -78659,7 +78766,7 @@ class TrianglesDataTextureOcclusionRenderer {
78659
78766
  if (clipping) {
78660
78767
  src.push("in vec4 vWorldPosition;");
78661
78768
  src.push("flat in uint vFlags2;");
78662
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
78769
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
78663
78770
  src.push("uniform bool sectionPlaneActive" + i + ";");
78664
78771
  src.push("uniform vec3 sectionPlanePos" + i + ";");
78665
78772
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -78671,7 +78778,7 @@ class TrianglesDataTextureOcclusionRenderer {
78671
78778
  src.push(" bool clippable = (float(vFlags2) > 0.0);");
78672
78779
  src.push(" if (clippable) {");
78673
78780
  src.push(" float dist = 0.0;");
78674
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
78781
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
78675
78782
  src.push(" if (sectionPlaneActive" + i + ") {");
78676
78783
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
78677
78784
  src.push(" }");
@@ -78699,7 +78806,7 @@ class TrianglesDataTextureOcclusionRenderer {
78699
78806
  const tempVec3a$b = math.vec3();
78700
78807
  const tempVec3b$7 = math.vec3();
78701
78808
  const tempVec3c$6 = math.vec3();
78702
- const tempVec3d$3 = math.vec3();
78809
+ math.vec3();
78703
78810
  const tempMat4a$3 = math.mat4();
78704
78811
 
78705
78812
  /**
@@ -78793,25 +78900,30 @@ class TrianglesDataTextureDepthRenderer {
78793
78900
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
78794
78901
  }
78795
78902
 
78903
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
78796
78904
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
78797
- if (numSectionPlanes > 0) {
78905
+ if (numAllocatedSectionPlanes > 0) {
78798
78906
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
78799
78907
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
78800
78908
  const renderFlags = model.renderFlags;
78801
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
78909
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
78802
78910
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
78803
78911
  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);
78912
+ if (sectionPlaneIndex < numSectionPlanes) {
78913
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
78914
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
78915
+ if (active) {
78916
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
78917
+ if (origin) {
78918
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$b);
78919
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
78920
+ } else {
78921
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
78922
+ }
78923
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
78813
78924
  }
78814
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
78925
+ } else {
78926
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
78815
78927
  }
78816
78928
  }
78817
78929
  }
@@ -78922,9 +79034,7 @@ class TrianglesDataTextureDepthRenderer {
78922
79034
 
78923
79035
  _buildVertexShader() {
78924
79036
  const scene = this._scene;
78925
- const sectionPlanesState = scene._sectionPlanesState;
78926
- scene._lightsState;
78927
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
79037
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
78928
79038
  const src = [];
78929
79039
  src.push("#version 300 es");
78930
79040
  src.push("// Triangles dataTexture draw vertex shader");
@@ -79085,8 +79195,7 @@ class TrianglesDataTextureDepthRenderer {
79085
79195
 
79086
79196
  _buildFragmentShader() {
79087
79197
  const scene = this._scene;
79088
- const sectionPlanesState = scene._sectionPlanesState;
79089
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
79198
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
79090
79199
  const src = [];
79091
79200
  src.push('#version 300 es');
79092
79201
  src.push("// Triangles dataTexture draw fragment shader");
@@ -79109,7 +79218,7 @@ class TrianglesDataTextureDepthRenderer {
79109
79218
  if (clipping) {
79110
79219
  src.push("in vec4 vWorldPosition;");
79111
79220
  src.push("flat in uint vFlags2;");
79112
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
79221
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
79113
79222
  src.push("uniform bool sectionPlaneActive" + i + ";");
79114
79223
  src.push("uniform vec3 sectionPlanePos" + i + ";");
79115
79224
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -79121,7 +79230,7 @@ class TrianglesDataTextureDepthRenderer {
79121
79230
  src.push(" bool clippable = vFlags2 > 0u;");
79122
79231
  src.push(" if (clippable) {");
79123
79232
  src.push(" float dist = 0.0;");
79124
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
79233
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
79125
79234
  src.push("if (sectionPlaneActive" + i + ") {");
79126
79235
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
79127
79236
  src.push("}");
@@ -79157,7 +79266,7 @@ class TrianglesDataTextureDepthRenderer {
79157
79266
  const tempVec3a$a = math.vec3();
79158
79267
  const tempVec3b$6 = math.vec3();
79159
79268
  const tempVec3c$5 = math.vec3();
79160
- const tempVec3d$2 = math.vec3();
79269
+ math.vec3();
79161
79270
  const tempMat4a$2 = math.mat4();
79162
79271
 
79163
79272
  /**
@@ -79242,25 +79351,30 @@ class TrianglesDataTextureNormalsRenderer {
79242
79351
  gl.uniformMatrix4fv(this._uViewNormalMatrix, false, camera.viewNormalMatrix);
79243
79352
  gl.uniformMatrix4fv(this._uWorldNormalMatrix, false, model.worldNormalMatrix);
79244
79353
 
79354
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
79245
79355
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
79246
- if (numSectionPlanes > 0) {
79356
+ if (numAllocatedSectionPlanes > 0) {
79247
79357
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
79248
79358
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
79249
79359
  const renderFlags = model.renderFlags;
79250
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
79360
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
79251
79361
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
79252
79362
  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);
79363
+ if (sectionPlaneIndex < numSectionPlanes) {
79364
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
79365
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
79366
+ if (active) {
79367
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
79368
+ if (origin) {
79369
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$a);
79370
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
79371
+ } else {
79372
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
79373
+ }
79374
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
79262
79375
  }
79263
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
79376
+ } else {
79377
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
79264
79378
  }
79265
79379
  }
79266
79380
  }
@@ -79298,7 +79412,7 @@ class TrianglesDataTextureNormalsRenderer {
79298
79412
  this._uViewNormalMatrix = program.getLocation("viewNormalMatrix");
79299
79413
  this._uProjMatrix = program.getLocation("projMatrix");
79300
79414
  this._uSectionPlanes = [];
79301
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
79415
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
79302
79416
  this._uSectionPlanes.push({
79303
79417
  active: program.getLocation("sectionPlaneActive" + i),
79304
79418
  pos: program.getLocation("sectionPlanePos" + i),
@@ -79339,7 +79453,7 @@ class TrianglesDataTextureNormalsRenderer {
79339
79453
 
79340
79454
  _buildVertexShader() {
79341
79455
  const scene = this._scene;
79342
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
79456
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
79343
79457
  const src = [];
79344
79458
  src.push("// Batched geometry normals vertex shader");
79345
79459
  if (scene.logarithmicDepthBufferEnabled && WEBGL_INFO.SUPPORTED_EXTENSIONS["EXT_frag_depth"]) {
@@ -79421,8 +79535,7 @@ class TrianglesDataTextureNormalsRenderer {
79421
79535
 
79422
79536
  _buildFragmentShader() {
79423
79537
  const scene = this._scene;
79424
- const sectionPlanesState = scene._sectionPlanesState;
79425
- const clipping = (sectionPlanesState.sectionPlanes.length > 0);
79538
+ const clipping = (scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0);
79426
79539
  const src = [];
79427
79540
  src.push("#version 300 es");
79428
79541
  src.push("// Batched geometry normals fragment shader");
@@ -79448,7 +79561,7 @@ class TrianglesDataTextureNormalsRenderer {
79448
79561
  if (clipping) {
79449
79562
  src.push("in vec4 vWorldPosition;");
79450
79563
  src.push("in vec4 vFlags2;");
79451
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
79564
+ for (let i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
79452
79565
  src.push("uniform bool sectionPlaneActive" + i + ";");
79453
79566
  src.push("uniform vec3 sectionPlanePos" + i + ";");
79454
79567
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -79463,7 +79576,7 @@ class TrianglesDataTextureNormalsRenderer {
79463
79576
  src.push(" bool clippable = (float(vFlags2.x) > 0.0);");
79464
79577
  src.push(" if (clippable) {");
79465
79578
  src.push(" float dist = 0.0;");
79466
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
79579
+ for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
79467
79580
  src.push(" if (sectionPlaneActive" + i + ") {");
79468
79581
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
79469
79582
  src.push(" }");
@@ -79494,7 +79607,7 @@ class TrianglesDataTextureNormalsRenderer {
79494
79607
  const tempVec3a$9 = math.vec3();
79495
79608
  const tempVec3b$5 = math.vec3();
79496
79609
  const tempVec3c$4 = math.vec3();
79497
- const tempVec3d$1 = math.vec3();
79610
+ math.vec3();
79498
79611
 
79499
79612
  math.vec4();
79500
79613
 
@@ -79592,25 +79705,30 @@ class TrianglesDataTexturePickNormalsFlatRenderer {
79592
79705
  const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2);
79593
79706
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
79594
79707
  }
79708
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
79595
79709
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
79596
- if (numSectionPlanes > 0) {
79710
+ if (numAllocatedSectionPlanes > 0) {
79597
79711
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
79598
79712
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
79599
79713
  const renderFlags = model.renderFlags;
79600
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
79714
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
79601
79715
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
79602
79716
  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);
79717
+ if (sectionPlaneIndex < numSectionPlanes) {
79718
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
79719
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
79720
+ if (active) {
79721
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
79722
+ if (origin) {
79723
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$9);
79724
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
79725
+ } else {
79726
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
79727
+ }
79728
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
79612
79729
  }
79613
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
79730
+ } else {
79731
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
79614
79732
  }
79615
79733
  }
79616
79734
  }
@@ -79707,9 +79825,7 @@ class TrianglesDataTexturePickNormalsFlatRenderer {
79707
79825
 
79708
79826
  _buildVertexShader() {
79709
79827
  const scene = this._scene;
79710
- const sectionPlanesState = scene._sectionPlanesState;
79711
- scene._lightsState;
79712
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
79828
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
79713
79829
  const src = [];
79714
79830
  src.push("#version 300 es");
79715
79831
  src.push("// trianglesDatatextureNormalsRenderer vertex shader");
@@ -79875,8 +79991,7 @@ class TrianglesDataTexturePickNormalsFlatRenderer {
79875
79991
 
79876
79992
  _buildFragmentShader() {
79877
79993
  const scene = this._scene;
79878
- const sectionPlanesState = scene._sectionPlanesState;
79879
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
79994
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
79880
79995
  const src = [];
79881
79996
  src.push('#version 300 es');
79882
79997
  src.push("// TrianglesDataTexturePickNormalsRenderer fragment shader");
@@ -79895,7 +80010,7 @@ class TrianglesDataTexturePickNormalsFlatRenderer {
79895
80010
  src.push("in vec4 vWorldPosition;");
79896
80011
  if (clipping) {
79897
80012
  src.push("flat in uint vFlags2;");
79898
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
80013
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
79899
80014
  src.push("uniform bool sectionPlaneActive" + i + ";");
79900
80015
  src.push("uniform vec3 sectionPlanePos" + i + ";");
79901
80016
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -79907,7 +80022,7 @@ class TrianglesDataTexturePickNormalsFlatRenderer {
79907
80022
  src.push(" bool clippable = vFlags2 > 0u;");
79908
80023
  src.push(" if (clippable) {");
79909
80024
  src.push(" float dist = 0.0;");
79910
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
80025
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
79911
80026
  src.push("if (sectionPlaneActive" + i + ") {");
79912
80027
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
79913
80028
  src.push("}");
@@ -100250,6 +100365,11 @@ class Viewer {
100250
100365
  * 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
100366
  * 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
100367
  * mode for storing geometry, which is the standard technique used in most graphics engines, and will work adequately on most low-end GPUs.
100368
+ * @param {number} [cfg.numPreallocatedSectionPlanes=0] Enhances the efficiency of SectionPlane creation by proactively allocating Viewer resources for a specified quantity
100369
+ * of SectionPlanes. Introducing this parameter streamlines the initial creation speed of SectionPlanes, particularly up to the designated quantity. This parameter internally
100370
+ * configures renderer logic for the specified number of SectionPlanes, eliminating the need for setting up logic with each SectionPlane creation and thereby enhancing
100371
+ * 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
100372
+ * your expected usage.
100253
100373
  */
100254
100374
  constructor(cfg) {
100255
100375
 
@@ -100307,7 +100427,8 @@ class Viewer {
100307
100427
  logarithmicDepthBufferEnabled: (!!cfg.logarithmicDepthBufferEnabled),
100308
100428
  pbrEnabled: (!!cfg.pbrEnabled),
100309
100429
  colorTextureEnabled: (cfg.colorTextureEnabled !== false),
100310
- dtxEnabled: (!!cfg.dtxEnabled)
100430
+ dtxEnabled: (!!cfg.dtxEnabled),
100431
+ numPreallocatedSectionPlanes: cfg.numPreallocatedSectionPlanes
100311
100432
  });
100312
100433
 
100313
100434
  /**