@xeokit/xeokit-sdk 2.4.2-beta-20 → 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 (91) hide show
  1. package/dist/xeokit-sdk.cjs.js +718 -592
  2. package/dist/xeokit-sdk.es.js +718 -592
  3. package/dist/xeokit-sdk.es5.js +204 -195
  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/SceneModelMesh.js +9 -4
  24. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureColorRenderer.js +22 -17
  25. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureDepthRenderer.js +21 -20
  26. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureEdgesColorRenderer.js +6 -9
  27. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureEdgesRenderer.js +21 -18
  28. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureNormalsRenderer.js +22 -18
  29. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureOcclusionRenderer.js +22 -17
  30. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTexturePickDepthRenderer.js +22 -18
  31. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTexturePickMeshRenderer.js +58 -54
  32. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTexturePickNormalsFlatRenderer.js +21 -19
  33. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTexturePickNormalsRenderer.js +22 -18
  34. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureSilhouetteRenderer.js +21 -18
  35. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureSnapDepthBufInitRenderer.js +21 -18
  36. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureSnapDepthRenderer.js +21 -18
  37. package/src/viewer/scene/model/vbo/VBOSceneModelRenderers.js +21 -16
  38. package/src/viewer/scene/model/vbo/linesBatching/renderers/LinesBatchingColorRenderer.js +4 -4
  39. package/src/viewer/scene/model/vbo/linesBatching/renderers/LinesBatchingSilhouetteRenderer.js +4 -4
  40. package/src/viewer/scene/model/vbo/linesInstancing/renderers/LinesInstancingColorRenderer.js +4 -4
  41. package/src/viewer/scene/model/vbo/linesInstancing/renderers/LinesInstancingSilhouetteRenderer.js +4 -4
  42. package/src/viewer/scene/model/vbo/pointsBatching/renderers/PointsBatchingColorRenderer.js +4 -4
  43. package/src/viewer/scene/model/vbo/pointsBatching/renderers/PointsBatchingOcclusionRenderer.js +4 -4
  44. package/src/viewer/scene/model/vbo/pointsBatching/renderers/PointsBatchingPickDepthRenderer.js +4 -4
  45. package/src/viewer/scene/model/vbo/pointsBatching/renderers/PointsBatchingPickMeshRenderer.js +4 -4
  46. package/src/viewer/scene/model/vbo/pointsBatching/renderers/PointsBatchingShadowRenderer.js +4 -4
  47. package/src/viewer/scene/model/vbo/pointsBatching/renderers/PointsBatchingSilhouetteRenderer.js +4 -4
  48. package/src/viewer/scene/model/vbo/pointsInstancing/renderers/PointsInstancingColorRenderer.js +4 -4
  49. package/src/viewer/scene/model/vbo/pointsInstancing/renderers/PointsInstancingDepthRenderer.js +4 -4
  50. package/src/viewer/scene/model/vbo/pointsInstancing/renderers/PointsInstancingOcclusionRenderer.js +4 -4
  51. package/src/viewer/scene/model/vbo/pointsInstancing/renderers/PointsInstancingPickDepthRenderer.js +4 -4
  52. package/src/viewer/scene/model/vbo/pointsInstancing/renderers/PointsInstancingPickMeshRenderer.js +4 -4
  53. package/src/viewer/scene/model/vbo/pointsInstancing/renderers/PointsInstancingShadowRenderer.js +4 -4
  54. package/src/viewer/scene/model/vbo/pointsInstancing/renderers/PointsInstancingSilhouetteRenderer.js +4 -4
  55. package/src/viewer/scene/model/vbo/snapBatching/SnapBatchingDepthBufInitRenderer.js +4 -4
  56. package/src/viewer/scene/model/vbo/snapBatching/SnapBatchingDepthRenderer.js +4 -4
  57. package/src/viewer/scene/model/vbo/snapInstancing/SnapInstancingDepthBufInitRenderer.js +4 -4
  58. package/src/viewer/scene/model/vbo/snapInstancing/SnapInstancingDepthRenderer.js +4 -4
  59. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingColorRenderer.js +4 -4
  60. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingColorTextureRenderer.js +4 -4
  61. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingDepthRenderer.js +4 -4
  62. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingEdgesColorRenderer.js +4 -4
  63. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingEdgesRenderer.js +4 -4
  64. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingFlatColorRenderer.js +4 -4
  65. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingNormalsRenderer.js +4 -4
  66. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingOcclusionRenderer.js +4 -4
  67. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingPBRRenderer.js +4 -4
  68. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingPickDepthRenderer.js +4 -4
  69. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingPickMeshRenderer.js +4 -4
  70. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingPickNormalsFlatRenderer.js +4 -4
  71. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingPickNormalsRenderer.js +4 -4
  72. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingShadowRenderer.js +4 -4
  73. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingSilhouetteRenderer.js +4 -4
  74. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingColorRenderer.js +4 -4
  75. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingColorTextureRenderer.js +4 -4
  76. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingDepthRenderer.js +4 -4
  77. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingEdgesColorRenderer.js +4 -4
  78. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingEdgesRenderer.js +4 -4
  79. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingFlatColorRenderer.js +4 -4
  80. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingFlatNormalsRenderer.js +4 -4
  81. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingNormalsRenderer.js +4 -4
  82. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingOcclusionRenderer.js +4 -4
  83. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingPBRRenderer.js +4 -4
  84. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingPickDepthRenderer.js +4 -4
  85. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingPickMeshRenderer.js +4 -4
  86. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingPickNormalsFlatRenderer.js +4 -4
  87. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingPickNormalsRenderer.js +4 -4
  88. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingShadowRenderer.js +4 -4
  89. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingSilhouetteRenderer.js +4 -4
  90. package/src/viewer/scene/scene/Scene.js +24 -9
  91. 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;
@@ -56357,10 +56432,15 @@ class SceneModelMesh {
56357
56432
  */
56358
56433
  get aabb() { // called by SceneModelEntity
56359
56434
  if (this._aabbDirty) {
56360
- if (this.obb && this.transform) {
56361
- math.transformOBB3(this.transform.worldMatrix, this.obb, tempOBB3);
56362
- math.transformOBB3(this.model.worldMatrix, tempOBB3, tempOBB3b);
56363
- math.OBB3ToAABB3(tempOBB3b, this._aabb);
56435
+ if (this.obb) {
56436
+ if (this.transform) {
56437
+ math.transformOBB3(this.transform.worldMatrix, this.obb, tempOBB3);
56438
+ math.transformOBB3(this.model.worldMatrix, tempOBB3, tempOBB3b);
56439
+ math.OBB3ToAABB3(tempOBB3b, this._aabb);
56440
+ } else {
56441
+ math.transformOBB3(this.model.worldMatrix, this.obb, tempOBB3);
56442
+ math.OBB3ToAABB3(tempOBB3, this._aabb);
56443
+ }
56364
56444
  }
56365
56445
  this._aabbDirty = false;
56366
56446
  }
@@ -56576,32 +56656,38 @@ class VBOSceneModelRenderer {
56576
56656
  const {gl} = scene.canvas;
56577
56657
  const {model, layerIndex} = layer;
56578
56658
 
56659
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
56579
56660
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
56580
- if (numSectionPlanes > 0) {
56661
+ if (numAllocatedSectionPlanes > 0) {
56581
56662
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
56582
56663
  const baseIndex = layerIndex * numSectionPlanes;
56583
56664
  const renderFlags = model.renderFlags;
56584
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
56665
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
56585
56666
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
56586
56667
  if (sectionPlaneUniforms) {
56587
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
56588
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
56589
- if (active) {
56590
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
56591
- const origin = layer._state.origin;
56592
- if (origin) {
56593
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$s);
56594
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
56595
- } else {
56596
- 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);
56597
56681
  }
56598
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
56682
+ } else {
56683
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
56599
56684
  }
56600
56685
  }
56601
56686
  }
56602
56687
  }
56603
56688
  }
56604
56689
 
56690
+
56605
56691
  _allocate() {
56606
56692
  const scene = this._scene;
56607
56693
  const gl = scene.canvas.gl;
@@ -56682,7 +56768,7 @@ class VBOSceneModelRenderer {
56682
56768
 
56683
56769
  this._uSectionPlanes = [];
56684
56770
 
56685
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
56771
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
56686
56772
  this._uSectionPlanes.push({
56687
56773
  active: program.getLocation("sectionPlaneActive" + i),
56688
56774
  pos: program.getLocation("sectionPlanePos" + i),
@@ -57148,12 +57234,11 @@ class VBOSceneModelTriangleBatchingEdgesRenderer extends VBOSceneModelTriangleBa
57148
57234
  }
57149
57235
 
57150
57236
 
57151
-
57152
57237
  /**
57153
57238
  * @private
57154
57239
  */
57155
57240
  class VBOSceneModelTriangleInstancingRenderer extends VBOSceneModelRenderer {
57156
- constructor(scene, withSAO, { edges = false} = {}) {
57241
+ constructor(scene, withSAO, {edges = false} = {}) {
57157
57242
  super(scene, withSAO, {instancing: true, edges});
57158
57243
  }
57159
57244
 
@@ -57300,7 +57385,7 @@ class TrianglesBatchingColorRenderer extends VBOSceneModelTriangleBatchingRender
57300
57385
  const scene = this._scene;
57301
57386
  const sectionPlanesState = scene._sectionPlanesState;
57302
57387
  const lightsState = scene._lightsState;
57303
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
57388
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57304
57389
  let light;
57305
57390
  const src = [];
57306
57391
  src.push("#version 300 es");
@@ -57439,7 +57524,7 @@ class TrianglesBatchingColorRenderer extends VBOSceneModelTriangleBatchingRender
57439
57524
  _buildFragmentShader() {
57440
57525
  const scene = this._scene;
57441
57526
  const sectionPlanesState = scene._sectionPlanesState;
57442
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
57527
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57443
57528
  const src = [];
57444
57529
  src.push("#version 300 es");
57445
57530
  src.push("// Triangles batching draw fragment shader");
@@ -57472,7 +57557,7 @@ class TrianglesBatchingColorRenderer extends VBOSceneModelTriangleBatchingRender
57472
57557
  if (clipping) {
57473
57558
  src.push("in vec4 vWorldPosition;");
57474
57559
  src.push("in float vFlags;");
57475
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
57560
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
57476
57561
  src.push("uniform bool sectionPlaneActive" + i + ";");
57477
57562
  src.push("uniform vec3 sectionPlanePos" + i + ";");
57478
57563
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -57486,7 +57571,7 @@ class TrianglesBatchingColorRenderer extends VBOSceneModelTriangleBatchingRender
57486
57571
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
57487
57572
  src.push(" if (clippable) {");
57488
57573
  src.push(" float dist = 0.0;");
57489
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
57574
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
57490
57575
  src.push("if (sectionPlaneActive" + i + ") {");
57491
57576
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
57492
57577
  src.push("}");
@@ -57532,7 +57617,7 @@ class TrianglesBatchingFlatColorRenderer extends VBOSceneModelTriangleBatchingRe
57532
57617
  _buildVertexShader() {
57533
57618
  const scene = this._scene;
57534
57619
  const sectionPlanesState = scene._sectionPlanesState;
57535
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
57620
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57536
57621
  const src = [];
57537
57622
  src.push("#version 300 es");
57538
57623
  src.push("// Triangles batching flat-shading draw vertex shader");
@@ -57604,7 +57689,7 @@ class TrianglesBatchingFlatColorRenderer extends VBOSceneModelTriangleBatchingRe
57604
57689
  const scene = this._scene;
57605
57690
  const lightsState = scene._lightsState;
57606
57691
  const sectionPlanesState = scene._sectionPlanesState;
57607
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
57692
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57608
57693
  const src = [];
57609
57694
  src.push("#version 300 es");
57610
57695
  src.push("// Triangles batching flat-shading draw fragment shader");
@@ -57640,7 +57725,7 @@ class TrianglesBatchingFlatColorRenderer extends VBOSceneModelTriangleBatchingRe
57640
57725
  if (clipping) {
57641
57726
  src.push("in vec4 vWorldPosition;");
57642
57727
  src.push("in float vFlags;");
57643
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
57728
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
57644
57729
  src.push("uniform bool sectionPlaneActive" + i + ";");
57645
57730
  src.push("uniform vec3 sectionPlanePos" + i + ";");
57646
57731
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -57678,7 +57763,7 @@ class TrianglesBatchingFlatColorRenderer extends VBOSceneModelTriangleBatchingRe
57678
57763
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
57679
57764
  src.push(" if (clippable) {");
57680
57765
  src.push(" float dist = 0.0;");
57681
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
57766
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
57682
57767
  src.push("if (sectionPlaneActive" + i + ") {");
57683
57768
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
57684
57769
  src.push("}");
@@ -57767,7 +57852,7 @@ class TrianglesBatchingSilhouetteRenderer extends VBOSceneModelTriangleBatchingR
57767
57852
 
57768
57853
  const scene = this._scene;
57769
57854
  const sectionPlanesState = scene._sectionPlanesState;
57770
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
57855
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57771
57856
 
57772
57857
  const src = [];
57773
57858
  src.push("#version 300 es");
@@ -57838,7 +57923,7 @@ class TrianglesBatchingSilhouetteRenderer extends VBOSceneModelTriangleBatchingR
57838
57923
  const sectionPlanesState = scene._sectionPlanesState;
57839
57924
  let i;
57840
57925
  let len;
57841
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
57926
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57842
57927
  const src = [];
57843
57928
  src.push("#version 300 es");
57844
57929
  src.push("// Triangles batching silhouette fragment shader");
@@ -57858,7 +57943,7 @@ class TrianglesBatchingSilhouetteRenderer extends VBOSceneModelTriangleBatchingR
57858
57943
  if (clipping) {
57859
57944
  src.push("in vec4 vWorldPosition;");
57860
57945
  src.push("in float vFlags;");
57861
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
57946
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
57862
57947
  src.push("uniform bool sectionPlaneActive" + i + ";");
57863
57948
  src.push("uniform vec3 sectionPlanePos" + i + ";");
57864
57949
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -57871,7 +57956,7 @@ class TrianglesBatchingSilhouetteRenderer extends VBOSceneModelTriangleBatchingR
57871
57956
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
57872
57957
  src.push(" if (clippable) {");
57873
57958
  src.push(" float dist = 0.0;");
57874
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
57959
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
57875
57960
  src.push("if (sectionPlaneActive" + i + ") {");
57876
57961
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
57877
57962
  src.push("}");
@@ -57900,7 +57985,7 @@ class TrianglesBatchingEdgesRenderer extends VBOSceneModelTriangleBatchingEdgesR
57900
57985
  _buildVertexShader() {
57901
57986
  const scene = this._scene;
57902
57987
  const sectionPlanesState = scene._sectionPlanesState;
57903
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
57988
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57904
57989
  const src = [];
57905
57990
 
57906
57991
  src.push("#version 300 es");
@@ -57969,7 +58054,7 @@ class TrianglesBatchingEdgesRenderer extends VBOSceneModelTriangleBatchingEdgesR
57969
58054
  _buildFragmentShader() {
57970
58055
  const scene = this._scene;
57971
58056
  const sectionPlanesState = scene._sectionPlanesState;
57972
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
58057
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57973
58058
  const src = [];
57974
58059
  src.push("#version 300 es");
57975
58060
  src.push("// Batched geometry edges drawing fragment shader");
@@ -57989,7 +58074,7 @@ class TrianglesBatchingEdgesRenderer extends VBOSceneModelTriangleBatchingEdgesR
57989
58074
  if (clipping) {
57990
58075
  src.push("in vec4 vWorldPosition;");
57991
58076
  src.push("in float vFlags;");
57992
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
58077
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
57993
58078
  src.push("uniform bool sectionPlaneActive" + i + ";");
57994
58079
  src.push("uniform vec3 sectionPlanePos" + i + ";");
57995
58080
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58002,7 +58087,7 @@ class TrianglesBatchingEdgesRenderer extends VBOSceneModelTriangleBatchingEdgesR
58002
58087
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58003
58088
  src.push(" if (clippable) {");
58004
58089
  src.push(" float dist = 0.0;");
58005
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
58090
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
58006
58091
  src.push("if (sectionPlaneActive" + i + ") {");
58007
58092
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58008
58093
  src.push("}");
@@ -58027,7 +58112,7 @@ class TrianglesBatchingEdgesColorRenderer extends VBOSceneModelTriangleBatchingE
58027
58112
  _buildVertexShader() {
58028
58113
  const scene = this._scene;
58029
58114
  const sectionPlanesState = scene._sectionPlanesState;
58030
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
58115
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58031
58116
  const src = [];
58032
58117
  src.push("#version 300 es");
58033
58118
  src.push("// Batched geometry edges drawing vertex shader");
@@ -58096,7 +58181,7 @@ class TrianglesBatchingEdgesColorRenderer extends VBOSceneModelTriangleBatchingE
58096
58181
  _buildFragmentShader() {
58097
58182
  const scene = this._scene;
58098
58183
  const sectionPlanesState = scene._sectionPlanesState;
58099
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
58184
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58100
58185
  const src = [];
58101
58186
  src.push("#version 300 es");
58102
58187
  src.push("// Batched geometry edges drawing fragment shader");
@@ -58115,7 +58200,7 @@ class TrianglesBatchingEdgesColorRenderer extends VBOSceneModelTriangleBatchingE
58115
58200
  if (clipping) {
58116
58201
  src.push("in vec4 vWorldPosition;");
58117
58202
  src.push("in float vFlags;");
58118
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
58203
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
58119
58204
  src.push("uniform bool sectionPlaneActive" + i + ";");
58120
58205
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58121
58206
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58128,7 +58213,7 @@ class TrianglesBatchingEdgesColorRenderer extends VBOSceneModelTriangleBatchingE
58128
58213
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58129
58214
  src.push(" if (clippable) {");
58130
58215
  src.push(" float dist = 0.0;");
58131
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
58216
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
58132
58217
  src.push("if (sectionPlaneActive" + i + ") {");
58133
58218
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58134
58219
  src.push("}");
@@ -58152,7 +58237,7 @@ class TrianglesBatchingPickMeshRenderer extends VBOSceneModelTriangleBatchingRen
58152
58237
 
58153
58238
  _buildVertexShader() {
58154
58239
  const scene = this._scene;
58155
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
58240
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58156
58241
  const src = [];
58157
58242
  src.push("#version 300 es");
58158
58243
  src.push("// Batched geometry picking vertex shader");
@@ -58224,7 +58309,7 @@ class TrianglesBatchingPickMeshRenderer extends VBOSceneModelTriangleBatchingRen
58224
58309
  _buildFragmentShader() {
58225
58310
  const scene = this._scene;
58226
58311
  const sectionPlanesState = scene._sectionPlanesState;
58227
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
58312
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58228
58313
  const src = [];
58229
58314
  src.push("#version 300 es");
58230
58315
  src.push("// Batched geometry picking fragment shader");
@@ -58244,7 +58329,7 @@ class TrianglesBatchingPickMeshRenderer extends VBOSceneModelTriangleBatchingRen
58244
58329
  if (clipping) {
58245
58330
  src.push("in vec4 vWorldPosition;");
58246
58331
  src.push("in float vFlags;");
58247
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58332
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58248
58333
  src.push("uniform bool sectionPlaneActive" + i + ";");
58249
58334
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58250
58335
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58257,7 +58342,7 @@ class TrianglesBatchingPickMeshRenderer extends VBOSceneModelTriangleBatchingRen
58257
58342
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58258
58343
  src.push(" if (clippable) {");
58259
58344
  src.push(" float dist = 0.0;");
58260
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58345
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58261
58346
  src.push(" if (sectionPlaneActive" + i + ") {");
58262
58347
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58263
58348
  src.push(" }");
@@ -58282,7 +58367,7 @@ class TrianglesBatchingPickDepthRenderer extends VBOSceneModelTriangleBatchingRe
58282
58367
  _buildVertexShader() {
58283
58368
 
58284
58369
  const scene = this._scene;
58285
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
58370
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58286
58371
  const src = [];
58287
58372
  src.push("#version 300 es");
58288
58373
  src.push("// Triangles batching pick depth vertex shader");
@@ -58352,7 +58437,7 @@ class TrianglesBatchingPickDepthRenderer extends VBOSceneModelTriangleBatchingRe
58352
58437
 
58353
58438
  const scene = this._scene;
58354
58439
  const sectionPlanesState = scene._sectionPlanesState;
58355
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
58440
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58356
58441
  const src = [];
58357
58442
  src.push("#version 300 es");
58358
58443
  src.push("// Triangles batching pick depth fragment shader");
@@ -58379,7 +58464,7 @@ class TrianglesBatchingPickDepthRenderer extends VBOSceneModelTriangleBatchingRe
58379
58464
  if (clipping) {
58380
58465
  src.push("in vec4 vWorldPosition;");
58381
58466
  src.push("in float vFlags;");
58382
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58467
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58383
58468
  src.push("uniform bool sectionPlaneActive" + i + ";");
58384
58469
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58385
58470
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58399,7 +58484,7 @@ class TrianglesBatchingPickDepthRenderer extends VBOSceneModelTriangleBatchingRe
58399
58484
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58400
58485
  src.push(" if (clippable) {");
58401
58486
  src.push(" float dist = 0.0;");
58402
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58487
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58403
58488
  src.push(" if (sectionPlaneActive" + i + ") {");
58404
58489
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58405
58490
  src.push(" }");
@@ -58424,7 +58509,7 @@ class TrianglesBatchingPickNormalsRenderer extends VBOSceneModelTriangleBatching
58424
58509
 
58425
58510
  _buildVertexShader() {
58426
58511
  const scene = this._scene;
58427
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
58512
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58428
58513
  const src = [];
58429
58514
  src.push("#version 300 es");
58430
58515
  src.push("// Triangles batching pick normals vertex shader");
@@ -58495,7 +58580,7 @@ class TrianglesBatchingPickNormalsRenderer extends VBOSceneModelTriangleBatching
58495
58580
  _buildFragmentShader() {
58496
58581
  const scene = this._scene;
58497
58582
  const sectionPlanesState = scene._sectionPlanesState;
58498
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
58583
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58499
58584
  const src = [];
58500
58585
  src.push("#version 300 es");
58501
58586
  src.push("// Triangles batching pick normals fragment shader");
@@ -58515,7 +58600,7 @@ class TrianglesBatchingPickNormalsRenderer extends VBOSceneModelTriangleBatching
58515
58600
  if (clipping) {
58516
58601
  src.push("in vec4 vWorldPosition;");
58517
58602
  src.push("in float vFlags;");
58518
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58603
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58519
58604
  src.push("uniform bool sectionPlaneActive" + i + ";");
58520
58605
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58521
58606
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58528,7 +58613,7 @@ class TrianglesBatchingPickNormalsRenderer extends VBOSceneModelTriangleBatching
58528
58613
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58529
58614
  src.push(" if (clippable) {");
58530
58615
  src.push(" float dist = 0.0;");
58531
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58616
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58532
58617
  src.push(" if (sectionPlaneActive" + i + ") {");
58533
58618
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58534
58619
  src.push(" }");
@@ -58552,7 +58637,7 @@ class TrianglesBatchingOcclusionRenderer extends VBOSceneModelTriangleBatchingRe
58552
58637
 
58553
58638
  _buildVertexShader() {
58554
58639
  const scene = this._scene;
58555
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
58640
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58556
58641
  const src = [];
58557
58642
  src.push("#version 300 es");
58558
58643
  src.push("// Triangles batching occlusion vertex shader");
@@ -58601,7 +58686,7 @@ class TrianglesBatchingOcclusionRenderer extends VBOSceneModelTriangleBatchingRe
58601
58686
  _buildFragmentShader() {
58602
58687
  const scene = this._scene;
58603
58688
  const sectionPlanesState = scene._sectionPlanesState;
58604
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
58689
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58605
58690
  const src = [];
58606
58691
  src.push("#version 300 es");
58607
58692
  src.push("// Triangles batching occlusion fragment shader");
@@ -58616,7 +58701,7 @@ class TrianglesBatchingOcclusionRenderer extends VBOSceneModelTriangleBatchingRe
58616
58701
  if (clipping) {
58617
58702
  src.push("in vec4 vWorldPosition;");
58618
58703
  src.push("in float vFlags;");
58619
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58704
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58620
58705
  src.push("uniform bool sectionPlaneActive" + i + ";");
58621
58706
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58622
58707
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58628,7 +58713,7 @@ class TrianglesBatchingOcclusionRenderer extends VBOSceneModelTriangleBatchingRe
58628
58713
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58629
58714
  src.push(" if (clippable) {");
58630
58715
  src.push(" float dist = 0.0;");
58631
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58716
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58632
58717
  src.push(" if (sectionPlaneActive" + i + ") {");
58633
58718
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58634
58719
  src.push(" }");
@@ -58649,7 +58734,7 @@ class TrianglesBatchingDepthRenderer extends VBOSceneModelTriangleBatchingRender
58649
58734
 
58650
58735
  _buildVertexShader() {
58651
58736
  const scene = this._scene;
58652
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
58737
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58653
58738
  const src = [];
58654
58739
  src.push("#version 300 es");
58655
58740
  src.push("// Triangles batching depth vertex shader");
@@ -58709,7 +58794,7 @@ class TrianglesBatchingDepthRenderer extends VBOSceneModelTriangleBatchingRender
58709
58794
  _buildFragmentShader() {
58710
58795
  const scene = this._scene;
58711
58796
  const sectionPlanesState = scene._sectionPlanesState;
58712
- const clipping = (sectionPlanesState.sectionPlanes.length > 0);
58797
+ const clipping = (sectionPlanesState.getNumAllocatedSectionPlanes() > 0);
58713
58798
  const src = [];
58714
58799
  src.push("#version 300 es");
58715
58800
  src.push("// Triangles batching depth fragment shader");
@@ -58724,7 +58809,7 @@ class TrianglesBatchingDepthRenderer extends VBOSceneModelTriangleBatchingRender
58724
58809
  if (clipping) {
58725
58810
  src.push("in vec4 vWorldPosition;");
58726
58811
  src.push("in float vFlags;");
58727
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58812
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58728
58813
  src.push("uniform bool sectionPlaneActive" + i + ";");
58729
58814
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58730
58815
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58748,7 +58833,7 @@ class TrianglesBatchingDepthRenderer extends VBOSceneModelTriangleBatchingRender
58748
58833
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58749
58834
  src.push(" if (clippable) {");
58750
58835
  src.push(" float dist = 0.0;");
58751
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58836
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58752
58837
  src.push(" if (sectionPlaneActive" + i + ") {");
58753
58838
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58754
58839
  src.push(" }");
@@ -58773,7 +58858,7 @@ class TrianglesBatchingNormalsRenderer extends VBOSceneModelTriangleBatchingRend
58773
58858
 
58774
58859
  _buildVertexShader() {
58775
58860
  const scene = this._scene;
58776
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
58861
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58777
58862
  const src = [];
58778
58863
  src.push("#version 300 es");
58779
58864
  src.push("// Batched geometry normals vertex shader");
@@ -58844,7 +58929,7 @@ class TrianglesBatchingNormalsRenderer extends VBOSceneModelTriangleBatchingRend
58844
58929
  _buildFragmentShader() {
58845
58930
  const scene = this._scene;
58846
58931
  const sectionPlanesState = scene._sectionPlanesState;
58847
- const clipping = (sectionPlanesState.sectionPlanes.length > 0);
58932
+ const clipping = (sectionPlanesState.getNumAllocatedSectionPlanes() > 0);
58848
58933
  const src = [];
58849
58934
  src.push("#version 300 es");
58850
58935
  src.push("// Batched geometry normals fragment shader");
@@ -58868,7 +58953,7 @@ class TrianglesBatchingNormalsRenderer extends VBOSceneModelTriangleBatchingRend
58868
58953
  if (clipping) {
58869
58954
  src.push("in vec4 vWorldPosition;");
58870
58955
  src.push("in float vFlags;");
58871
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58956
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58872
58957
  src.push("uniform bool sectionPlaneActive" + i + ";");
58873
58958
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58874
58959
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58885,7 +58970,7 @@ class TrianglesBatchingNormalsRenderer extends VBOSceneModelTriangleBatchingRend
58885
58970
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58886
58971
  src.push(" if (clippable) {");
58887
58972
  src.push(" float dist = 0.0;");
58888
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58973
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58889
58974
  src.push(" if (sectionPlaneActive" + i + ") {");
58890
58975
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58891
58976
  src.push(" }");
@@ -58911,7 +58996,7 @@ class TrianglesBatchingShadowRenderer extends VBOSceneModelTriangleBatchingRende
58911
58996
 
58912
58997
  _buildVertexShader() {
58913
58998
  const scene = this._scene;
58914
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
58999
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58915
59000
  const src = [];
58916
59001
  src.push("#version 300 es");
58917
59002
  src.push("// Batched geometry shadow vertex shader");
@@ -58958,7 +59043,7 @@ class TrianglesBatchingShadowRenderer extends VBOSceneModelTriangleBatchingRende
58958
59043
  _buildFragmentShader() {
58959
59044
  const scene = this._scene;
58960
59045
  const sectionPlanesState = scene._sectionPlanesState;
58961
- const clipping = (sectionPlanesState.sectionPlanes.length > 0);
59046
+ const clipping = (sectionPlanesState.getNumAllocatedSectionPlanes() > 0);
58962
59047
  const src = [];
58963
59048
  src.push("#version 300 es");
58964
59049
  src.push("// Batched geometry shadow fragment shader");
@@ -58972,7 +59057,7 @@ class TrianglesBatchingShadowRenderer extends VBOSceneModelTriangleBatchingRende
58972
59057
  if (clipping) {
58973
59058
  src.push("in vec4 vWorldPosition;");
58974
59059
  src.push("in float vFlags;");
58975
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
59060
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58976
59061
  src.push("uniform bool sectionPlaneActive" + i + ";");
58977
59062
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58978
59063
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58993,7 +59078,7 @@ class TrianglesBatchingShadowRenderer extends VBOSceneModelTriangleBatchingRende
58993
59078
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58994
59079
  src.push(" if (clippable) {");
58995
59080
  src.push(" float dist = 0.0;");
58996
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
59081
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58997
59082
  src.push(" if (sectionPlaneActive" + i + ") {");
58998
59083
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58999
59084
  src.push(" }");
@@ -59029,7 +59114,7 @@ class TrianglesBatchingPBRRenderer extends VBOSceneModelTriangleBatchingRenderer
59029
59114
  const scene = this._scene;
59030
59115
  const sectionPlanesState = scene._sectionPlanesState;
59031
59116
  const lightsState = scene._lightsState;
59032
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
59117
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
59033
59118
  const clippingCaps = sectionPlanesState.clippingCaps;
59034
59119
 
59035
59120
  const src = [];
@@ -59159,7 +59244,7 @@ class TrianglesBatchingPBRRenderer extends VBOSceneModelTriangleBatchingRenderer
59159
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.
59160
59245
  const sectionPlanesState = scene._sectionPlanesState;
59161
59246
  const lightsState = scene._lightsState;
59162
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
59247
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
59163
59248
  const clippingCaps = sectionPlanesState.clippingCaps;
59164
59249
  const src = [];
59165
59250
 
@@ -59263,7 +59348,7 @@ class TrianglesBatchingPBRRenderer extends VBOSceneModelTriangleBatchingRenderer
59263
59348
  if (clippingCaps) {
59264
59349
  src.push("in vec4 vClipPosition;");
59265
59350
  }
59266
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
59351
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
59267
59352
  src.push("uniform bool sectionPlaneActive" + i + ";");
59268
59353
  src.push("uniform vec3 sectionPlanePos" + i + ";");
59269
59354
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -59436,7 +59521,7 @@ class TrianglesBatchingPBRRenderer extends VBOSceneModelTriangleBatchingRenderer
59436
59521
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
59437
59522
  src.push(" if (clippable) {");
59438
59523
  src.push(" float dist = 0.0;");
59439
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
59524
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
59440
59525
  src.push("if (sectionPlaneActive" + i + ") {");
59441
59526
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
59442
59527
  src.push("}");
@@ -59574,7 +59659,7 @@ class TrianglesBatchingPickNormalsFlatRenderer extends VBOSceneModelTriangleBatc
59574
59659
 
59575
59660
  _buildVertexShader() {
59576
59661
  const scene = this._scene;
59577
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
59662
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
59578
59663
  const src = [];
59579
59664
  src.push("#version 300 es");
59580
59665
  src.push("// Triangles batching pick flat normals vertex shader");
@@ -59633,7 +59718,7 @@ class TrianglesBatchingPickNormalsFlatRenderer extends VBOSceneModelTriangleBatc
59633
59718
  _buildFragmentShader() {
59634
59719
  const scene = this._scene;
59635
59720
  const sectionPlanesState = scene._sectionPlanesState;
59636
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
59721
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
59637
59722
  const src = [];
59638
59723
  src.push("#version 300 es");
59639
59724
  src.push("// Triangles batching pick flat normals fragment shader");
@@ -59653,7 +59738,7 @@ class TrianglesBatchingPickNormalsFlatRenderer extends VBOSceneModelTriangleBatc
59653
59738
  src.push("in vec4 vWorldPosition;");
59654
59739
  if (clipping) {
59655
59740
  src.push("in float vFlags;");
59656
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
59741
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
59657
59742
  src.push("uniform bool sectionPlaneActive" + i + ";");
59658
59743
  src.push("uniform vec3 sectionPlanePos" + i + ";");
59659
59744
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -59665,7 +59750,7 @@ class TrianglesBatchingPickNormalsFlatRenderer extends VBOSceneModelTriangleBatc
59665
59750
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
59666
59751
  src.push(" if (clippable) {");
59667
59752
  src.push(" float dist = 0.0;");
59668
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
59753
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
59669
59754
  src.push(" if (sectionPlaneActive" + i + ") {");
59670
59755
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
59671
59756
  src.push(" }");
@@ -59702,7 +59787,7 @@ class TrianglesBatchingColorTextureRenderer extends VBOSceneModelTriangleBatchin
59702
59787
 
59703
59788
  const scene = this._scene;
59704
59789
  const sectionPlanesState = scene._sectionPlanesState;
59705
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
59790
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
59706
59791
  const src = [];
59707
59792
  src.push("#version 300 es");
59708
59793
  src.push("// Triangles batching color texture vertex shader");
@@ -59779,7 +59864,7 @@ class TrianglesBatchingColorTextureRenderer extends VBOSceneModelTriangleBatchin
59779
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.
59780
59865
  const lightsState = scene._lightsState;
59781
59866
  const sectionPlanesState = scene._sectionPlanesState;
59782
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
59867
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
59783
59868
  const src = [];
59784
59869
  src.push("#version 300 es");
59785
59870
  src.push("// Triangles batching color texture fragment shader");
@@ -59829,7 +59914,7 @@ class TrianglesBatchingColorTextureRenderer extends VBOSceneModelTriangleBatchin
59829
59914
  if (clipping) {
59830
59915
  src.push("in vec4 vWorldPosition;");
59831
59916
  src.push("in float vFlags;");
59832
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
59917
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
59833
59918
  src.push("uniform bool sectionPlaneActive" + i + ";");
59834
59919
  src.push("uniform vec3 sectionPlanePos" + i + ";");
59835
59920
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -59866,7 +59951,7 @@ class TrianglesBatchingColorTextureRenderer extends VBOSceneModelTriangleBatchin
59866
59951
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
59867
59952
  src.push(" if (clippable) {");
59868
59953
  src.push(" float dist = 0.0;");
59869
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
59954
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
59870
59955
  src.push("if (sectionPlaneActive" + i + ") {");
59871
59956
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
59872
59957
  src.push("}");
@@ -60456,7 +60541,7 @@ function octDecodeVec2(oct) { // Decode an oct-encoded normal
60456
60541
  const tempVec3a$r = math.vec3();
60457
60542
  const tempVec3b$n = math.vec3();
60458
60543
  const tempVec3c$k = math.vec3();
60459
- const tempVec3d$g = math.vec3();
60544
+ const tempVec3d$8 = math.vec3();
60460
60545
  const tempMat4a$g = math.mat4();
60461
60546
 
60462
60547
  /**
@@ -60522,7 +60607,7 @@ class SnapBatchingDepthBufInitRenderer extends VBOSceneModelRenderer {
60522
60607
  rtcOrigin[1] += position[1];
60523
60608
  rtcOrigin[2] += position[2];
60524
60609
  rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a$g);
60525
- rtcCameraEye = tempVec3d$g;
60610
+ rtcCameraEye = tempVec3d$8;
60526
60611
  rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];
60527
60612
  rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];
60528
60613
  rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];
@@ -60597,7 +60682,7 @@ class SnapBatchingDepthBufInitRenderer extends VBOSceneModelRenderer {
60597
60682
 
60598
60683
  _buildVertexShader() {
60599
60684
  const scene = this._scene;
60600
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
60685
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
60601
60686
  const src = [];
60602
60687
  src.push ('#version 300 es');
60603
60688
  src.push("// VBO SnapBatchingDepthBufInitRenderer vertex shader");
@@ -60684,7 +60769,7 @@ class SnapBatchingDepthBufInitRenderer extends VBOSceneModelRenderer {
60684
60769
  _buildFragmentShader() {
60685
60770
  const scene = this._scene;
60686
60771
  const sectionPlanesState = scene._sectionPlanesState;
60687
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
60772
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
60688
60773
  const src = [];
60689
60774
  src.push ('#version 300 es');
60690
60775
  src.push("// VBO SnapBatchingDepthBufInitRenderer fragment shader");
@@ -60706,7 +60791,7 @@ class SnapBatchingDepthBufInitRenderer extends VBOSceneModelRenderer {
60706
60791
  src.push("flat in vec4 vPickColor;");
60707
60792
  if (clipping) {
60708
60793
  src.push("in float vFlags;");
60709
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
60794
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
60710
60795
  src.push("uniform bool sectionPlaneActive" + i + ";");
60711
60796
  src.push("uniform vec3 sectionPlanePos" + i + ";");
60712
60797
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -60721,7 +60806,7 @@ class SnapBatchingDepthBufInitRenderer extends VBOSceneModelRenderer {
60721
60806
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
60722
60807
  src.push(" if (clippable) {");
60723
60808
  src.push(" float dist = 0.0;");
60724
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
60809
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
60725
60810
  src.push(" if (sectionPlaneActive" + i + ") {");
60726
60811
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
60727
60812
  src.push(" }");
@@ -60761,7 +60846,7 @@ class SnapBatchingDepthBufInitRenderer extends VBOSceneModelRenderer {
60761
60846
  const tempVec3a$q = math.vec3();
60762
60847
  const tempVec3b$m = math.vec3();
60763
60848
  const tempVec3c$j = math.vec3();
60764
- const tempVec3d$f = math.vec3();
60849
+ const tempVec3d$7 = math.vec3();
60765
60850
  const tempMat4a$f = math.mat4();
60766
60851
 
60767
60852
  /**
@@ -60831,7 +60916,7 @@ class SnapBatchingDepthRenderer extends VBOSceneModelRenderer{
60831
60916
  rtcOrigin[1] += position[1];
60832
60917
  rtcOrigin[2] += position[2];
60833
60918
  rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a$f);
60834
- rtcCameraEye = tempVec3d$f;
60919
+ rtcCameraEye = tempVec3d$7;
60835
60920
  rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];
60836
60921
  rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];
60837
60922
  rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];
@@ -60912,7 +60997,7 @@ class SnapBatchingDepthRenderer extends VBOSceneModelRenderer{
60912
60997
 
60913
60998
  _buildVertexShader() {
60914
60999
  const scene = this._scene;
60915
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
61000
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
60916
61001
  scene.pointsMaterial._state;
60917
61002
  const src = [];
60918
61003
  src.push ('#version 300 es');
@@ -60999,7 +61084,7 @@ class SnapBatchingDepthRenderer extends VBOSceneModelRenderer{
60999
61084
  _buildFragmentShader() {
61000
61085
  const scene = this._scene;
61001
61086
  const sectionPlanesState = scene._sectionPlanesState;
61002
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
61087
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
61003
61088
  const src = [];
61004
61089
  src.push ('#version 300 es');
61005
61090
  src.push("// SnapBatchingDepthRenderer fragment shader");
@@ -61020,7 +61105,7 @@ class SnapBatchingDepthRenderer extends VBOSceneModelRenderer{
61020
61105
  if (clipping) {
61021
61106
  src.push("in vec4 vWorldPosition;");
61022
61107
  src.push("in float vFlags;");
61023
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
61108
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
61024
61109
  src.push("uniform bool sectionPlaneActive" + i + ";");
61025
61110
  src.push("uniform vec3 sectionPlanePos" + i + ";");
61026
61111
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -61033,7 +61118,7 @@ class SnapBatchingDepthRenderer extends VBOSceneModelRenderer{
61033
61118
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
61034
61119
  src.push(" if (clippable) {");
61035
61120
  src.push(" float dist = 0.0;");
61036
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
61121
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
61037
61122
  src.push(" if (sectionPlaneActive" + i + ") {");
61038
61123
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
61039
61124
  src.push(" }");
@@ -61154,8 +61239,8 @@ math.OBB3();
61154
61239
  const tempVec3a$p = math.vec3();
61155
61240
  const tempVec3b$l = math.vec3();
61156
61241
  const tempVec3c$i = math.vec3();
61157
- const tempVec3d$e = math.vec3();
61158
- const tempVec3e$3 = math.vec3();
61242
+ const tempVec3d$6 = math.vec3();
61243
+ const tempVec3e$1 = math.vec3();
61159
61244
  const tempVec3f$1 = math.vec3();
61160
61245
  const tempVec3g$1 = math.vec3();
61161
61246
 
@@ -62346,8 +62431,8 @@ class TrianglesBatchingLayer {
62346
62431
 
62347
62432
  math.transformRay(this.model.worldNormalMatrix, rtcRayOrigin, rtcRayDir, rtcRayOrigin, rtcRayDir); // RTC -> local
62348
62433
 
62349
- const a = tempVec3d$e;
62350
- const b = tempVec3e$3;
62434
+ const a = tempVec3d$6;
62435
+ const b = tempVec3e$1;
62351
62436
  const c = tempVec3f$1;
62352
62437
 
62353
62438
  let gotIntersect = false;
@@ -62470,7 +62555,7 @@ class TrianglesInstancingColorRenderer extends VBOSceneModelTriangleInstancingRe
62470
62555
  const scene = this._scene;
62471
62556
  const sectionPlanesState = scene._sectionPlanesState;
62472
62557
  const lightsState = scene._lightsState;
62473
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
62558
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
62474
62559
  let i;
62475
62560
  let len;
62476
62561
  let light;
@@ -62622,7 +62707,7 @@ class TrianglesInstancingColorRenderer extends VBOSceneModelTriangleInstancingRe
62622
62707
  _buildFragmentShader() {
62623
62708
  const scene = this._scene;
62624
62709
  const sectionPlanesState = scene._sectionPlanesState;
62625
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
62710
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
62626
62711
  const src = [];
62627
62712
  src.push("#version 300 es");
62628
62713
  src.push("// Instancing geometry drawing fragment shader");
@@ -62655,7 +62740,7 @@ class TrianglesInstancingColorRenderer extends VBOSceneModelTriangleInstancingRe
62655
62740
  if (clipping) {
62656
62741
  src.push("in vec4 vWorldPosition;");
62657
62742
  src.push("in float vFlags;");
62658
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
62743
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
62659
62744
  src.push("uniform bool sectionPlaneActive" + i + ";");
62660
62745
  src.push("uniform vec3 sectionPlanePos" + i + ";");
62661
62746
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -62669,7 +62754,7 @@ class TrianglesInstancingColorRenderer extends VBOSceneModelTriangleInstancingRe
62669
62754
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
62670
62755
  src.push(" if (clippable) {");
62671
62756
  src.push(" float dist = 0.0;");
62672
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
62757
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
62673
62758
  src.push("if (sectionPlaneActive" + i + ") {");
62674
62759
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
62675
62760
  src.push("}");
@@ -62715,7 +62800,7 @@ class TrianglesInstancingFlatColorRenderer extends VBOSceneModelTriangleInstanci
62715
62800
  _buildVertexShader() {
62716
62801
  const scene = this._scene;
62717
62802
  const sectionPlanesState = scene._sectionPlanesState;
62718
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
62803
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
62719
62804
  const src = [];
62720
62805
  src.push("#version 300 es");
62721
62806
  src.push("// Instancing geometry flat-shading drawing vertex shader");
@@ -62797,7 +62882,7 @@ class TrianglesInstancingFlatColorRenderer extends VBOSceneModelTriangleInstanci
62797
62882
  const lightsState = scene._lightsState;
62798
62883
  let i;
62799
62884
  let len;
62800
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
62885
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
62801
62886
  const src = [];
62802
62887
  src.push("#version 300 es");
62803
62888
  src.push("// Instancing geometry flat-shading drawing fragment shader");
@@ -62830,7 +62915,7 @@ class TrianglesInstancingFlatColorRenderer extends VBOSceneModelTriangleInstanci
62830
62915
  if (clipping) {
62831
62916
  src.push("in vec4 vWorldPosition;");
62832
62917
  src.push("in float vFlags;");
62833
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
62918
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
62834
62919
  src.push("uniform bool sectionPlaneActive" + i + ";");
62835
62920
  src.push("uniform vec3 sectionPlanePos" + i + ";");
62836
62921
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -62869,7 +62954,7 @@ class TrianglesInstancingFlatColorRenderer extends VBOSceneModelTriangleInstanci
62869
62954
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
62870
62955
  src.push(" if (clippable) {");
62871
62956
  src.push(" float dist = 0.0;");
62872
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
62957
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
62873
62958
  src.push("if (sectionPlaneActive" + i + ") {");
62874
62959
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
62875
62960
  src.push("}");
@@ -62957,7 +63042,7 @@ class TrianglesInstancingSilhouetteRenderer extends VBOSceneModelTriangleInstanc
62957
63042
  _buildVertexShader() {
62958
63043
  const scene = this._scene;
62959
63044
  const sectionPlanesState = scene._sectionPlanesState;
62960
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63045
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
62961
63046
  const src = [];
62962
63047
  src.push("#version 300 es");
62963
63048
  src.push("// Instancing silhouette vertex shader");
@@ -63032,7 +63117,7 @@ class TrianglesInstancingSilhouetteRenderer extends VBOSceneModelTriangleInstanc
63032
63117
  _buildFragmentShader() {
63033
63118
  const scene = this._scene;
63034
63119
  const sectionPlanesState = scene._sectionPlanesState;
63035
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63120
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63036
63121
  const src = [];
63037
63122
  src.push("#version 300 es");
63038
63123
  src.push("// Instancing fill fragment shader");
@@ -63052,7 +63137,7 @@ class TrianglesInstancingSilhouetteRenderer extends VBOSceneModelTriangleInstanc
63052
63137
  if (clipping) {
63053
63138
  src.push("in vec4 vWorldPosition;");
63054
63139
  src.push("in float vFlags;");
63055
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
63140
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63056
63141
  src.push("uniform bool sectionPlaneActive" + i + ";");
63057
63142
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63058
63143
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63065,7 +63150,7 @@ class TrianglesInstancingSilhouetteRenderer extends VBOSceneModelTriangleInstanc
63065
63150
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63066
63151
  src.push(" if (clippable) {");
63067
63152
  src.push(" float dist = 0.0;");
63068
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
63153
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63069
63154
  src.push("if (sectionPlaneActive" + i + ") {");
63070
63155
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63071
63156
  src.push("}");
@@ -63094,7 +63179,7 @@ class TrianglesInstancingEdgesRenderer extends VBOSceneModelTriangleInstancingEd
63094
63179
  _buildVertexShader() {
63095
63180
  const scene = this._scene;
63096
63181
  const sectionPlanesState = scene._sectionPlanesState;
63097
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63182
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63098
63183
  const src = [];
63099
63184
  src.push("#version 300 es");
63100
63185
  src.push("// Triangles instancing edges vertex shader");
@@ -63163,7 +63248,7 @@ class TrianglesInstancingEdgesRenderer extends VBOSceneModelTriangleInstancingEd
63163
63248
  _buildFragmentShader() {
63164
63249
  const scene = this._scene;
63165
63250
  const sectionPlanesState = scene._sectionPlanesState;
63166
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63251
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63167
63252
  const src = [];
63168
63253
  src.push("#version 300 es");
63169
63254
  src.push("// Batched geometry edges drawing fragment shader");
@@ -63183,7 +63268,7 @@ class TrianglesInstancingEdgesRenderer extends VBOSceneModelTriangleInstancingEd
63183
63268
  if (clipping) {
63184
63269
  src.push("in vec4 vWorldPosition;");
63185
63270
  src.push("in float vFlags;");
63186
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
63271
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63187
63272
  src.push("uniform bool sectionPlaneActive" + i + ";");
63188
63273
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63189
63274
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63196,7 +63281,7 @@ class TrianglesInstancingEdgesRenderer extends VBOSceneModelTriangleInstancingEd
63196
63281
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63197
63282
  src.push(" if (clippable) {");
63198
63283
  src.push(" float dist = 0.0;");
63199
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
63284
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63200
63285
  src.push("if (sectionPlaneActive" + i + ") {");
63201
63286
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63202
63287
  src.push("}");
@@ -63221,7 +63306,7 @@ class TrianglesInstancingEdgesColorRenderer extends VBOSceneModelTriangleInstanc
63221
63306
  _buildVertexShader() {
63222
63307
  const scene = this._scene;
63223
63308
  const sectionPlanesState = scene._sectionPlanesState;
63224
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63309
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63225
63310
  const src = [];
63226
63311
  src.push("#version 300 es");
63227
63312
  src.push("// Triangles instancing edges vertex shader");
@@ -63291,7 +63376,7 @@ class TrianglesInstancingEdgesColorRenderer extends VBOSceneModelTriangleInstanc
63291
63376
  _buildFragmentShader() {
63292
63377
  const scene = this._scene;
63293
63378
  const sectionPlanesState = scene._sectionPlanesState;
63294
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63379
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63295
63380
  const src = [];
63296
63381
  src.push("#version 300 es");
63297
63382
  src.push("// Batched geometry edges drawing fragment shader");
@@ -63311,7 +63396,7 @@ class TrianglesInstancingEdgesColorRenderer extends VBOSceneModelTriangleInstanc
63311
63396
  if (clipping) {
63312
63397
  src.push("in vec4 vWorldPosition;");
63313
63398
  src.push("in float vFlags;");
63314
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
63399
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63315
63400
  src.push("uniform bool sectionPlaneActive" + i + ";");
63316
63401
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63317
63402
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63324,7 +63409,7 @@ class TrianglesInstancingEdgesColorRenderer extends VBOSceneModelTriangleInstanc
63324
63409
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63325
63410
  src.push(" if (clippable) {");
63326
63411
  src.push(" float dist = 0.0;");
63327
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
63412
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63328
63413
  src.push("if (sectionPlaneActive" + i + ") {");
63329
63414
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63330
63415
  src.push("}");
@@ -63349,7 +63434,7 @@ class TrianglesInstancingPickMeshRenderer extends VBOSceneModelTriangleInstancin
63349
63434
  _buildVertexShader() {
63350
63435
  const scene = this._scene;
63351
63436
  const sectionPlanesState = scene._sectionPlanesState;
63352
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63437
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63353
63438
  const src = [];
63354
63439
  src.push("#version 300 es");
63355
63440
  src.push("// Instancing geometry picking vertex shader");
@@ -63425,7 +63510,7 @@ class TrianglesInstancingPickMeshRenderer extends VBOSceneModelTriangleInstancin
63425
63510
  _buildFragmentShader() {
63426
63511
  const scene = this._scene;
63427
63512
  const sectionPlanesState = scene._sectionPlanesState;
63428
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63513
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63429
63514
  const src = [];
63430
63515
  src.push("#version 300 es");
63431
63516
  src.push("// Batched geometry picking fragment shader");
@@ -63445,7 +63530,7 @@ class TrianglesInstancingPickMeshRenderer extends VBOSceneModelTriangleInstancin
63445
63530
  if (clipping) {
63446
63531
  src.push("in vec4 vWorldPosition;");
63447
63532
  src.push("in float vFlags;");
63448
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63533
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63449
63534
  src.push("uniform bool sectionPlaneActive" + i + ";");
63450
63535
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63451
63536
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63458,7 +63543,7 @@ class TrianglesInstancingPickMeshRenderer extends VBOSceneModelTriangleInstancin
63458
63543
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63459
63544
  src.push(" if (clippable) {");
63460
63545
  src.push(" float dist = 0.0;");
63461
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63546
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63462
63547
  src.push("if (sectionPlaneActive" + i + ") {");
63463
63548
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63464
63549
  src.push("}");
@@ -63483,7 +63568,7 @@ class TrianglesInstancingPickDepthRenderer extends VBOSceneModelTriangleInstanci
63483
63568
  _buildVertexShader() {
63484
63569
  const scene = this._scene;
63485
63570
  const sectionPlanesState = scene._sectionPlanesState;
63486
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63571
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63487
63572
  const src = [];
63488
63573
  src.push("#version 300 es");
63489
63574
  src.push("// Instancing geometry depth vertex shader");
@@ -63559,7 +63644,7 @@ class TrianglesInstancingPickDepthRenderer extends VBOSceneModelTriangleInstanci
63559
63644
  _buildFragmentShader() {
63560
63645
  const scene = this._scene;
63561
63646
  const sectionPlanesState = scene._sectionPlanesState;
63562
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63647
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63563
63648
  const src = [];
63564
63649
  src.push("#version 300 es");
63565
63650
  src.push("// Batched geometry depth fragment shader");
@@ -63585,7 +63670,7 @@ class TrianglesInstancingPickDepthRenderer extends VBOSceneModelTriangleInstanci
63585
63670
  if (clipping) {
63586
63671
  src.push("in vec4 vWorldPosition;");
63587
63672
  src.push("in float vFlags;");
63588
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63673
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63589
63674
  src.push("uniform bool sectionPlaneActive" + i + ";");
63590
63675
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63591
63676
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63605,7 +63690,7 @@ class TrianglesInstancingPickDepthRenderer extends VBOSceneModelTriangleInstanci
63605
63690
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63606
63691
  src.push(" if (clippable) {");
63607
63692
  src.push(" float dist = 0.0;");
63608
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63693
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63609
63694
  src.push("if (sectionPlaneActive" + i + ") {");
63610
63695
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63611
63696
  src.push("}");
@@ -63631,7 +63716,7 @@ class TrianglesInstancingPickNormalsRenderer extends VBOSceneModelTriangleInstan
63631
63716
  _buildVertexShader() {
63632
63717
  const scene = this._scene;
63633
63718
  const sectionPlanesState = scene._sectionPlanesState;
63634
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63719
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63635
63720
  const src = [];
63636
63721
  src.push("#version 300 es");
63637
63722
  src.push("// Instancing geometry normals vertex shader");
@@ -63712,7 +63797,7 @@ class TrianglesInstancingPickNormalsRenderer extends VBOSceneModelTriangleInstan
63712
63797
  _buildFragmentShader() {
63713
63798
  const scene = this._scene;
63714
63799
  const sectionPlanesState = scene._sectionPlanesState;
63715
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63800
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63716
63801
  const src = [];
63717
63802
  src.push("#version 300 es");
63718
63803
  src.push("// Batched geometry normals fragment shader");
@@ -63736,7 +63821,7 @@ class TrianglesInstancingPickNormalsRenderer extends VBOSceneModelTriangleInstan
63736
63821
  if (clipping) {
63737
63822
  src.push("in vec4 vWorldPosition;");
63738
63823
  src.push("in float vFlags;");
63739
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63824
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63740
63825
  src.push("uniform bool sectionPlaneActive" + i + ";");
63741
63826
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63742
63827
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63749,7 +63834,7 @@ class TrianglesInstancingPickNormalsRenderer extends VBOSceneModelTriangleInstan
63749
63834
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63750
63835
  src.push(" if (clippable) {");
63751
63836
  src.push(" float dist = 0.0;");
63752
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63837
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63753
63838
  src.push("if (sectionPlaneActive" + i + ") {");
63754
63839
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63755
63840
  src.push("}");
@@ -63774,7 +63859,7 @@ class TrianglesInstancingOcclusionRenderer extends VBOSceneModelTriangleInstanci
63774
63859
  _buildVertexShader() {
63775
63860
  const scene = this._scene;
63776
63861
  const sectionPlanesState = scene._sectionPlanesState;
63777
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63862
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63778
63863
  const src = [];
63779
63864
  src.push("#version 300 es");
63780
63865
  src.push("// TrianglesInstancingOcclusionRenderer vertex shader");
@@ -63825,7 +63910,7 @@ class TrianglesInstancingOcclusionRenderer extends VBOSceneModelTriangleInstanci
63825
63910
  _buildFragmentShader() {
63826
63911
  const scene = this._scene;
63827
63912
  const sectionPlanesState = scene._sectionPlanesState;
63828
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63913
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63829
63914
  const src = [];
63830
63915
  src.push("#version 300 es");
63831
63916
  src.push("// TrianglesInstancingOcclusionRenderer fragment shader");
@@ -63840,7 +63925,7 @@ class TrianglesInstancingOcclusionRenderer extends VBOSceneModelTriangleInstanci
63840
63925
  if (clipping) {
63841
63926
  src.push("in vec4 vWorldPosition;");
63842
63927
  src.push("in float vFlags;");
63843
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63928
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63844
63929
  src.push("uniform bool sectionPlaneActive" + i + ";");
63845
63930
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63846
63931
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63852,7 +63937,7 @@ class TrianglesInstancingOcclusionRenderer extends VBOSceneModelTriangleInstanci
63852
63937
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63853
63938
  src.push(" if (clippable) {");
63854
63939
  src.push(" float dist = 0.0;");
63855
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63940
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63856
63941
  src.push("if (sectionPlaneActive" + i + ") {");
63857
63942
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63858
63943
  src.push("}");
@@ -63874,7 +63959,7 @@ class TrianglesInstancingDepthRenderer extends VBOSceneModelTriangleInstancingRe
63874
63959
  _buildVertexShader() {
63875
63960
  const scene = this._scene;
63876
63961
  const sectionPlanesState = scene._sectionPlanesState;
63877
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63962
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63878
63963
  const src = [];
63879
63964
  src.push("#version 300 es");
63880
63965
  src.push("// Instancing geometry depth drawing vertex shader");
@@ -63942,7 +64027,7 @@ class TrianglesInstancingDepthRenderer extends VBOSceneModelTriangleInstancingRe
63942
64027
  const sectionPlanesState = scene._sectionPlanesState;
63943
64028
  let i;
63944
64029
  let len;
63945
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64030
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63946
64031
  const src = [];
63947
64032
  src.push("#version 300 es");
63948
64033
  src.push("// Instancing geometry depth drawing fragment shader");
@@ -63957,7 +64042,7 @@ class TrianglesInstancingDepthRenderer extends VBOSceneModelTriangleInstancingRe
63957
64042
  if (clipping) {
63958
64043
  src.push("in vec4 vWorldPosition;");
63959
64044
  src.push("in float vFlags;");
63960
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64045
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63961
64046
  src.push("uniform bool sectionPlaneActive" + i + ";");
63962
64047
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63963
64048
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63970,7 +64055,7 @@ class TrianglesInstancingDepthRenderer extends VBOSceneModelTriangleInstancingRe
63970
64055
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63971
64056
  src.push(" if (clippable) {");
63972
64057
  src.push(" float dist = 0.0;");
63973
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64058
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63974
64059
  src.push("if (sectionPlaneActive" + i + ") {");
63975
64060
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63976
64061
  src.push("}");
@@ -63996,7 +64081,7 @@ class TrianglesInstancingNormalsRenderer extends VBOSceneModelTriangleInstancing
63996
64081
  _buildVertexShader() {
63997
64082
  const scene = this._scene;
63998
64083
  const sectionPlanesState = scene._sectionPlanesState;
63999
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64084
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64000
64085
  const src = [];
64001
64086
  src.push("#version 300 es");
64002
64087
  src.push("// Instancing geometry normals drawing vertex shader");
@@ -64072,7 +64157,7 @@ class TrianglesInstancingNormalsRenderer extends VBOSceneModelTriangleInstancing
64072
64157
  _buildFragmentShader() {
64073
64158
  const scene = this._scene;
64074
64159
  const sectionPlanesState = scene._sectionPlanesState;
64075
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64160
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64076
64161
  const src = [];
64077
64162
  src.push("#version 300 es");
64078
64163
  src.push("// Instancing geometry depth drawing fragment shader");
@@ -64092,7 +64177,7 @@ class TrianglesInstancingNormalsRenderer extends VBOSceneModelTriangleInstancing
64092
64177
  if (clipping) {
64093
64178
  src.push("in vec4 vWorldPosition;");
64094
64179
  src.push("in float vFlags;");
64095
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64180
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
64096
64181
  src.push("uniform bool sectionPlaneActive" + i + ";");
64097
64182
  src.push("uniform vec3 sectionPlanePos" + i + ";");
64098
64183
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -64108,7 +64193,7 @@ class TrianglesInstancingNormalsRenderer extends VBOSceneModelTriangleInstancing
64108
64193
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
64109
64194
  src.push(" if (clippable) {");
64110
64195
  src.push(" float dist = 0.0;");
64111
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64196
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
64112
64197
  src.push("if (sectionPlaneActive" + i + ") {");
64113
64198
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
64114
64199
  src.push("}");
@@ -64135,7 +64220,7 @@ class TrianglesInstancingShadowRenderer extends VBOSceneModelTriangleInstancingR
64135
64220
  _buildVertexShader() {
64136
64221
  const scene = this._scene;
64137
64222
  const sectionPlanesState = scene._sectionPlanesState;
64138
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64223
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64139
64224
  const src = [];
64140
64225
  src.push("#version 300 es");
64141
64226
  src.push("// Instancing geometry shadow drawing vertex shader");
@@ -64184,7 +64269,7 @@ class TrianglesInstancingShadowRenderer extends VBOSceneModelTriangleInstancingR
64184
64269
  _buildFragmentShader() {
64185
64270
  const scene = this._scene;
64186
64271
  const sectionPlanesState = scene._sectionPlanesState;
64187
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64272
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64188
64273
  const src = [];
64189
64274
  src.push("#version 300 es");
64190
64275
  src.push("// Instancing geometry depth drawing fragment shader");
@@ -64203,7 +64288,7 @@ class TrianglesInstancingShadowRenderer extends VBOSceneModelTriangleInstancingR
64203
64288
  if (clipping) {
64204
64289
  src.push("in vec4 vWorldPosition;");
64205
64290
  src.push("in float vFlags;");
64206
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64291
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
64207
64292
  src.push("uniform bool sectionPlaneActive" + i + ";");
64208
64293
  src.push("uniform vec3 sectionPlanePos" + i + ";");
64209
64294
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -64219,7 +64304,7 @@ class TrianglesInstancingShadowRenderer extends VBOSceneModelTriangleInstancingR
64219
64304
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
64220
64305
  src.push(" if (clippable) {");
64221
64306
  src.push(" float dist = 0.0;");
64222
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64307
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
64223
64308
  src.push("if (sectionPlaneActive" + i + ") {");
64224
64309
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
64225
64310
  src.push("}");
@@ -64258,7 +64343,7 @@ class TrianglesInstancingPBRRenderer extends VBOSceneModelTriangleInstancingRend
64258
64343
  const scene = this._scene;
64259
64344
  const sectionPlanesState = scene._sectionPlanesState;
64260
64345
  const lightsState = scene._lightsState;
64261
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64346
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64262
64347
  const clippingCaps = sectionPlanesState.clippingCaps;
64263
64348
  const src = [];
64264
64349
  src.push("#version 300 es");
@@ -64384,7 +64469,7 @@ class TrianglesInstancingPBRRenderer extends VBOSceneModelTriangleInstancingRend
64384
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.
64385
64470
  const sectionPlanesState = scene._sectionPlanesState;
64386
64471
  const lightsState = scene._lightsState;
64387
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64472
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64388
64473
  const clippingCaps = sectionPlanesState.clippingCaps;
64389
64474
  const src = [];
64390
64475
  src.push("#version 300 es");
@@ -64474,7 +64559,7 @@ class TrianglesInstancingPBRRenderer extends VBOSceneModelTriangleInstancingRend
64474
64559
  if (clippingCaps) {
64475
64560
  src.push("in vec4 vClipPosition;");
64476
64561
  }
64477
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64562
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
64478
64563
  src.push("uniform bool sectionPlaneActive" + i + ";");
64479
64564
  src.push("uniform vec3 sectionPlanePos" + i + ";");
64480
64565
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -64663,7 +64748,7 @@ class TrianglesInstancingPBRRenderer extends VBOSceneModelTriangleInstancingRend
64663
64748
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
64664
64749
  src.push(" if (clippable) {");
64665
64750
  src.push(" float dist = 0.0;");
64666
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64751
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
64667
64752
  src.push("if (sectionPlaneActive" + i + ") {");
64668
64753
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
64669
64754
  src.push("}");
@@ -64803,7 +64888,7 @@ class TrianglesInstancingPickNormalsFlatRenderer extends VBOSceneModelTriangleIn
64803
64888
  _buildVertexShader() {
64804
64889
  const scene = this._scene;
64805
64890
  const sectionPlanesState = scene._sectionPlanesState;
64806
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64891
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64807
64892
  const src = [];
64808
64893
  src.push("#version 300 es");
64809
64894
  src.push("// Instancing geometry normals vertex shader");
@@ -64870,7 +64955,7 @@ class TrianglesInstancingPickNormalsFlatRenderer extends VBOSceneModelTriangleIn
64870
64955
  _buildFragmentShader() {
64871
64956
  const scene = this._scene;
64872
64957
  const sectionPlanesState = scene._sectionPlanesState;
64873
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64958
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64874
64959
  const src = [];
64875
64960
  src.push("#version 300 es");
64876
64961
  src.push("// Batched geometry normals fragment shader");
@@ -64891,7 +64976,7 @@ class TrianglesInstancingPickNormalsFlatRenderer extends VBOSceneModelTriangleIn
64891
64976
  src.push("in vec4 vWorldPosition;");
64892
64977
  if (clipping) {
64893
64978
  src.push("in float vFlags;");
64894
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
64979
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
64895
64980
  src.push("uniform bool sectionPlaneActive" + i + ";");
64896
64981
  src.push("uniform vec3 sectionPlanePos" + i + ";");
64897
64982
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -64903,7 +64988,7 @@ class TrianglesInstancingPickNormalsFlatRenderer extends VBOSceneModelTriangleIn
64903
64988
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
64904
64989
  src.push(" if (clippable) {");
64905
64990
  src.push(" float dist = 0.0;");
64906
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
64991
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
64907
64992
  src.push("if (sectionPlaneActive" + i + ") {");
64908
64993
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
64909
64994
  src.push("}");
@@ -64939,7 +65024,7 @@ class TrianglesInstancingColorTextureRenderer extends VBOSceneModelTriangleInsta
64939
65024
  _buildVertexShader() {
64940
65025
  const scene = this._scene;
64941
65026
  const sectionPlanesState = scene._sectionPlanesState;
64942
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
65027
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64943
65028
  const src = [];
64944
65029
  src.push("#version 300 es");
64945
65030
  src.push("// Instancing geometry drawing vertex shader");
@@ -65026,7 +65111,7 @@ class TrianglesInstancingColorTextureRenderer extends VBOSceneModelTriangleInsta
65026
65111
  const lightsState = scene._lightsState;
65027
65112
  let i;
65028
65113
  let len;
65029
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
65114
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
65030
65115
  const src = [];
65031
65116
  src.push("#version 300 es");
65032
65117
  src.push("// Instancing geometry drawing fragment shader");
@@ -65075,7 +65160,7 @@ class TrianglesInstancingColorTextureRenderer extends VBOSceneModelTriangleInsta
65075
65160
  if (clipping) {
65076
65161
  src.push("in vec4 vWorldPosition;");
65077
65162
  src.push("in float vFlags;");
65078
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
65163
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
65079
65164
  src.push("uniform bool sectionPlaneActive" + i + ";");
65080
65165
  src.push("uniform vec3 sectionPlanePos" + i + ";");
65081
65166
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -65113,7 +65198,7 @@ class TrianglesInstancingColorTextureRenderer extends VBOSceneModelTriangleInsta
65113
65198
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
65114
65199
  src.push(" if (clippable) {");
65115
65200
  src.push(" float dist = 0.0;");
65116
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
65201
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
65117
65202
  src.push("if (sectionPlaneActive" + i + ") {");
65118
65203
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
65119
65204
  src.push("}");
@@ -65525,7 +65610,7 @@ function getInstancingRenderers$1(scene) {
65525
65610
  const tempVec3a$o = math.vec3();
65526
65611
  const tempVec3b$k = math.vec3();
65527
65612
  const tempVec3c$h = math.vec3();
65528
- const tempVec3d$d = math.vec3();
65613
+ const tempVec3d$5 = math.vec3();
65529
65614
  const tempMat4a$e = math.mat4();
65530
65615
 
65531
65616
  /**
@@ -65594,7 +65679,7 @@ class SnapInstancingDepthBufInitRenderer extends VBOSceneModelRenderer {
65594
65679
  rtcOrigin[1] += position[1];
65595
65680
  rtcOrigin[2] += position[2];
65596
65681
  rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a$e);
65597
- rtcCameraEye = tempVec3d$d;
65682
+ rtcCameraEye = tempVec3d$5;
65598
65683
  rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];
65599
65684
  rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];
65600
65685
  rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];
@@ -65694,7 +65779,7 @@ class SnapInstancingDepthBufInitRenderer extends VBOSceneModelRenderer {
65694
65779
  _buildVertexShader() {
65695
65780
  const scene = this._scene;
65696
65781
  const sectionPlanesState = scene._sectionPlanesState;
65697
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
65782
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
65698
65783
  const src = [];
65699
65784
  src.push ('#version 300 es');
65700
65785
  src.push("// SnapInstancingDepthBufInitRenderer vertex shader");
@@ -65784,7 +65869,7 @@ class SnapInstancingDepthBufInitRenderer extends VBOSceneModelRenderer {
65784
65869
  _buildFragmentShader() {
65785
65870
  const scene = this._scene;
65786
65871
  const sectionPlanesState = scene._sectionPlanesState;
65787
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
65872
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
65788
65873
  const src = [];
65789
65874
  src.push ('#version 300 es');
65790
65875
  src.push("// Points instancing pick depth fragment shader");
@@ -65806,7 +65891,7 @@ class SnapInstancingDepthBufInitRenderer extends VBOSceneModelRenderer {
65806
65891
  src.push("flat in vec4 vPickColor;");
65807
65892
  if (clipping) {
65808
65893
  src.push("in float vFlags;");
65809
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
65894
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
65810
65895
  src.push("uniform bool sectionPlaneActive" + i + ";");
65811
65896
  src.push("uniform vec3 sectionPlanePos" + i + ";");
65812
65897
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -65821,7 +65906,7 @@ class SnapInstancingDepthBufInitRenderer extends VBOSceneModelRenderer {
65821
65906
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
65822
65907
  src.push(" if (clippable) {");
65823
65908
  src.push(" float dist = 0.0;");
65824
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
65909
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
65825
65910
  src.push("if (sectionPlaneActive" + i + ") {");
65826
65911
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
65827
65912
  src.push("}");
@@ -65861,7 +65946,7 @@ class SnapInstancingDepthBufInitRenderer extends VBOSceneModelRenderer {
65861
65946
  const tempVec3a$n = math.vec3();
65862
65947
  const tempVec3b$j = math.vec3();
65863
65948
  const tempVec3c$g = math.vec3();
65864
- const tempVec3d$c = math.vec3();
65949
+ const tempVec3d$4 = math.vec3();
65865
65950
  const tempMat4a$d = math.mat4();
65866
65951
 
65867
65952
  /**
@@ -65931,7 +66016,7 @@ class SnapInstancingDepthRenderer extends VBOSceneModelRenderer {
65931
66016
  rtcOrigin[1] += position[1];
65932
66017
  rtcOrigin[2] += position[2];
65933
66018
  rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a$d);
65934
- rtcCameraEye = tempVec3d$c;
66019
+ rtcCameraEye = tempVec3d$4;
65935
66020
  rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];
65936
66021
  rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];
65937
66022
  rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];
@@ -66028,7 +66113,7 @@ class SnapInstancingDepthRenderer extends VBOSceneModelRenderer {
66028
66113
  _buildVertexShader() {
66029
66114
  const scene = this._scene;
66030
66115
  const sectionPlanesState = scene._sectionPlanesState;
66031
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
66116
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
66032
66117
  const src = [];
66033
66118
  src.push ('#version 300 es');
66034
66119
  src.push("// SnapInstancingDepthRenderer vertex shader");
@@ -66116,7 +66201,7 @@ class SnapInstancingDepthRenderer extends VBOSceneModelRenderer {
66116
66201
  _buildFragmentShader() {
66117
66202
  const scene = this._scene;
66118
66203
  const sectionPlanesState = scene._sectionPlanesState;
66119
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
66204
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
66120
66205
  const src = [];
66121
66206
  src.push ('#version 300 es');
66122
66207
  src.push("// SnapInstancingDepthRenderer fragment shader");
@@ -66137,7 +66222,7 @@ class SnapInstancingDepthRenderer extends VBOSceneModelRenderer {
66137
66222
  if (clipping) {
66138
66223
  src.push("in vec4 vWorldPosition;");
66139
66224
  src.push("in float vFlags;");
66140
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
66225
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
66141
66226
  src.push("uniform bool sectionPlaneActive" + i + ";");
66142
66227
  src.push("uniform vec3 sectionPlanePos" + i + ";");
66143
66228
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -66150,7 +66235,7 @@ class SnapInstancingDepthRenderer extends VBOSceneModelRenderer {
66150
66235
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
66151
66236
  src.push(" if (clippable) {");
66152
66237
  src.push(" float dist = 0.0;");
66153
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
66238
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
66154
66239
  src.push("if (sectionPlaneActive" + i + ") {");
66155
66240
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
66156
66241
  src.push("}");
@@ -66271,8 +66356,8 @@ const tempVec3fa$2 = new Float32Array(3);
66271
66356
  const tempVec3a$m = math.vec3();
66272
66357
  const tempVec3b$i = math.vec3();
66273
66358
  const tempVec3c$f = math.vec3();
66274
- const tempVec3d$b = math.vec3();
66275
- const tempVec3e$2 = math.vec3();
66359
+ const tempVec3d$3 = math.vec3();
66360
+ const tempVec3e = math.vec3();
66276
66361
  const tempVec3f = math.vec3();
66277
66362
  const tempVec3g = math.vec3();
66278
66363
 
@@ -67348,8 +67433,8 @@ class TrianglesInstancingLayer {
67348
67433
 
67349
67434
  math.transformRay(portion.inverseMatrix, rtcRayOrigin, rtcRayDir, rtcRayOrigin, rtcRayDir);
67350
67435
 
67351
- const a = tempVec3d$b;
67352
- const b = tempVec3e$2;
67436
+ const a = tempVec3d$3;
67437
+ const b = tempVec3e;
67353
67438
  const c = tempVec3f;
67354
67439
 
67355
67440
  let gotIntersect = false;
@@ -67479,7 +67564,7 @@ class LinesBatchingColorRenderer extends VBOSceneModelLineBatchingRenderer {
67479
67564
  _buildVertexShader() {
67480
67565
  const scene = this._scene;
67481
67566
  const sectionPlanesState = scene._sectionPlanesState;
67482
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
67567
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
67483
67568
  const src = [];
67484
67569
  src.push('#version 300 es');
67485
67570
  src.push("// Lines batching color vertex shader");
@@ -67532,7 +67617,7 @@ class LinesBatchingColorRenderer extends VBOSceneModelLineBatchingRenderer {
67532
67617
  _buildFragmentShader() {
67533
67618
  const scene = this._scene;
67534
67619
  const sectionPlanesState = scene._sectionPlanesState;
67535
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
67620
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
67536
67621
  const src = [];
67537
67622
  src.push('#version 300 es');
67538
67623
  src.push("// Lines batching color fragment shader");
@@ -67550,7 +67635,7 @@ class LinesBatchingColorRenderer extends VBOSceneModelLineBatchingRenderer {
67550
67635
  if (clipping) {
67551
67636
  src.push("in vec4 vWorldPosition;");
67552
67637
  src.push("in float vFlags;");
67553
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
67638
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
67554
67639
  src.push("uniform bool sectionPlaneActive" + i + ";");
67555
67640
  src.push("uniform vec3 sectionPlanePos" + i + ";");
67556
67641
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -67563,7 +67648,7 @@ class LinesBatchingColorRenderer extends VBOSceneModelLineBatchingRenderer {
67563
67648
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
67564
67649
  src.push(" if (clippable) {");
67565
67650
  src.push(" float dist = 0.0;");
67566
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
67651
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
67567
67652
  src.push("if (sectionPlaneActive" + i + ") {");
67568
67653
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
67569
67654
  src.push("}");
@@ -67593,7 +67678,7 @@ class LinesBatchingSilhouetteRenderer extends VBOSceneModelLineBatchingRenderer
67593
67678
 
67594
67679
  const scene = this._scene;
67595
67680
  const sectionPlanesState = scene._sectionPlanesState;
67596
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
67681
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
67597
67682
 
67598
67683
  const src = [];
67599
67684
  src.push('#version 300 es');
@@ -67654,7 +67739,7 @@ class LinesBatchingSilhouetteRenderer extends VBOSceneModelLineBatchingRenderer
67654
67739
 
67655
67740
  const scene = this._scene;
67656
67741
  const sectionPlanesState = scene._sectionPlanesState;
67657
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
67742
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
67658
67743
  const src = [];
67659
67744
  src.push('#version 300 es');
67660
67745
  src.push("// Lines batching silhouette fragment shader");
@@ -67673,7 +67758,7 @@ class LinesBatchingSilhouetteRenderer extends VBOSceneModelLineBatchingRenderer
67673
67758
  if (clipping) {
67674
67759
  src.push("in vec4 vWorldPosition;");
67675
67760
  src.push("in float vFlags;");
67676
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
67761
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
67677
67762
  src.push("uniform bool sectionPlaneActive" + i + ";");
67678
67763
  src.push("uniform vec3 sectionPlanePos" + i + ";");
67679
67764
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -67686,7 +67771,7 @@ class LinesBatchingSilhouetteRenderer extends VBOSceneModelLineBatchingRenderer
67686
67771
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
67687
67772
  src.push(" if (clippable) {");
67688
67773
  src.push(" float dist = 0.0;");
67689
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
67774
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
67690
67775
  src.push("if (sectionPlaneActive" + i + ") {");
67691
67776
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
67692
67777
  src.push("}");
@@ -68534,7 +68619,7 @@ class LinesInstancingColorRenderer extends VBOSceneModelLineInstancingRenderer {
68534
68619
  _buildVertexShader() {
68535
68620
  const scene = this._scene;
68536
68621
  const sectionPlanesState = scene._sectionPlanesState;
68537
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
68622
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
68538
68623
  const src = [];
68539
68624
  src.push('#version 300 es');
68540
68625
  src.push("// Lines instancing color vertex shader");
@@ -68607,7 +68692,7 @@ class LinesInstancingColorRenderer extends VBOSceneModelLineInstancingRenderer {
68607
68692
  const sectionPlanesState = scene._sectionPlanesState;
68608
68693
  let i;
68609
68694
  let len;
68610
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
68695
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
68611
68696
  const src = [];
68612
68697
  src.push('#version 300 es');
68613
68698
  src.push("// Lines instancing color fragment shader");
@@ -68625,7 +68710,7 @@ class LinesInstancingColorRenderer extends VBOSceneModelLineInstancingRenderer {
68625
68710
  if (clipping) {
68626
68711
  src.push("in vec4 vWorldPosition;");
68627
68712
  src.push("in float vFlags;");
68628
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
68713
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
68629
68714
  src.push("uniform bool sectionPlaneActive" + i + ";");
68630
68715
  src.push("uniform vec3 sectionPlanePos" + i + ";");
68631
68716
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -68638,7 +68723,7 @@ class LinesInstancingColorRenderer extends VBOSceneModelLineInstancingRenderer {
68638
68723
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
68639
68724
  src.push(" if (clippable) {");
68640
68725
  src.push(" float dist = 0.0;");
68641
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
68726
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
68642
68727
  src.push("if (sectionPlaneActive" + i + ") {");
68643
68728
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
68644
68729
  src.push("}");
@@ -68681,7 +68766,7 @@ class LinesInstancingSilhouetteRenderer extends VBOSceneModelLineInstancingRende
68681
68766
  _buildVertexShader() {
68682
68767
  const scene = this._scene;
68683
68768
  const sectionPlanesState = scene._sectionPlanesState;
68684
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
68769
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
68685
68770
  const src = [];
68686
68771
  src.push('#version 300 es');
68687
68772
  src.push("// Lines instancing silhouette vertex shader");
@@ -68746,7 +68831,7 @@ class LinesInstancingSilhouetteRenderer extends VBOSceneModelLineInstancingRende
68746
68831
  _buildFragmentShader() {
68747
68832
  const scene = this._scene;
68748
68833
  const sectionPlanesState = scene._sectionPlanesState;
68749
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
68834
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
68750
68835
  const src = [];
68751
68836
  src.push('#version 300 es');
68752
68837
  src.push("// Lines instancing silhouette fragment shader");
@@ -68764,7 +68849,7 @@ class LinesInstancingSilhouetteRenderer extends VBOSceneModelLineInstancingRende
68764
68849
  if (clipping) {
68765
68850
  src.push("in vec4 vWorldPosition;");
68766
68851
  src.push("in float vFlags;");
68767
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
68852
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
68768
68853
  src.push("uniform bool sectionPlaneActive" + i + ";");
68769
68854
  src.push("uniform vec3 sectionPlanePos" + i + ";");
68770
68855
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -68777,7 +68862,7 @@ class LinesInstancingSilhouetteRenderer extends VBOSceneModelLineInstancingRende
68777
68862
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
68778
68863
  src.push(" if (clippable) {");
68779
68864
  src.push(" float dist = 0.0;");
68780
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
68865
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
68781
68866
  src.push("if (sectionPlaneActive" + i + ") {");
68782
68867
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
68783
68868
  src.push("}");
@@ -69556,7 +69641,7 @@ class PointsBatchingColorRenderer extends VBOSceneModelPointBatchingRenderer {
69556
69641
 
69557
69642
  const scene = this._scene;
69558
69643
  const sectionPlanesState = scene._sectionPlanesState;
69559
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
69644
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
69560
69645
  const pointsMaterial = scene.pointsMaterial;
69561
69646
  const src = [];
69562
69647
  src.push('#version 300 es');
@@ -69649,7 +69734,7 @@ class PointsBatchingColorRenderer extends VBOSceneModelPointBatchingRenderer {
69649
69734
 
69650
69735
  const scene = this._scene;
69651
69736
  const sectionPlanesState = scene._sectionPlanesState;
69652
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
69737
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
69653
69738
  const src = [];
69654
69739
  src.push('#version 300 es');
69655
69740
  src.push("// Points batching color fragment shader");
@@ -69668,7 +69753,7 @@ class PointsBatchingColorRenderer extends VBOSceneModelPointBatchingRenderer {
69668
69753
  if (clipping) {
69669
69754
  src.push("in vec4 vWorldPosition;");
69670
69755
  src.push("in float vFlags;");
69671
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
69756
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
69672
69757
  src.push("uniform bool sectionPlaneActive" + i + ";");
69673
69758
  src.push("uniform vec3 sectionPlanePos" + i + ";");
69674
69759
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -69688,7 +69773,7 @@ class PointsBatchingColorRenderer extends VBOSceneModelPointBatchingRenderer {
69688
69773
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
69689
69774
  src.push(" if (clippable) {");
69690
69775
  src.push(" float dist = 0.0;");
69691
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
69776
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
69692
69777
  src.push("if (sectionPlaneActive" + i + ") {");
69693
69778
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
69694
69779
  src.push("}");
@@ -69721,7 +69806,7 @@ class PointsBatchingSilhouetteRenderer extends VBOSceneModelPointBatchingRendere
69721
69806
 
69722
69807
  const scene = this._scene;
69723
69808
  const sectionPlanesState = scene._sectionPlanesState;
69724
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
69809
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
69725
69810
  const pointsMaterial = scene.pointsMaterial._state;
69726
69811
  const src = [];
69727
69812
  src.push ('#version 300 es');
@@ -69794,7 +69879,7 @@ class PointsBatchingSilhouetteRenderer extends VBOSceneModelPointBatchingRendere
69794
69879
  const sectionPlanesState = scene._sectionPlanesState;
69795
69880
  let i;
69796
69881
  let len;
69797
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
69882
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
69798
69883
  const src = [];
69799
69884
  src.push ('#version 300 es');
69800
69885
  src.push("// Points batching silhouette vertex shader");
@@ -69812,7 +69897,7 @@ class PointsBatchingSilhouetteRenderer extends VBOSceneModelPointBatchingRendere
69812
69897
  if (clipping) {
69813
69898
  src.push("in vec4 vWorldPosition;");
69814
69899
  src.push("in float vFlags;");
69815
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
69900
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
69816
69901
  src.push("uniform bool sectionPlaneActive" + i + ";");
69817
69902
  src.push("uniform vec3 sectionPlanePos" + i + ";");
69818
69903
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -69832,7 +69917,7 @@ class PointsBatchingSilhouetteRenderer extends VBOSceneModelPointBatchingRendere
69832
69917
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
69833
69918
  src.push(" if (clippable) {");
69834
69919
  src.push(" float dist = 0.0;");
69835
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
69920
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
69836
69921
  src.push("if (sectionPlaneActive" + i + ") {");
69837
69922
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
69838
69923
  src.push("}");
@@ -69860,7 +69945,7 @@ class PointsBatchingPickMeshRenderer extends VBOSceneModelPointBatchingRenderer
69860
69945
  _buildVertexShader() {
69861
69946
 
69862
69947
  const scene = this._scene;
69863
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
69948
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
69864
69949
  const pointsMaterial = scene.pointsMaterial._state;
69865
69950
  const src = [];
69866
69951
  src.push ('#version 300 es');
@@ -69939,7 +70024,7 @@ class PointsBatchingPickMeshRenderer extends VBOSceneModelPointBatchingRenderer
69939
70024
  _buildFragmentShader() {
69940
70025
  const scene = this._scene;
69941
70026
  const sectionPlanesState = scene._sectionPlanesState;
69942
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
70027
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
69943
70028
  const src = [];
69944
70029
  src.push ('#version 300 es');
69945
70030
  src.push("// Points batching pick mesh vertex shader");
@@ -69957,7 +70042,7 @@ class PointsBatchingPickMeshRenderer extends VBOSceneModelPointBatchingRenderer
69957
70042
  if (clipping) {
69958
70043
  src.push("in vec4 vWorldPosition;");
69959
70044
  src.push("in float vFlags;");
69960
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
70045
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
69961
70046
  src.push("uniform bool sectionPlaneActive" + i + ";");
69962
70047
  src.push("uniform vec3 sectionPlanePos" + i + ";");
69963
70048
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -69977,7 +70062,7 @@ class PointsBatchingPickMeshRenderer extends VBOSceneModelPointBatchingRenderer
69977
70062
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
69978
70063
  src.push(" if (clippable) {");
69979
70064
  src.push(" float dist = 0.0;");
69980
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
70065
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
69981
70066
  src.push(" if (sectionPlaneActive" + i + ") {");
69982
70067
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
69983
70068
  src.push(" }");
@@ -70004,7 +70089,7 @@ class PointsBatchingPickDepthRenderer extends VBOSceneModelPointBatchingRenderer
70004
70089
 
70005
70090
  _buildVertexShader() {
70006
70091
  const scene = this._scene;
70007
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
70092
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
70008
70093
  const pointsMaterial = scene.pointsMaterial._state;
70009
70094
  const src = [];
70010
70095
  src.push ('#version 300 es');
@@ -70078,7 +70163,7 @@ class PointsBatchingPickDepthRenderer extends VBOSceneModelPointBatchingRenderer
70078
70163
  _buildFragmentShader() {
70079
70164
  const scene = this._scene;
70080
70165
  const sectionPlanesState = scene._sectionPlanesState;
70081
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
70166
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
70082
70167
  const src = [];
70083
70168
  src.push ('#version 300 es');
70084
70169
  src.push("// Points batched pick depth fragment shader");
@@ -70102,7 +70187,7 @@ class PointsBatchingPickDepthRenderer extends VBOSceneModelPointBatchingRenderer
70102
70187
  if (clipping) {
70103
70188
  src.push("in vec4 vWorldPosition;");
70104
70189
  src.push("in float vFlags;");
70105
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
70190
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
70106
70191
  src.push("uniform bool sectionPlaneActive" + i + ";");
70107
70192
  src.push("uniform vec3 sectionPlanePos" + i + ";");
70108
70193
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -70129,7 +70214,7 @@ class PointsBatchingPickDepthRenderer extends VBOSceneModelPointBatchingRenderer
70129
70214
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
70130
70215
  src.push(" if (clippable) {");
70131
70216
  src.push(" float dist = 0.0;");
70132
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
70217
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
70133
70218
  src.push(" if (sectionPlaneActive" + i + ") {");
70134
70219
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
70135
70220
  src.push(" }");
@@ -70157,7 +70242,7 @@ class PointsBatchingOcclusionRenderer extends VBOSceneModelPointBatchingRenderer
70157
70242
 
70158
70243
  _buildVertexShader() {
70159
70244
  const scene = this._scene;
70160
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
70245
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
70161
70246
  const pointsMaterial = scene.pointsMaterial._state;
70162
70247
  const src = [];
70163
70248
  src.push ('#version 300 es');
@@ -70225,7 +70310,7 @@ class PointsBatchingOcclusionRenderer extends VBOSceneModelPointBatchingRenderer
70225
70310
  _buildFragmentShader() {
70226
70311
  const scene = this._scene;
70227
70312
  const sectionPlanesState = scene._sectionPlanesState;
70228
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
70313
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
70229
70314
  const src = [];
70230
70315
  src.push ('#version 300 es');
70231
70316
  src.push("// Points batching occlusion fragment shader");
@@ -70243,7 +70328,7 @@ class PointsBatchingOcclusionRenderer extends VBOSceneModelPointBatchingRenderer
70243
70328
  if (clipping) {
70244
70329
  src.push("in vec4 vWorldPosition;");
70245
70330
  src.push("in float vFlags;");
70246
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
70331
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
70247
70332
  src.push("uniform bool sectionPlaneActive" + i + ";");
70248
70333
  src.push("uniform vec3 sectionPlanePos" + i + ";");
70249
70334
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -70262,7 +70347,7 @@ class PointsBatchingOcclusionRenderer extends VBOSceneModelPointBatchingRenderer
70262
70347
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
70263
70348
  src.push(" if (clippable) {");
70264
70349
  src.push(" float dist = 0.0;");
70265
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
70350
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
70266
70351
  src.push(" if (sectionPlaneActive" + i + ") {");
70267
70352
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
70268
70353
  src.push(" }");
@@ -71165,7 +71250,7 @@ class PointsInstancingColorRenderer extends VBOSceneModelPointInstancingRenderer
71165
71250
  _buildVertexShader() {
71166
71251
  const scene = this._scene;
71167
71252
  const sectionPlanesState = scene._sectionPlanesState;
71168
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71253
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71169
71254
  const pointsMaterial = scene.pointsMaterial._state;
71170
71255
  const src = [];
71171
71256
  src.push('#version 300 es');
@@ -71265,7 +71350,7 @@ class PointsInstancingColorRenderer extends VBOSceneModelPointInstancingRenderer
71265
71350
  _buildFragmentShader() {
71266
71351
  const scene = this._scene;
71267
71352
  const sectionPlanesState = scene._sectionPlanesState;
71268
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71353
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71269
71354
  const src = [];
71270
71355
  src.push('#version 300 es');
71271
71356
  src.push("// Points instancing color fragment shader");
@@ -71284,7 +71369,7 @@ class PointsInstancingColorRenderer extends VBOSceneModelPointInstancingRenderer
71284
71369
  if (clipping) {
71285
71370
  src.push("in vec4 vWorldPosition;");
71286
71371
  src.push("in float vFlags;");
71287
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
71372
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
71288
71373
  src.push("uniform bool sectionPlaneActive" + i + ";");
71289
71374
  src.push("uniform vec3 sectionPlanePos" + i + ";");
71290
71375
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -71304,7 +71389,7 @@ class PointsInstancingColorRenderer extends VBOSceneModelPointInstancingRenderer
71304
71389
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
71305
71390
  src.push(" if (clippable) {");
71306
71391
  src.push(" float dist = 0.0;");
71307
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
71392
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
71308
71393
  src.push("if (sectionPlaneActive" + i + ") {");
71309
71394
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
71310
71395
  src.push("}");
@@ -71337,7 +71422,7 @@ class PointsInstancingSilhouetteRenderer extends VBOSceneModelPointInstancingRen
71337
71422
 
71338
71423
  const scene = this._scene;
71339
71424
  const sectionPlanesState = scene._sectionPlanesState;
71340
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71425
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71341
71426
  const pointsMaterial = scene.pointsMaterial._state;
71342
71427
  const src = [];
71343
71428
  src.push ('#version 300 es');
@@ -71419,7 +71504,7 @@ class PointsInstancingSilhouetteRenderer extends VBOSceneModelPointInstancingRen
71419
71504
  _buildFragmentShader() {
71420
71505
  const scene = this._scene;
71421
71506
  const sectionPlanesState = scene._sectionPlanesState;
71422
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71507
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71423
71508
  const src = [];
71424
71509
  src.push ('#version 300 es');
71425
71510
  src.push("// Points instancing silhouette fragment shader");
@@ -71437,7 +71522,7 @@ class PointsInstancingSilhouetteRenderer extends VBOSceneModelPointInstancingRen
71437
71522
  if (clipping) {
71438
71523
  src.push("in vec4 vWorldPosition;");
71439
71524
  src.push("in float vFlags;");
71440
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
71525
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
71441
71526
  src.push("uniform bool sectionPlaneActive" + i + ";");
71442
71527
  src.push("uniform vec3 sectionPlanePos" + i + ";");
71443
71528
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -71457,7 +71542,7 @@ class PointsInstancingSilhouetteRenderer extends VBOSceneModelPointInstancingRen
71457
71542
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
71458
71543
  src.push(" if (clippable) {");
71459
71544
  src.push(" float dist = 0.0;");
71460
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
71545
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
71461
71546
  src.push("if (sectionPlaneActive" + i + ") {");
71462
71547
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
71463
71548
  src.push("}");
@@ -71485,7 +71570,7 @@ class PointsInstancingPickMeshRenderer extends VBOSceneModelPointInstancingRende
71485
71570
  _buildVertexShader() {
71486
71571
  const scene = this._scene;
71487
71572
  const sectionPlanesState = scene._sectionPlanesState;
71488
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71573
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71489
71574
  const pointsMaterial = scene.pointsMaterial._state;
71490
71575
  const src = [];
71491
71576
  src.push ('#version 300 es');
@@ -71568,7 +71653,7 @@ class PointsInstancingPickMeshRenderer extends VBOSceneModelPointInstancingRende
71568
71653
  _buildFragmentShader() {
71569
71654
  const scene = this._scene;
71570
71655
  const sectionPlanesState = scene._sectionPlanesState;
71571
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71656
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71572
71657
  const src = [];
71573
71658
  src.push ('#version 300 es');
71574
71659
  src.push("// Points instancing pick mesh fragment shader");
@@ -71586,7 +71671,7 @@ class PointsInstancingPickMeshRenderer extends VBOSceneModelPointInstancingRende
71586
71671
  if (clipping) {
71587
71672
  src.push("in vec4 vWorldPosition;");
71588
71673
  src.push("in float vFlags;");
71589
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
71674
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
71590
71675
  src.push("uniform bool sectionPlaneActive" + i + ";");
71591
71676
  src.push("uniform vec3 sectionPlanePos" + i + ";");
71592
71677
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -71608,7 +71693,7 @@ class PointsInstancingPickMeshRenderer extends VBOSceneModelPointInstancingRende
71608
71693
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
71609
71694
  src.push(" if (clippable) {");
71610
71695
  src.push(" float dist = 0.0;");
71611
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
71696
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
71612
71697
  src.push("if (sectionPlaneActive" + i + ") {");
71613
71698
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
71614
71699
  src.push("}");
@@ -71636,7 +71721,7 @@ class PointsInstancingPickDepthRenderer extends VBOSceneModelPointInstancingRend
71636
71721
  _buildVertexShader() {
71637
71722
  const scene = this._scene;
71638
71723
  const sectionPlanesState = scene._sectionPlanesState;
71639
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71724
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71640
71725
  const pointsMaterial = scene.pointsMaterial._state;
71641
71726
  const src = [];
71642
71727
 
@@ -71721,7 +71806,7 @@ class PointsInstancingPickDepthRenderer extends VBOSceneModelPointInstancingRend
71721
71806
  _buildFragmentShader() {
71722
71807
  const scene = this._scene;
71723
71808
  const sectionPlanesState = scene._sectionPlanesState;
71724
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71809
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71725
71810
  const src = [];
71726
71811
  src.push ('#version 300 es');
71727
71812
  src.push("// Points instancing pick depth fragment shader");
@@ -71745,7 +71830,7 @@ class PointsInstancingPickDepthRenderer extends VBOSceneModelPointInstancingRend
71745
71830
  if (clipping) {
71746
71831
  src.push("in vec4 vWorldPosition;");
71747
71832
  src.push("in float vFlags;");
71748
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
71833
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
71749
71834
  src.push("uniform bool sectionPlaneActive" + i + ";");
71750
71835
  src.push("uniform vec3 sectionPlanePos" + i + ";");
71751
71836
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -71774,7 +71859,7 @@ class PointsInstancingPickDepthRenderer extends VBOSceneModelPointInstancingRend
71774
71859
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
71775
71860
  src.push(" if (clippable) {");
71776
71861
  src.push(" float dist = 0.0;");
71777
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
71862
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
71778
71863
  src.push("if (sectionPlaneActive" + i + ") {");
71779
71864
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
71780
71865
  src.push("}");
@@ -71804,7 +71889,7 @@ class PointsInstancingOcclusionRenderer extends VBOSceneModelPointInstancingRend
71804
71889
 
71805
71890
  const scene = this._scene;
71806
71891
  const sectionPlanesState = scene._sectionPlanesState;
71807
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71892
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71808
71893
  const pointsMaterial = scene.pointsMaterial._state;
71809
71894
  const src = [];
71810
71895
 
@@ -71886,7 +71971,7 @@ class PointsInstancingOcclusionRenderer extends VBOSceneModelPointInstancingRend
71886
71971
  _buildFragmentShader() {
71887
71972
  const scene = this._scene;
71888
71973
  const sectionPlanesState = scene._sectionPlanesState;
71889
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71974
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71890
71975
  const src = [];
71891
71976
  src.push ('#version 300 es');
71892
71977
  src.push("// Points instancing occlusion vertex shader");
@@ -71904,7 +71989,7 @@ class PointsInstancingOcclusionRenderer extends VBOSceneModelPointInstancingRend
71904
71989
  if (clipping) {
71905
71990
  src.push("in vec4 vWorldPosition;");
71906
71991
  src.push("in float vFlags;");
71907
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
71992
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
71908
71993
  src.push("uniform bool sectionPlaneActive" + i + ";");
71909
71994
  src.push("uniform vec3 sectionPlanePos" + i + ";");
71910
71995
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -71923,7 +72008,7 @@ class PointsInstancingOcclusionRenderer extends VBOSceneModelPointInstancingRend
71923
72008
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
71924
72009
  src.push(" if (clippable) {");
71925
72010
  src.push(" float dist = 0.0;");
71926
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
72011
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
71927
72012
  src.push("if (sectionPlaneActive" + i + ") {");
71928
72013
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
71929
72014
  src.push("}");
@@ -71951,7 +72036,7 @@ class PointsInstancingDepthRenderer extends VBOSceneModelPointInstancingRenderer
71951
72036
  _buildVertexShader() {
71952
72037
  const scene = this._scene;
71953
72038
  const sectionPlanesState = scene._sectionPlanesState;
71954
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
72039
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71955
72040
  const pointsMaterial = scene.pointsMaterial._state;
71956
72041
  const src = [];
71957
72042
  src.push('#version 300 es');
@@ -72024,7 +72109,7 @@ class PointsInstancingDepthRenderer extends VBOSceneModelPointInstancingRenderer
72024
72109
  const sectionPlanesState = scene._sectionPlanesState;
72025
72110
  let i;
72026
72111
  let len;
72027
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
72112
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
72028
72113
  const src = [];
72029
72114
  src.push('#version 300 es');
72030
72115
  src.push("// Points instancing depth vertex shader");
@@ -72042,7 +72127,7 @@ class PointsInstancingDepthRenderer extends VBOSceneModelPointInstancingRenderer
72042
72127
  if (clipping) {
72043
72128
  src.push("in vec4 vWorldPosition;");
72044
72129
  src.push("in float vFlags;");
72045
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
72130
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
72046
72131
  src.push("uniform bool sectionPlaneActive" + i + ";");
72047
72132
  src.push("uniform vec3 sectionPlanePos" + i + ";");
72048
72133
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -72076,7 +72161,7 @@ class PointsInstancingDepthRenderer extends VBOSceneModelPointInstancingRenderer
72076
72161
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
72077
72162
  src.push(" if (clippable) {");
72078
72163
  src.push(" float dist = 0.0;");
72079
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
72164
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
72080
72165
  src.push("if (sectionPlaneActive" + i + ") {");
72081
72166
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
72082
72167
  src.push("}");
@@ -72103,7 +72188,7 @@ class PointsInstancingShadowRenderer extends VBOSceneModelPointInstancingRendere
72103
72188
  _buildVertexShader() {
72104
72189
  const scene = this._scene;
72105
72190
  const sectionPlanesState = scene._sectionPlanesState;
72106
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
72191
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
72107
72192
  const src = [];
72108
72193
  src.push ('#version 300 es');
72109
72194
  src.push("// Instancing geometry shadow drawing vertex shader");
@@ -72154,7 +72239,7 @@ class PointsInstancingShadowRenderer extends VBOSceneModelPointInstancingRendere
72154
72239
  _buildFragmentShader() {
72155
72240
  const scene = this._scene;
72156
72241
  const sectionPlanesState = scene._sectionPlanesState;
72157
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
72242
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
72158
72243
  const src = [];
72159
72244
  src.push ('#version 300 es');
72160
72245
  src.push("// Instancing geometry depth drawing fragment shader");
@@ -72173,7 +72258,7 @@ class PointsInstancingShadowRenderer extends VBOSceneModelPointInstancingRendere
72173
72258
  if (clipping) {
72174
72259
  src.push("in vec4 vWorldPosition;");
72175
72260
  src.push("in float vFlags;");
72176
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
72261
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
72177
72262
  src.push("uniform bool sectionPlaneActive" + i + ";");
72178
72263
  src.push("uniform vec3 sectionPlanePos" + i + ";");
72179
72264
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -72194,7 +72279,7 @@ class PointsInstancingShadowRenderer extends VBOSceneModelPointInstancingRendere
72194
72279
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
72195
72280
  src.push(" if (clippable) {");
72196
72281
  src.push(" float dist = 0.0;");
72197
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
72282
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
72198
72283
  src.push("if (sectionPlaneActive" + i + ") {");
72199
72284
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
72200
72285
  src.push("}");
@@ -74651,7 +74736,7 @@ function doCheckResult(buckets, mesh) {
74651
74736
  const tempVec3a$k = math.vec3();
74652
74737
  const tempVec3b$g = math.vec3();
74653
74738
  const tempVec3c$e = math.vec3();
74654
- const tempVec3d$a = math.vec3();
74739
+ math.vec3();
74655
74740
 
74656
74741
  const tempVec4a$6 = math.vec4();
74657
74742
 
@@ -74750,25 +74835,30 @@ class TrianglesDataTextureColorRenderer {
74750
74835
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
74751
74836
  }
74752
74837
 
74838
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
74753
74839
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
74754
- if (numSectionPlanes > 0) {
74840
+ if (numAllocatedSectionPlanes > 0) {
74755
74841
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
74756
74842
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
74757
74843
  const renderFlags = model.renderFlags;
74758
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
74844
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
74759
74845
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
74760
74846
  if (sectionPlaneUniforms) {
74761
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
74762
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
74763
- if (active) {
74764
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
74765
- if (origin) {
74766
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3d$a);
74767
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
74768
- } else {
74769
- 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);
74770
74859
  }
74771
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
74860
+ } else {
74861
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
74772
74862
  }
74773
74863
  }
74774
74864
  }
@@ -74863,7 +74953,7 @@ class TrianglesDataTextureColorRenderer {
74863
74953
 
74864
74954
  this._uSectionPlanes = [];
74865
74955
 
74866
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
74956
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
74867
74957
  this._uSectionPlanes.push({
74868
74958
  active: program.getLocation("sectionPlaneActive" + i),
74869
74959
  pos: program.getLocation("sectionPlanePos" + i),
@@ -74953,7 +75043,7 @@ class TrianglesDataTextureColorRenderer {
74953
75043
  const scene = this._scene;
74954
75044
  const sectionPlanesState = scene._sectionPlanesState;
74955
75045
  const lightsState = scene._lightsState;
74956
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
75046
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
74957
75047
  let light;
74958
75048
  const src = [];
74959
75049
  src.push("#version 300 es");
@@ -75164,7 +75254,7 @@ class TrianglesDataTextureColorRenderer {
75164
75254
  _buildFragmentShader() {
75165
75255
  const scene = this._scene;
75166
75256
  const sectionPlanesState = scene._sectionPlanesState;
75167
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
75257
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
75168
75258
  const src = [];
75169
75259
  src.push('#version 300 es');
75170
75260
  src.push("// TrianglesDataTextureColorRenderer fragment shader");
@@ -75198,7 +75288,7 @@ class TrianglesDataTextureColorRenderer {
75198
75288
  if (clipping) {
75199
75289
  src.push("in vec4 vWorldPosition;");
75200
75290
  src.push("flat in uint vFlags2;");
75201
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
75291
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
75202
75292
  src.push("uniform bool sectionPlaneActive" + i + ";");
75203
75293
  src.push("uniform vec3 sectionPlanePos" + i + ";");
75204
75294
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -75212,7 +75302,7 @@ class TrianglesDataTextureColorRenderer {
75212
75302
  src.push(" bool clippable = vFlags2 > 0u;");
75213
75303
  src.push(" if (clippable) {");
75214
75304
  src.push(" float dist = 0.0;");
75215
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
75305
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
75216
75306
  src.push("if (sectionPlaneActive" + i + ") {");
75217
75307
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
75218
75308
  src.push("}");
@@ -75263,7 +75353,7 @@ const defaultColor$1 = new Float32Array([1, 1, 1]);
75263
75353
  const tempVec3a$j = math.vec3();
75264
75354
  const tempVec3b$f = math.vec3();
75265
75355
  const tempVec3c$d = math.vec3();
75266
- const tempVec3d$9 = math.vec3();
75356
+ math.vec3();
75267
75357
  const tempMat4a$b = math.mat4();
75268
75358
 
75269
75359
  /**
@@ -75378,25 +75468,30 @@ class TrianglesDataTextureSilhouetteRenderer {
75378
75468
  const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2);
75379
75469
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
75380
75470
  }
75471
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
75381
75472
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
75382
- if (numSectionPlanes > 0) {
75473
+ if (numAllocatedSectionPlanes > 0) {
75383
75474
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
75384
75475
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
75385
75476
  const renderFlags = model.renderFlags;
75386
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
75477
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
75387
75478
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
75388
75479
  if (sectionPlaneUniforms) {
75389
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
75390
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
75391
- if (active) {
75392
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
75393
- if (origin) {
75394
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3d$9);
75395
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
75396
- } else {
75397
- 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);
75398
75492
  }
75399
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
75493
+ } else {
75494
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
75400
75495
  }
75401
75496
  }
75402
75497
  }
@@ -75498,8 +75593,7 @@ class TrianglesDataTextureSilhouetteRenderer {
75498
75593
  _buildVertexShader() {
75499
75594
 
75500
75595
  const scene = this._scene;
75501
- const sectionPlanesState = scene._sectionPlanesState;
75502
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
75596
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
75503
75597
 
75504
75598
  const src = [];
75505
75599
  src.push("#version 300 es");
@@ -75653,8 +75747,7 @@ class TrianglesDataTextureSilhouetteRenderer {
75653
75747
 
75654
75748
  _buildFragmentShader() {
75655
75749
  const scene = this._scene;
75656
- const sectionPlanesState = scene._sectionPlanesState;
75657
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
75750
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
75658
75751
  const src = [];
75659
75752
  src.push('#version 300 es');
75660
75753
  src.push("// Triangles dataTexture draw fragment shader");
@@ -75673,7 +75766,7 @@ class TrianglesDataTextureSilhouetteRenderer {
75673
75766
  if (clipping) {
75674
75767
  src.push("in vec4 vWorldPosition;");
75675
75768
  src.push("flat in uint vFlags2;");
75676
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
75769
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
75677
75770
  src.push("uniform bool sectionPlaneActive" + i + ";");
75678
75771
  src.push("uniform vec3 sectionPlanePos" + i + ";");
75679
75772
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -75686,7 +75779,7 @@ class TrianglesDataTextureSilhouetteRenderer {
75686
75779
  src.push(" bool clippable = vFlags2 > 0u;");
75687
75780
  src.push(" if (clippable) {");
75688
75781
  src.push(" float dist = 0.0;");
75689
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
75782
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
75690
75783
  src.push("if (sectionPlaneActive" + i + ") {");
75691
75784
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
75692
75785
  src.push("}");
@@ -75720,7 +75813,7 @@ const defaultColor = new Float32Array([0, 0, 0, 1]);
75720
75813
 
75721
75814
  const tempVec3a$i = math.vec3();
75722
75815
  const tempVec3b$e = math.vec3();
75723
- const tempVec3d$8 = math.vec3();
75816
+ math.vec3();
75724
75817
  const tempMat4a$a = math.mat4();
75725
75818
 
75726
75819
  /**
@@ -75825,25 +75918,30 @@ class TrianglesDataTextureEdgesRenderer {
75825
75918
  gl.uniform4fv(this._uColor, defaultColor);
75826
75919
  }
75827
75920
 
75921
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
75828
75922
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
75829
- if (numSectionPlanes > 0) {
75923
+ if (numAllocatedSectionPlanes > 0) {
75830
75924
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
75831
75925
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
75832
75926
  const renderFlags = model.renderFlags;
75833
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
75927
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
75834
75928
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
75835
75929
  if (sectionPlaneUniforms) {
75836
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
75837
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
75838
- if (active) {
75839
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
75840
- if (origin) {
75841
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3d$8);
75842
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
75843
- } else {
75844
- 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);
75845
75942
  }
75846
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
75943
+ } else {
75944
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
75847
75945
  }
75848
75946
  }
75849
75947
  }
@@ -75940,8 +76038,7 @@ class TrianglesDataTextureEdgesRenderer {
75940
76038
 
75941
76039
  _buildVertexShader() {
75942
76040
  const scene = this._scene;
75943
- const sectionPlanesState = scene._sectionPlanesState;
75944
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
76041
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
75945
76042
  const src = [];
75946
76043
  src.push("#version 300 es");
75947
76044
  src.push("// Batched geometry edges drawing vertex shader");
@@ -76068,8 +76165,7 @@ class TrianglesDataTextureEdgesRenderer {
76068
76165
 
76069
76166
  _buildFragmentShader() {
76070
76167
  const scene = this._scene;
76071
- const sectionPlanesState = scene._sectionPlanesState;
76072
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
76168
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
76073
76169
  const src = [];
76074
76170
  src.push('#version 300 es');
76075
76171
  src.push("// Batched geometry edges drawing fragment shader");
@@ -76091,7 +76187,7 @@ class TrianglesDataTextureEdgesRenderer {
76091
76187
  if (clipping) {
76092
76188
  src.push("in vec4 vWorldPosition;");
76093
76189
  src.push("flat in uint vFlags2;");
76094
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
76190
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
76095
76191
  src.push("uniform bool sectionPlaneActive" + i + ";");
76096
76192
  src.push("uniform vec3 sectionPlanePos" + i + ";");
76097
76193
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -76104,7 +76200,7 @@ class TrianglesDataTextureEdgesRenderer {
76104
76200
  src.push(" bool clippable = vFlags2 > 0u;");
76105
76201
  src.push(" if (clippable) {");
76106
76202
  src.push(" float dist = 0.0;");
76107
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
76203
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
76108
76204
  src.push("if (sectionPlaneActive" + i + ") {");
76109
76205
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
76110
76206
  src.push("}");
@@ -76296,7 +76392,7 @@ class TrianglesDataTextureEdgesColorRenderer {
76296
76392
  this._uProjMatrix = program.getLocation("projMatrix");
76297
76393
  this._uSectionPlanes = [];
76298
76394
 
76299
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
76395
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
76300
76396
  this._uSectionPlanes.push({
76301
76397
  active: program.getLocation("sectionPlaneActive" + i),
76302
76398
  pos: program.getLocation("sectionPlanePos" + i),
@@ -76342,8 +76438,7 @@ class TrianglesDataTextureEdgesColorRenderer {
76342
76438
 
76343
76439
  _buildVertexShader() {
76344
76440
  const scene = this._scene;
76345
- const sectionPlanesState = scene._sectionPlanesState;
76346
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
76441
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
76347
76442
  const src = [];
76348
76443
  src.push("#version 300 es");
76349
76444
  src.push("// TrianglesDataTextureEdgesColorRenderer");
@@ -76478,8 +76573,7 @@ class TrianglesDataTextureEdgesColorRenderer {
76478
76573
 
76479
76574
  _buildFragmentShader() {
76480
76575
  const scene = this._scene;
76481
- const sectionPlanesState = scene._sectionPlanesState;
76482
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
76576
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
76483
76577
  const src = [];
76484
76578
  src.push('#version 300 es');
76485
76579
  src.push("// TrianglesDataTextureEdgesColorRenderer");
@@ -76498,7 +76592,7 @@ class TrianglesDataTextureEdgesColorRenderer {
76498
76592
  if (clipping) {
76499
76593
  src.push("in vec4 vWorldPosition;");
76500
76594
  src.push("flat in uint vFlags2;");
76501
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
76595
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
76502
76596
  src.push("uniform bool sectionPlaneActive" + i + ";");
76503
76597
  src.push("uniform vec3 sectionPlanePos" + i + ";");
76504
76598
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -76511,7 +76605,7 @@ class TrianglesDataTextureEdgesColorRenderer {
76511
76605
  src.push(" bool clippable = vFlags2 > 0u;");
76512
76606
  src.push(" if (clippable) {");
76513
76607
  src.push(" float dist = 0.0;");
76514
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
76608
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
76515
76609
  src.push("if (sectionPlaneActive" + i + ") {");
76516
76610
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
76517
76611
  src.push("}");
@@ -76520,8 +76614,7 @@ class TrianglesDataTextureEdgesColorRenderer {
76520
76614
  src.push("}");
76521
76615
  }
76522
76616
  if (scene.logarithmicDepthBufferEnabled) {
76523
- // src.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;");
76524
- 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;");
76525
76618
  }
76526
76619
  src.push(" outColor = vColor;");
76527
76620
  src.push("}");
@@ -76629,25 +76722,30 @@ class TrianglesDataTexturePickMeshRenderer {
76629
76722
  const logDepthBufFC = 2.0 / (Math.log(camera.project.far + 1.0) / Math.LN2); // TODO: Far from pick project matrix?
76630
76723
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
76631
76724
  }
76725
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
76632
76726
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
76633
- if (numSectionPlanes > 0) {
76727
+ if (numAllocatedSectionPlanes > 0) {
76634
76728
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
76635
76729
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
76636
76730
  const renderFlags = model.renderFlags;
76637
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
76731
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
76638
76732
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
76639
76733
  if (sectionPlaneUniforms) {
76640
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
76641
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
76642
- if (active) {
76643
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
76644
- if (origin) {
76645
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$g);
76646
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
76647
- } else {
76648
- 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);
76649
76746
  }
76650
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
76747
+ } else {
76748
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
76651
76749
  }
76652
76750
  }
76653
76751
  }
@@ -76655,8 +76753,8 @@ class TrianglesDataTexturePickMeshRenderer {
76655
76753
  if (state.numIndices8Bits > 0) {
76656
76754
  textureState.bindTriangleIndicesTextures(
76657
76755
  this._program,
76658
- this._uTexturePerPolygonIdPortionIds,
76659
- this._uTexturePerPolygonIdIndices,
76756
+ this._uTexturePerPolygonIdPortionIds,
76757
+ this._uTexturePerPolygonIdIndices,
76660
76758
  8 // 8 bits indices
76661
76759
  );
76662
76760
  gl.drawArrays(gl.TRIANGLES, 0, state.numIndices8Bits);
@@ -76664,8 +76762,8 @@ class TrianglesDataTexturePickMeshRenderer {
76664
76762
  if (state.numIndices16Bits > 0) {
76665
76763
  textureState.bindTriangleIndicesTextures(
76666
76764
  this._program,
76667
- this._uTexturePerPolygonIdPortionIds,
76668
- this._uTexturePerPolygonIdIndices,
76765
+ this._uTexturePerPolygonIdPortionIds,
76766
+ this._uTexturePerPolygonIdIndices,
76669
76767
  16 // 16 bits indices
76670
76768
  );
76671
76769
  gl.drawArrays(gl.TRIANGLES, 0, state.numIndices16Bits);
@@ -76673,8 +76771,8 @@ class TrianglesDataTexturePickMeshRenderer {
76673
76771
  if (state.numIndices32Bits > 0) {
76674
76772
  textureState.bindTriangleIndicesTextures(
76675
76773
  this._program,
76676
- this._uTexturePerPolygonIdPortionIds,
76677
- this._uTexturePerPolygonIdIndices,
76774
+ this._uTexturePerPolygonIdPortionIds,
76775
+ this._uTexturePerPolygonIdIndices,
76678
76776
  32 // 32 bits indices
76679
76777
  );
76680
76778
  gl.drawArrays(gl.TRIANGLES, 0, state.numIndices32Bits);
@@ -76709,14 +76807,14 @@ class TrianglesDataTexturePickMeshRenderer {
76709
76807
  if (scene.logarithmicDepthBufferEnabled) {
76710
76808
  this._uLogDepthBufFC = program.getLocation("logDepthBufFC");
76711
76809
  }
76712
- this.uTexturePerObjectPositionsDecodeMatrix = "uObjectPerObjectPositionsDecodeMatrix";
76713
- this.uTexturePerObjectColorsAndFlags = "uObjectPerObjectColorsAndFlags";
76714
- this._uTexturePerVertexIdCoordinates = "uTexturePerVertexIdCoordinates";
76715
- this._uTexturePerPolygonIdNormals = "uTexturePerPolygonIdNormals";
76716
- this._uTexturePerPolygonIdIndices = "uTexturePerPolygonIdIndices";
76810
+ this.uTexturePerObjectPositionsDecodeMatrix = "uObjectPerObjectPositionsDecodeMatrix";
76811
+ this.uTexturePerObjectColorsAndFlags = "uObjectPerObjectColorsAndFlags";
76812
+ this._uTexturePerVertexIdCoordinates = "uTexturePerVertexIdCoordinates";
76813
+ this._uTexturePerPolygonIdNormals = "uTexturePerPolygonIdNormals";
76814
+ this._uTexturePerPolygonIdIndices = "uTexturePerPolygonIdIndices";
76717
76815
  this._uTexturePerPolygonIdPortionIds = "uTexturePerPolygonIdPortionIds";
76718
- this._uTexturePerObjectMatrix= "uTexturePerObjectMatrix";
76719
- this._uCameraEyeRtc = program.getLocation("uCameraEyeRtc");
76816
+ this._uTexturePerObjectMatrix = "uTexturePerObjectMatrix";
76817
+ this._uCameraEyeRtc = program.getLocation("uCameraEyeRtc");
76720
76818
  }
76721
76819
 
76722
76820
  _bindProgram(frameCtx) {
@@ -76735,7 +76833,7 @@ class TrianglesDataTexturePickMeshRenderer {
76735
76833
 
76736
76834
  _buildVertexShader() {
76737
76835
  const scene = this._scene;
76738
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
76836
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
76739
76837
  const src = [];
76740
76838
  src.push("#version 300 es");
76741
76839
  src.push("// Batched geometry picking vertex shader");
@@ -76770,10 +76868,10 @@ class TrianglesDataTexturePickMeshRenderer {
76770
76868
  src.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;");
76771
76869
  src.push("uniform highp sampler2D uTexturePerObjectMatrix;");
76772
76870
  src.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;");
76773
- src.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;");
76774
- src.push("uniform highp usampler2D uTexturePerPolygonIdIndices;");
76871
+ src.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;");
76872
+ src.push("uniform highp usampler2D uTexturePerPolygonIdIndices;");
76775
76873
  src.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;");
76776
- src.push("uniform vec3 uCameraEyeRtc;");
76874
+ src.push("uniform vec3 uCameraEyeRtc;");
76777
76875
 
76778
76876
  src.push("vec3 positions[3];");
76779
76877
 
@@ -76816,9 +76914,9 @@ class TrianglesDataTexturePickMeshRenderer {
76816
76914
  src.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);");
76817
76915
 
76818
76916
  // get flags & flags2
76819
- src.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);");
76820
- src.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);");
76821
-
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
+
76822
76920
  // flags.w = NOT_RENDERED | PICK
76823
76921
  // renderPass = PICK
76824
76922
 
@@ -76828,9 +76926,9 @@ class TrianglesDataTexturePickMeshRenderer {
76828
76926
  src.push("} else {");
76829
76927
 
76830
76928
  // get vertex base
76831
- 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));");
76832
76930
 
76833
- 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));");
76834
76932
 
76835
76933
  src.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;");
76836
76934
 
@@ -76839,7 +76937,7 @@ class TrianglesDataTexturePickMeshRenderer {
76839
76937
 
76840
76938
  src.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));");
76841
76939
  src.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;");
76842
-
76940
+
76843
76941
  src.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;");
76844
76942
  src.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;");
76845
76943
 
@@ -76847,7 +76945,7 @@ class TrianglesDataTexturePickMeshRenderer {
76847
76945
 
76848
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));");
76849
76947
 
76850
- 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;");
76851
76949
 
76852
76950
  // get position
76853
76951
  src.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));");
@@ -76855,7 +76953,7 @@ class TrianglesDataTexturePickMeshRenderer {
76855
76953
  src.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));");
76856
76954
 
76857
76955
  // get color
76858
- 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);");
76859
76957
 
76860
76958
  src.push(`if (color.a == 0u) {`);
76861
76959
  src.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"); // Cull vertex
@@ -76873,17 +76971,17 @@ class TrianglesDataTexturePickMeshRenderer {
76873
76971
 
76874
76972
  // when the geometry is not solid, if needed, flip the triangle winding
76875
76973
  src.push("if (solid != 1u) {");
76876
- src.push("if (isPerspectiveMatrix(projMatrix)) {");
76877
- src.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;");
76878
- src.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {");
76879
- src.push("position = positions[2 - (gl_VertexID % 3)];");
76880
- src.push("}");
76881
- src.push("} else {");
76882
- src.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);");
76883
- src.push("if (viewNormal.z < 0.0) {");
76884
- src.push("position = positions[2 - (gl_VertexID % 3)];");
76885
- src.push("}");
76886
- 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("}");
76887
76985
  src.push("}");
76888
76986
 
76889
76987
  src.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); ");
@@ -76907,10 +77005,9 @@ class TrianglesDataTexturePickMeshRenderer {
76907
77005
 
76908
77006
  _buildFragmentShader() {
76909
77007
  const scene = this._scene;
76910
- const sectionPlanesState = scene._sectionPlanesState;
76911
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
77008
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
76912
77009
  const src = [];
76913
- src.push ('#version 300 es');
77010
+ src.push('#version 300 es');
76914
77011
  src.push("// Batched geometry picking fragment shader");
76915
77012
  src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");
76916
77013
  src.push("precision highp float;");
@@ -76927,7 +77024,7 @@ class TrianglesDataTexturePickMeshRenderer {
76927
77024
  if (clipping) {
76928
77025
  src.push("in vec4 vWorldPosition;");
76929
77026
  src.push("flat in uvec4 vFlags2;");
76930
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
77027
+ for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
76931
77028
  src.push("uniform bool sectionPlaneActive" + i + ";");
76932
77029
  src.push("uniform vec3 sectionPlanePos" + i + ";");
76933
77030
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -76940,7 +77037,7 @@ class TrianglesDataTexturePickMeshRenderer {
76940
77037
  src.push(" bool clippable = (float(vFlags2.x) > 0.0);");
76941
77038
  src.push(" if (clippable) {");
76942
77039
  src.push(" float dist = 0.0;");
76943
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
77040
+ for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
76944
77041
  src.push(" if (sectionPlaneActive" + i + ") {");
76945
77042
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
76946
77043
  src.push(" }");
@@ -76949,7 +77046,7 @@ class TrianglesDataTexturePickMeshRenderer {
76949
77046
  src.push(" }");
76950
77047
  }
76951
77048
  if (scene.logarithmicDepthBufferEnabled) {
76952
- 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;");
76953
77050
  //src.push(" gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;");
76954
77051
  }
76955
77052
  src.push(" outPickColor = vPickColor; ");
@@ -76972,7 +77069,7 @@ class TrianglesDataTexturePickMeshRenderer {
76972
77069
  const tempVec3a$f = math.vec3();
76973
77070
  const tempVec3b$b = math.vec3();
76974
77071
  const tempVec3c$a = math.vec3();
76975
- const tempVec3d$7 = math.vec3();
77072
+ math.vec3();
76976
77073
  const tempMat4a$7 = math.mat4();
76977
77074
 
76978
77075
  /**
@@ -77073,25 +77170,30 @@ class TrianglesDataTexturePickDepthRenderer {
77073
77170
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
77074
77171
  }
77075
77172
 
77173
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
77076
77174
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
77077
- if (numSectionPlanes > 0) {
77175
+ if (numAllocatedSectionPlanes > 0) {
77078
77176
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
77079
77177
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
77080
77178
  const renderFlags = model.renderFlags;
77081
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
77179
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
77082
77180
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
77083
77181
  if (sectionPlaneUniforms) {
77084
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
77085
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
77086
- if (active) {
77087
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
77088
- if (origin) {
77089
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3d$7);
77090
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
77091
- } else {
77092
- 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);
77093
77194
  }
77094
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
77195
+ } else {
77196
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
77095
77197
  }
77096
77198
  }
77097
77199
  }
@@ -77143,7 +77245,7 @@ class TrianglesDataTexturePickDepthRenderer {
77143
77245
  this._uViewMatrix = program.getLocation("viewMatrix");
77144
77246
  this._uProjMatrix = program.getLocation("projMatrix");
77145
77247
  this._uSectionPlanes = [];
77146
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
77248
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
77147
77249
  this._uSectionPlanes.push({
77148
77250
  active: program.getLocation("sectionPlaneActive" + i),
77149
77251
  pos: program.getLocation("sectionPlanePos" + i),
@@ -77179,7 +77281,7 @@ class TrianglesDataTexturePickDepthRenderer {
77179
77281
  _buildVertexShader() {
77180
77282
 
77181
77283
  const scene = this._scene;
77182
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
77284
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
77183
77285
  const src = [];
77184
77286
  src.push("#version 300 es");
77185
77287
  src.push("// Triangles dataTexture pick depth vertex shader");
@@ -77347,8 +77449,7 @@ class TrianglesDataTexturePickDepthRenderer {
77347
77449
  _buildFragmentShader() {
77348
77450
 
77349
77451
  const scene = this._scene;
77350
- const sectionPlanesState = scene._sectionPlanesState;
77351
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
77452
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
77352
77453
  const src = [];
77353
77454
  src.push('#version 300 es');
77354
77455
  src.push("// Triangles dataTexture pick depth fragment shader");
@@ -77373,7 +77474,7 @@ class TrianglesDataTexturePickDepthRenderer {
77373
77474
  if (clipping) {
77374
77475
  src.push("in vec4 vWorldPosition;");
77375
77476
  src.push("flat in uint vFlags2;");
77376
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
77477
+ for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
77377
77478
  src.push("uniform bool sectionPlaneActive" + i + ";");
77378
77479
  src.push("uniform vec3 sectionPlanePos" + i + ";");
77379
77480
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -77394,7 +77495,7 @@ class TrianglesDataTexturePickDepthRenderer {
77394
77495
  src.push(" bool clippable = vFlags2 > 0u;");
77395
77496
  src.push(" if (clippable) {");
77396
77497
  src.push(" float dist = 0.0;");
77397
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
77498
+ for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
77398
77499
  src.push(" if (sectionPlaneActive" + i + ") {");
77399
77500
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
77400
77501
  src.push(" }");
@@ -77426,8 +77527,8 @@ class TrianglesDataTexturePickDepthRenderer {
77426
77527
  const tempVec3a$e = math.vec3();
77427
77528
  const tempVec3b$a = math.vec3();
77428
77529
  const tempVec3c$9 = math.vec3();
77429
- const tempVec3d$6 = math.vec3();
77430
- const tempVec3e$1 = math.vec3();
77530
+ const tempVec3d$2 = math.vec3();
77531
+ math.vec3();
77431
77532
  const tempMat4a$6 = math.mat4();
77432
77533
 
77433
77534
  /**
@@ -77512,7 +77613,7 @@ class TrianglesDataTextureSnapDepthRenderer {
77512
77613
  rtcOrigin[1] += position[1];
77513
77614
  rtcOrigin[2] += position[2];
77514
77615
  rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a$6);
77515
- rtcCameraEye = tempVec3d$6;
77616
+ rtcCameraEye = tempVec3d$2;
77516
77617
  rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];
77517
77618
  rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];
77518
77619
  rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];
@@ -77541,25 +77642,30 @@ class TrianglesDataTextureSnapDepthRenderer {
77541
77642
  const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2);
77542
77643
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
77543
77644
  }
77645
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
77544
77646
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
77545
- if (numSectionPlanes > 0) {
77647
+ if (numAllocatedSectionPlanes > 0) {
77546
77648
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
77547
77649
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
77548
77650
  const renderFlags = model.renderFlags;
77549
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
77651
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
77550
77652
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
77551
77653
  if (sectionPlaneUniforms) {
77552
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
77553
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
77554
- if (active) {
77555
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
77556
- if (origin) {
77557
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3e$1);
77558
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
77559
- } else {
77560
- 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);
77561
77666
  }
77562
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
77667
+ } else {
77668
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
77563
77669
  }
77564
77670
  }
77565
77671
  }
@@ -77647,8 +77753,7 @@ class TrianglesDataTextureSnapDepthRenderer {
77647
77753
 
77648
77754
  _buildVertexShader() {
77649
77755
  const scene = this._scene;
77650
- const sectionPlanesState = scene._sectionPlanesState;
77651
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
77756
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
77652
77757
  const src = [];
77653
77758
  src.push("#version 300 es");
77654
77759
  src.push("// Batched geometry edges drawing vertex shader");
@@ -77779,8 +77884,7 @@ class TrianglesDataTextureSnapDepthRenderer {
77779
77884
  _buildFragmentShader() {
77780
77885
 
77781
77886
  const scene = this._scene;
77782
- const sectionPlanesState = scene._sectionPlanesState;
77783
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
77887
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
77784
77888
  const src = [];
77785
77889
  src.push('#version 300 es');
77786
77890
  src.push("// Triangles dataTexture pick depth fragment shader");
@@ -77801,7 +77905,7 @@ class TrianglesDataTextureSnapDepthRenderer {
77801
77905
  if (clipping) {
77802
77906
  src.push("in vec4 vWorldPosition;");
77803
77907
  src.push("flat in uint vFlags2;");
77804
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
77908
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
77805
77909
  src.push("uniform bool sectionPlaneActive" + i + ";");
77806
77910
  src.push("uniform vec3 sectionPlanePos" + i + ";");
77807
77911
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -77814,7 +77918,7 @@ class TrianglesDataTextureSnapDepthRenderer {
77814
77918
  src.push(" bool clippable = vFlags2 > 0u;");
77815
77919
  src.push(" if (clippable) {");
77816
77920
  src.push(" float dist = 0.0;");
77817
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
77921
+ for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
77818
77922
  src.push(" if (sectionPlaneActive" + i + ") {");
77819
77923
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
77820
77924
  src.push(" }");
@@ -77845,8 +77949,8 @@ class TrianglesDataTextureSnapDepthRenderer {
77845
77949
  const tempVec3a$d = math.vec3();
77846
77950
  const tempVec3b$9 = math.vec3();
77847
77951
  const tempVec3c$8 = math.vec3();
77848
- const tempVec3d$5 = math.vec3();
77849
- const tempVec3e = math.vec3();
77952
+ const tempVec3d$1 = math.vec3();
77953
+ math.vec3();
77850
77954
  const tempMat4a$5 = math.mat4();
77851
77955
  /**
77852
77956
  * @private
@@ -77926,7 +78030,7 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
77926
78030
  rtcOrigin[1] += position[1];
77927
78031
  rtcOrigin[2] += position[2];
77928
78032
  rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a$5);
77929
- rtcCameraEye = tempVec3d$5;
78033
+ rtcCameraEye = tempVec3d$1;
77930
78034
  rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];
77931
78035
  rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];
77932
78036
  rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];
@@ -77955,25 +78059,30 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
77955
78059
  const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2);
77956
78060
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
77957
78061
  }
78062
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
77958
78063
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
77959
- if (numSectionPlanes > 0) {
78064
+ if (numAllocatedSectionPlanes > 0) {
77960
78065
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
77961
78066
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
77962
78067
  const renderFlags = model.renderFlags;
77963
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
78068
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
77964
78069
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
77965
78070
  if (sectionPlaneUniforms) {
77966
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
77967
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
77968
- if (active) {
77969
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
77970
- if (origin) {
77971
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3e);
77972
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
77973
- } else {
77974
- 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);
77975
78083
  }
77976
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
78084
+ } else {
78085
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
77977
78086
  }
77978
78087
  }
77979
78088
  }
@@ -78059,8 +78168,7 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
78059
78168
 
78060
78169
  _buildVertexShader() {
78061
78170
  const scene = this._scene;
78062
- const sectionPlanesState = scene._sectionPlanesState;
78063
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
78171
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
78064
78172
  const src = [];
78065
78173
  src.push("#version 300 es");
78066
78174
  src.push("// TrianglesDataTextureSnapDepthBufInitRenderer vertex shader");
@@ -78222,8 +78330,7 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
78222
78330
 
78223
78331
  _buildFragmentShader() {
78224
78332
  const scene = this._scene;
78225
- const sectionPlanesState = scene._sectionPlanesState;
78226
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
78333
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
78227
78334
  const src = [];
78228
78335
  src.push('#version 300 es');
78229
78336
  src.push("// TrianglesDataTextureSnapDepthBufInitRenderer fragment shader");
@@ -78245,7 +78352,7 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
78245
78352
  src.push("flat in vec4 vPickColor;");
78246
78353
  if (clipping) {
78247
78354
  src.push("flat in uint vFlags2;");
78248
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
78355
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
78249
78356
  src.push("uniform bool sectionPlaneActive" + i + ";");
78250
78357
  src.push("uniform vec3 sectionPlanePos" + i + ";");
78251
78358
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -78260,7 +78367,7 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
78260
78367
  src.push(" bool clippable = vFlags2 > 0u;");
78261
78368
  src.push(" if (clippable) {");
78262
78369
  src.push(" float dist = 0.0;");
78263
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
78370
+ for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
78264
78371
  src.push(" if (sectionPlaneActive" + i + ") {");
78265
78372
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
78266
78373
  src.push(" }");
@@ -78300,7 +78407,7 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
78300
78407
  const tempVec3a$c = math.vec3();
78301
78408
  const tempVec3b$8 = math.vec3();
78302
78409
  const tempVec3c$7 = math.vec3();
78303
- const tempVec3d$4 = math.vec3();
78410
+ math.vec3();
78304
78411
  const tempMat4a$4 = math.mat4();
78305
78412
 
78306
78413
  /**
@@ -78390,25 +78497,30 @@ class TrianglesDataTextureOcclusionRenderer {
78390
78497
 
78391
78498
  gl.uniformMatrix4fv(this._uProjMatrix, false, camera.projMatrix);
78392
78499
 
78500
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
78393
78501
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
78394
- if (numSectionPlanes > 0) {
78502
+ if (numAllocatedSectionPlanes > 0) {
78395
78503
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
78396
78504
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
78397
78505
  const renderFlags = model.renderFlags;
78398
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
78506
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
78399
78507
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
78400
78508
  if (sectionPlaneUniforms) {
78401
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
78402
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
78403
- if (active) {
78404
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
78405
- if (origin) {
78406
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3d$4);
78407
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
78408
- } else {
78409
- 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);
78410
78521
  }
78411
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
78522
+ } else {
78523
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
78412
78524
  }
78413
78525
  }
78414
78526
  }
@@ -78459,7 +78571,7 @@ class TrianglesDataTextureOcclusionRenderer {
78459
78571
  this._uViewMatrix = program.getLocation("viewMatrix");
78460
78572
  this._uProjMatrix = program.getLocation("projMatrix");
78461
78573
  this._uSectionPlanes = [];
78462
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
78574
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
78463
78575
  this._uSectionPlanes.push({
78464
78576
  active: program.getLocation("sectionPlaneActive" + i),
78465
78577
  pos: program.getLocation("sectionPlanePos" + i),
@@ -78499,7 +78611,7 @@ class TrianglesDataTextureOcclusionRenderer {
78499
78611
 
78500
78612
  _buildVertexShader() {
78501
78613
  const scene = this._scene;
78502
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
78614
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
78503
78615
  const src = [];
78504
78616
  src.push("#version 300 es");
78505
78617
  src.push("// TrianglesDataTextureOcclusionRenderer vertex shader");
@@ -78640,7 +78752,7 @@ class TrianglesDataTextureOcclusionRenderer {
78640
78752
  _buildFragmentShader() {
78641
78753
  const scene = this._scene;
78642
78754
  const sectionPlanesState = scene._sectionPlanesState;
78643
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
78755
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
78644
78756
  const src = [];
78645
78757
  src.push('#version 300 es');
78646
78758
  src.push("// TrianglesDataTextureColorRenderer fragment shader");
@@ -78654,7 +78766,7 @@ class TrianglesDataTextureOcclusionRenderer {
78654
78766
  if (clipping) {
78655
78767
  src.push("in vec4 vWorldPosition;");
78656
78768
  src.push("flat in uint vFlags2;");
78657
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
78769
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
78658
78770
  src.push("uniform bool sectionPlaneActive" + i + ";");
78659
78771
  src.push("uniform vec3 sectionPlanePos" + i + ";");
78660
78772
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -78666,7 +78778,7 @@ class TrianglesDataTextureOcclusionRenderer {
78666
78778
  src.push(" bool clippable = (float(vFlags2) > 0.0);");
78667
78779
  src.push(" if (clippable) {");
78668
78780
  src.push(" float dist = 0.0;");
78669
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
78781
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
78670
78782
  src.push(" if (sectionPlaneActive" + i + ") {");
78671
78783
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
78672
78784
  src.push(" }");
@@ -78694,7 +78806,7 @@ class TrianglesDataTextureOcclusionRenderer {
78694
78806
  const tempVec3a$b = math.vec3();
78695
78807
  const tempVec3b$7 = math.vec3();
78696
78808
  const tempVec3c$6 = math.vec3();
78697
- const tempVec3d$3 = math.vec3();
78809
+ math.vec3();
78698
78810
  const tempMat4a$3 = math.mat4();
78699
78811
 
78700
78812
  /**
@@ -78788,25 +78900,30 @@ class TrianglesDataTextureDepthRenderer {
78788
78900
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
78789
78901
  }
78790
78902
 
78903
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
78791
78904
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
78792
- if (numSectionPlanes > 0) {
78905
+ if (numAllocatedSectionPlanes > 0) {
78793
78906
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
78794
78907
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
78795
78908
  const renderFlags = model.renderFlags;
78796
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
78909
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
78797
78910
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
78798
78911
  if (sectionPlaneUniforms) {
78799
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
78800
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
78801
- if (active) {
78802
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
78803
- if (origin) {
78804
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3d$3);
78805
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
78806
- } else {
78807
- 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);
78808
78924
  }
78809
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
78925
+ } else {
78926
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
78810
78927
  }
78811
78928
  }
78812
78929
  }
@@ -78917,9 +79034,7 @@ class TrianglesDataTextureDepthRenderer {
78917
79034
 
78918
79035
  _buildVertexShader() {
78919
79036
  const scene = this._scene;
78920
- const sectionPlanesState = scene._sectionPlanesState;
78921
- scene._lightsState;
78922
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
79037
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
78923
79038
  const src = [];
78924
79039
  src.push("#version 300 es");
78925
79040
  src.push("// Triangles dataTexture draw vertex shader");
@@ -79080,8 +79195,7 @@ class TrianglesDataTextureDepthRenderer {
79080
79195
 
79081
79196
  _buildFragmentShader() {
79082
79197
  const scene = this._scene;
79083
- const sectionPlanesState = scene._sectionPlanesState;
79084
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
79198
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
79085
79199
  const src = [];
79086
79200
  src.push('#version 300 es');
79087
79201
  src.push("// Triangles dataTexture draw fragment shader");
@@ -79104,7 +79218,7 @@ class TrianglesDataTextureDepthRenderer {
79104
79218
  if (clipping) {
79105
79219
  src.push("in vec4 vWorldPosition;");
79106
79220
  src.push("flat in uint vFlags2;");
79107
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
79221
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
79108
79222
  src.push("uniform bool sectionPlaneActive" + i + ";");
79109
79223
  src.push("uniform vec3 sectionPlanePos" + i + ";");
79110
79224
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -79116,7 +79230,7 @@ class TrianglesDataTextureDepthRenderer {
79116
79230
  src.push(" bool clippable = vFlags2 > 0u;");
79117
79231
  src.push(" if (clippable) {");
79118
79232
  src.push(" float dist = 0.0;");
79119
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
79233
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
79120
79234
  src.push("if (sectionPlaneActive" + i + ") {");
79121
79235
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
79122
79236
  src.push("}");
@@ -79152,7 +79266,7 @@ class TrianglesDataTextureDepthRenderer {
79152
79266
  const tempVec3a$a = math.vec3();
79153
79267
  const tempVec3b$6 = math.vec3();
79154
79268
  const tempVec3c$5 = math.vec3();
79155
- const tempVec3d$2 = math.vec3();
79269
+ math.vec3();
79156
79270
  const tempMat4a$2 = math.mat4();
79157
79271
 
79158
79272
  /**
@@ -79237,25 +79351,30 @@ class TrianglesDataTextureNormalsRenderer {
79237
79351
  gl.uniformMatrix4fv(this._uViewNormalMatrix, false, camera.viewNormalMatrix);
79238
79352
  gl.uniformMatrix4fv(this._uWorldNormalMatrix, false, model.worldNormalMatrix);
79239
79353
 
79354
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
79240
79355
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
79241
- if (numSectionPlanes > 0) {
79356
+ if (numAllocatedSectionPlanes > 0) {
79242
79357
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
79243
79358
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
79244
79359
  const renderFlags = model.renderFlags;
79245
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
79360
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
79246
79361
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
79247
79362
  if (sectionPlaneUniforms) {
79248
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
79249
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
79250
- if (active) {
79251
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
79252
- if (origin) {
79253
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3d$2);
79254
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
79255
- } else {
79256
- 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);
79257
79375
  }
79258
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
79376
+ } else {
79377
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
79259
79378
  }
79260
79379
  }
79261
79380
  }
@@ -79293,7 +79412,7 @@ class TrianglesDataTextureNormalsRenderer {
79293
79412
  this._uViewNormalMatrix = program.getLocation("viewNormalMatrix");
79294
79413
  this._uProjMatrix = program.getLocation("projMatrix");
79295
79414
  this._uSectionPlanes = [];
79296
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
79415
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
79297
79416
  this._uSectionPlanes.push({
79298
79417
  active: program.getLocation("sectionPlaneActive" + i),
79299
79418
  pos: program.getLocation("sectionPlanePos" + i),
@@ -79334,7 +79453,7 @@ class TrianglesDataTextureNormalsRenderer {
79334
79453
 
79335
79454
  _buildVertexShader() {
79336
79455
  const scene = this._scene;
79337
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
79456
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
79338
79457
  const src = [];
79339
79458
  src.push("// Batched geometry normals vertex shader");
79340
79459
  if (scene.logarithmicDepthBufferEnabled && WEBGL_INFO.SUPPORTED_EXTENSIONS["EXT_frag_depth"]) {
@@ -79416,8 +79535,7 @@ class TrianglesDataTextureNormalsRenderer {
79416
79535
 
79417
79536
  _buildFragmentShader() {
79418
79537
  const scene = this._scene;
79419
- const sectionPlanesState = scene._sectionPlanesState;
79420
- const clipping = (sectionPlanesState.sectionPlanes.length > 0);
79538
+ const clipping = (scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0);
79421
79539
  const src = [];
79422
79540
  src.push("#version 300 es");
79423
79541
  src.push("// Batched geometry normals fragment shader");
@@ -79443,7 +79561,7 @@ class TrianglesDataTextureNormalsRenderer {
79443
79561
  if (clipping) {
79444
79562
  src.push("in vec4 vWorldPosition;");
79445
79563
  src.push("in vec4 vFlags2;");
79446
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
79564
+ for (let i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
79447
79565
  src.push("uniform bool sectionPlaneActive" + i + ";");
79448
79566
  src.push("uniform vec3 sectionPlanePos" + i + ";");
79449
79567
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -79458,7 +79576,7 @@ class TrianglesDataTextureNormalsRenderer {
79458
79576
  src.push(" bool clippable = (float(vFlags2.x) > 0.0);");
79459
79577
  src.push(" if (clippable) {");
79460
79578
  src.push(" float dist = 0.0;");
79461
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
79579
+ for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
79462
79580
  src.push(" if (sectionPlaneActive" + i + ") {");
79463
79581
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
79464
79582
  src.push(" }");
@@ -79489,7 +79607,7 @@ class TrianglesDataTextureNormalsRenderer {
79489
79607
  const tempVec3a$9 = math.vec3();
79490
79608
  const tempVec3b$5 = math.vec3();
79491
79609
  const tempVec3c$4 = math.vec3();
79492
- const tempVec3d$1 = math.vec3();
79610
+ math.vec3();
79493
79611
 
79494
79612
  math.vec4();
79495
79613
 
@@ -79587,25 +79705,30 @@ class TrianglesDataTexturePickNormalsFlatRenderer {
79587
79705
  const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2);
79588
79706
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
79589
79707
  }
79708
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
79590
79709
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
79591
- if (numSectionPlanes > 0) {
79710
+ if (numAllocatedSectionPlanes > 0) {
79592
79711
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
79593
79712
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
79594
79713
  const renderFlags = model.renderFlags;
79595
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
79714
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
79596
79715
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
79597
79716
  if (sectionPlaneUniforms) {
79598
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
79599
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
79600
- if (active) {
79601
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
79602
- if (origin) {
79603
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3d$1);
79604
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
79605
- } else {
79606
- 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);
79607
79729
  }
79608
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
79730
+ } else {
79731
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
79609
79732
  }
79610
79733
  }
79611
79734
  }
@@ -79702,9 +79825,7 @@ class TrianglesDataTexturePickNormalsFlatRenderer {
79702
79825
 
79703
79826
  _buildVertexShader() {
79704
79827
  const scene = this._scene;
79705
- const sectionPlanesState = scene._sectionPlanesState;
79706
- scene._lightsState;
79707
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
79828
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
79708
79829
  const src = [];
79709
79830
  src.push("#version 300 es");
79710
79831
  src.push("// trianglesDatatextureNormalsRenderer vertex shader");
@@ -79870,8 +79991,7 @@ class TrianglesDataTexturePickNormalsFlatRenderer {
79870
79991
 
79871
79992
  _buildFragmentShader() {
79872
79993
  const scene = this._scene;
79873
- const sectionPlanesState = scene._sectionPlanesState;
79874
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
79994
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
79875
79995
  const src = [];
79876
79996
  src.push('#version 300 es');
79877
79997
  src.push("// TrianglesDataTexturePickNormalsRenderer fragment shader");
@@ -79890,7 +80010,7 @@ class TrianglesDataTexturePickNormalsFlatRenderer {
79890
80010
  src.push("in vec4 vWorldPosition;");
79891
80011
  if (clipping) {
79892
80012
  src.push("flat in uint vFlags2;");
79893
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
80013
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
79894
80014
  src.push("uniform bool sectionPlaneActive" + i + ";");
79895
80015
  src.push("uniform vec3 sectionPlanePos" + i + ";");
79896
80016
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -79902,7 +80022,7 @@ class TrianglesDataTexturePickNormalsFlatRenderer {
79902
80022
  src.push(" bool clippable = vFlags2 > 0u;");
79903
80023
  src.push(" if (clippable) {");
79904
80024
  src.push(" float dist = 0.0;");
79905
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
80025
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
79906
80026
  src.push("if (sectionPlaneActive" + i + ") {");
79907
80027
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
79908
80028
  src.push("}");
@@ -100245,6 +100365,11 @@ class Viewer {
100245
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
100246
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)
100247
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.
100248
100373
  */
100249
100374
  constructor(cfg) {
100250
100375
 
@@ -100302,7 +100427,8 @@ class Viewer {
100302
100427
  logarithmicDepthBufferEnabled: (!!cfg.logarithmicDepthBufferEnabled),
100303
100428
  pbrEnabled: (!!cfg.pbrEnabled),
100304
100429
  colorTextureEnabled: (cfg.colorTextureEnabled !== false),
100305
- dtxEnabled: (!!cfg.dtxEnabled)
100430
+ dtxEnabled: (!!cfg.dtxEnabled),
100431
+ numPreallocatedSectionPlanes: cfg.numPreallocatedSectionPlanes
100306
100432
  });
100307
100433
 
100308
100434
  /**