@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
@@ -21572,8 +21572,8 @@ class CustomProjection extends Component {
21572
21572
  const tempVec3$6 = math.vec3();
21573
21573
  const tempVec3b$q = math.vec3();
21574
21574
  const tempVec3c$n = math.vec3();
21575
- const tempVec3d$h = math.vec3();
21576
- const tempVec3e$4 = math.vec3();
21575
+ const tempVec3d$9 = math.vec3();
21576
+ const tempVec3e$2 = math.vec3();
21577
21577
  const tempVec3f$2 = math.vec3();
21578
21578
  const tempVec4a$d = math.vec4();
21579
21579
  const tempVec4b$c = math.vec4();
@@ -21885,7 +21885,7 @@ class Camera extends Component {
21885
21885
  math.rotationMat4v(angleInc * 0.0174532925, this._gimbalLock ? this._worldUp : this._up, tempMat);
21886
21886
  lookEyeVec = math.transformPoint3(tempMat, lookEyeVec, tempVec3b$q);
21887
21887
  this.eye = math.addVec3(this._look, lookEyeVec, tempVec3c$n); // Set eye position as 'look' plus 'eye' vector
21888
- this.up = math.transformPoint3(tempMat, this._up, tempVec3d$h); // Rotate 'up' vector
21888
+ this.up = math.transformPoint3(tempMat, this._up, tempVec3d$9); // Rotate 'up' vector
21889
21889
  }
21890
21890
 
21891
21891
  /**
@@ -21903,8 +21903,8 @@ class Camera extends Component {
21903
21903
  let eye2 = math.subVec3(this._eye, this._look, tempVec3$6);
21904
21904
  const left = math.cross3Vec3(math.normalizeVec3(eye2, tempVec3b$q), math.normalizeVec3(this._up, tempVec3c$n));
21905
21905
  math.rotationMat4v(angleInc * 0.0174532925, left, tempMat);
21906
- eye2 = math.transformPoint3(tempMat, eye2, tempVec3d$h);
21907
- this.up = math.transformPoint3(tempMat, this._up, tempVec3e$4);
21906
+ eye2 = math.transformPoint3(tempMat, eye2, tempVec3d$9);
21907
+ this.up = math.transformPoint3(tempMat, this._up, tempVec3e$2);
21908
21908
  this.eye = math.addVec3(eye2, this._look, tempVec3f$2);
21909
21909
  }
21910
21910
 
@@ -21919,7 +21919,7 @@ class Camera extends Component {
21919
21919
  look2 = math.transformPoint3(tempMat, look2, tempVec3b$q);
21920
21920
  this.look = math.addVec3(look2, this._eye, tempVec3c$n);
21921
21921
  if (this._gimbalLock) {
21922
- this.up = math.transformPoint3(tempMat, this._up, tempVec3d$h);
21922
+ this.up = math.transformPoint3(tempMat, this._up, tempVec3d$9);
21923
21923
  }
21924
21924
  }
21925
21925
 
@@ -21939,8 +21939,8 @@ class Camera extends Component {
21939
21939
  const left = math.cross3Vec3(math.normalizeVec3(look2, tempVec3b$q), math.normalizeVec3(this._up, tempVec3c$n));
21940
21940
  math.rotationMat4v(angleInc * 0.0174532925, left, tempMat);
21941
21941
  this.up = math.transformPoint3(tempMat, this._up, tempVec3f$2);
21942
- look2 = math.transformPoint3(tempMat, look2, tempVec3d$h);
21943
- this.look = math.addVec3(look2, this._eye, tempVec3e$4);
21942
+ look2 = math.transformPoint3(tempMat, look2, tempVec3d$9);
21943
+ this.look = math.addVec3(look2, this._eye, tempVec3e$2);
21944
21944
  }
21945
21945
 
21946
21946
  /**
@@ -21966,12 +21966,12 @@ class Camera extends Component {
21966
21966
  vec[2] += v[2];
21967
21967
  }
21968
21968
  if (pan[2] !== 0) {
21969
- v = math.mulVec3Scalar(math.normalizeVec3(eye2, tempVec3d$h), pan[2]);
21969
+ v = math.mulVec3Scalar(math.normalizeVec3(eye2, tempVec3d$9), pan[2]);
21970
21970
  vec[0] += v[0];
21971
21971
  vec[1] += v[1];
21972
21972
  vec[2] += v[2];
21973
21973
  }
21974
- this.eye = math.addVec3(this._eye, vec, tempVec3e$4);
21974
+ this.eye = math.addVec3(this._eye, vec, tempVec3e$2);
21975
21975
  this.look = math.addVec3(this._look, vec, tempVec3f$2);
21976
21976
  }
21977
21977
 
@@ -21988,7 +21988,7 @@ class Camera extends Component {
21988
21988
  return;
21989
21989
  }
21990
21990
  const dir = math.normalizeVec3(vec, tempVec3c$n);
21991
- this.eye = math.addVec3(this._look, math.mulVec3Scalar(dir, newLenLook), tempVec3d$h);
21991
+ this.eye = math.addVec3(this._look, math.mulVec3Scalar(dir, newLenLook), tempVec3d$9);
21992
21992
  }
21993
21993
 
21994
21994
  /**
@@ -27967,8 +27967,13 @@ class Scene extends Component {
27967
27967
  * @param {Viewer} viewer The Viewer this Scene belongs to.
27968
27968
  * @param {Object} cfg Scene configuration.
27969
27969
  * @param {String} [cfg.canvasId] ID of an existing HTML canvas for the {@link Scene#canvas} - either this or canvasElement is mandatory. When both values are given, the element reference is always preferred to the ID.
27970
- * @param {HTMLCanvasElement} [cfg.canvasElement] Reference of an existing HTML canvas for the {@link Scene#canvas} - either this or canvasId is mandatory. When both values are given, the element reference is always preferred to the ID.
27970
+ * @param {HTMLCanvasElement} [cfg.canvasElement] Reference of an existing HTML canvas for the {@link Scene#canvas} - either this or canvasId is mandatory. When both values are given, the element reference is always preferred to the ID.
27971
27971
  * @param {HTMLElement} [cfg.keyboardEventsElement] Optional reference to HTML element on which key events should be handled. Defaults to the HTML Document.
27972
+ * @param {number} [cfg.numPreallocatedSectionPlanes=0] Enhances the efficiency of SectionPlane creation by proactively allocating Viewer resources for a specified quantity
27973
+ * of SectionPlanes. Introducing this parameter streamlines the initial creation speed of SectionPlanes, particularly up to the designated quantity. This parameter internally
27974
+ * configures renderer logic for the specified number of SectionPlanes, eliminating the need for setting up logic with each SectionPlane creation and thereby enhancing
27975
+ * responsiveness. It is important to consider that each SectionPlane imposes rendering performance, so it is recommended to set this value to a quantity that aligns with
27976
+ * your expected usage.
27972
27977
  * @throws {String} Throws an exception when both canvasId or canvasElement are missing or they aren't pointing to a valid HTMLCanvasElement.
27973
27978
  */
27974
27979
  constructor(viewer, cfg = {}) {
@@ -27991,6 +27996,8 @@ class Scene extends Component {
27991
27996
 
27992
27997
  this._aabbDirty = true;
27993
27998
 
27999
+ this._numPreallocatedSectionPlanes = cfg.numPreallocatedSectionPlanes || 0;
28000
+
27994
28001
  /**
27995
28002
  * The {@link Viewer} this Scene belongs to.
27996
28003
  * @type {Viewer}
@@ -28253,6 +28260,8 @@ class Scene extends Component {
28253
28260
  alphaDepthMask: alphaDepthMask
28254
28261
  });
28255
28262
 
28263
+ const numPreallocatedSectionPlanes = this._numPreallocatedSectionPlanes;
28264
+
28256
28265
  this._sectionPlanesState = new (function () {
28257
28266
 
28258
28267
  this.sectionPlanes = [];
@@ -28265,13 +28274,14 @@ class Scene extends Component {
28265
28274
  if (hash) {
28266
28275
  return hash;
28267
28276
  }
28268
- const sectionPlanes = this.sectionPlanes;
28269
- if (sectionPlanes.length === 0) {
28277
+ const numAllocatedSectionPlanes = this.getNumAllocatedSectionPlanes();
28278
+ this.sectionPlanes;
28279
+ if (numAllocatedSectionPlanes === 0) {
28270
28280
  return this.hash = ";";
28271
28281
  }
28272
28282
 
28273
28283
  const hashParts = [];
28274
- for (let i = 0, len = sectionPlanes.length; i < len; i++) {
28284
+ for (let i = 0, len = numAllocatedSectionPlanes; i < len; i++) {
28275
28285
  hashParts.push("cp");
28276
28286
  }
28277
28287
  hashParts.push(";");
@@ -28293,6 +28303,11 @@ class Scene extends Component {
28293
28303
  }
28294
28304
  }
28295
28305
  };
28306
+
28307
+ this.getNumAllocatedSectionPlanes = function () {
28308
+ const num = this.sectionPlanes.length;
28309
+ return (num > numPreallocatedSectionPlanes) ? num : numPreallocatedSectionPlanes;
28310
+ };
28296
28311
  })();
28297
28312
 
28298
28313
  this._lightsState = new (function () {
@@ -30169,12 +30184,12 @@ class Scene extends Component {
30169
30184
 
30170
30185
  /**
30171
30186
  * This method will "tickify" the provided `cb` function.
30172
- *
30187
+ *
30173
30188
  * This means, the function will be wrapped so:
30174
- *
30189
+ *
30175
30190
  * - it runs time-aligned to scene ticks
30176
30191
  * - it runs maximum once per scene-tick
30177
- *
30192
+ *
30178
30193
  * @param {Function} cb The function to tickify
30179
30194
  * @returns {Function)}
30180
30195
  */
@@ -30195,7 +30210,7 @@ class Scene extends Component {
30195
30210
 
30196
30211
  /**
30197
30212
  * The provided `cb` function is replaced with a "set-dirty" function
30198
- *
30213
+ *
30199
30214
  * @type {Function}
30200
30215
  */
30201
30216
  const wrapperFunc = function (...args) {
@@ -30205,7 +30220,7 @@ class Scene extends Component {
30205
30220
 
30206
30221
  /**
30207
30222
  * An each scene tick, if the "dirty-flag" is set, run the `cb` function.
30208
- *
30223
+ *
30209
30224
  * This will make it run time-aligned to the scene tick.
30210
30225
  */
30211
30226
  const tickSubId = this.on("tick", () => {
@@ -30219,7 +30234,7 @@ class Scene extends Component {
30219
30234
  /**
30220
30235
  * And, store the list of subscribers.
30221
30236
  */
30222
- this._tickifiedFunctions[cbString] = { tickSubId, wrapperFunc };
30237
+ this._tickifiedFunctions[cbString] = {tickSubId, wrapperFunc};
30223
30238
 
30224
30239
  return wrapperFunc;
30225
30240
  }
@@ -30712,7 +30727,7 @@ function buildVertexLambert(mesh) {
30712
30727
  const geometryState = mesh._geometry._state;
30713
30728
  const billboard = mesh._state.billboard;
30714
30729
  const stationary = mesh._state.stationary;
30715
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
30730
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
30716
30731
  const quantizedGeometry = !!geometryState.compressGeometry;
30717
30732
 
30718
30733
  const src = [];
@@ -30889,7 +30904,7 @@ function buildFragmentLambert(mesh) {
30889
30904
  const sectionPlanesState = scene._sectionPlanesState;
30890
30905
  mesh._material._state;
30891
30906
  const geometryState = mesh._geometry._state;
30892
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
30907
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
30893
30908
  const gammaOutput = scene.gammaOutput; // If set, then it expects that all textures and colors need to be outputted in premultiplied gamma. Default is false.
30894
30909
  const src = [];
30895
30910
  src.push("#version 300 es");
@@ -30909,7 +30924,7 @@ function buildFragmentLambert(mesh) {
30909
30924
  if (clipping) {
30910
30925
  src.push("in vec4 vWorldPosition;");
30911
30926
  src.push("uniform bool clippable;");
30912
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
30927
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
30913
30928
  src.push("uniform bool sectionPlaneActive" + i + ";");
30914
30929
  src.push("uniform vec3 sectionPlanePos" + i + ";");
30915
30930
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -30927,7 +30942,7 @@ function buildFragmentLambert(mesh) {
30927
30942
  if (clipping) {
30928
30943
  src.push("if (clippable) {");
30929
30944
  src.push(" float dist = 0.0;");
30930
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
30945
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
30931
30946
  src.push("if (sectionPlaneActive" + i + ") {");
30932
30947
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
30933
30948
  src.push("}");
@@ -30968,7 +30983,7 @@ function buildVertexDraw(mesh) {
30968
30983
  const stationary = meshState.stationary;
30969
30984
  const texturing = hasTextures(mesh);
30970
30985
  const normals = hasNormals$1(mesh);
30971
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
30986
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
30972
30987
  const receivesShadow = getReceivesShadow(mesh);
30973
30988
  const quantizedGeometry = !!geometryState.compressGeometry;
30974
30989
  const src = [];
@@ -31190,7 +31205,7 @@ function buildFragmentDraw(mesh) {
31190
31205
  const sectionPlanesState = mesh.scene._sectionPlanesState;
31191
31206
  const lightsState = mesh.scene._lightsState;
31192
31207
  const materialState = mesh._material._state;
31193
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
31208
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
31194
31209
  const normals = hasNormals$1(mesh);
31195
31210
  const uvs = geometryState.uvBuf;
31196
31211
  const phongMaterial = (materialState.type === "PhongMaterial");
@@ -31251,7 +31266,7 @@ function buildFragmentDraw(mesh) {
31251
31266
  if (clipping) {
31252
31267
  src.push("in vec4 vWorldPosition;");
31253
31268
  src.push("uniform bool clippable;");
31254
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
31269
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
31255
31270
  src.push("uniform bool sectionPlaneActive" + i + ";");
31256
31271
  src.push("uniform vec3 sectionPlanePos" + i + ";");
31257
31272
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -31741,7 +31756,7 @@ function buildFragmentDraw(mesh) {
31741
31756
  if (clipping) {
31742
31757
  src.push("if (clippable) {");
31743
31758
  src.push(" float dist = 0.0;");
31744
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
31759
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
31745
31760
  src.push("if (sectionPlaneActive" + i + ") {");
31746
31761
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
31747
31762
  src.push("}");
@@ -32275,19 +32290,29 @@ DrawRenderer.prototype.drawMesh = function (frameCtx, mesh) {
32275
32290
  gl.uniformMatrix4fv(this._uViewNormalMatrix, false, camera.viewNormalMatrix);
32276
32291
 
32277
32292
  if (meshState.clippable) {
32293
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
32278
32294
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
32279
- if (numSectionPlanes > 0) {
32295
+ if (numAllocatedSectionPlanes > 0) {
32280
32296
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
32281
32297
  const renderFlags = mesh.renderFlags;
32282
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
32298
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
32283
32299
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
32284
32300
  if (sectionPlaneUniforms) {
32285
- const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];
32286
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
32287
- if (active) {
32288
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
32289
- gl.uniform3fv(sectionPlaneUniforms.pos, origin ? getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$A) : sectionPlane.pos);
32290
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
32301
+ if (sectionPlaneIndex < numSectionPlanes) {
32302
+ const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];
32303
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
32304
+ if (active) {
32305
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
32306
+ if (origin) {
32307
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$A);
32308
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
32309
+ } else {
32310
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
32311
+ }
32312
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
32313
+ }
32314
+ } else {
32315
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
32291
32316
  }
32292
32317
  }
32293
32318
  }
@@ -33352,7 +33377,7 @@ function buildFragment$5(mesh) {
33352
33377
  const scene = mesh.scene;
33353
33378
  const sectionPlanesState = mesh.scene._sectionPlanesState;
33354
33379
  const gammaOutput = mesh.scene.gammaOutput;
33355
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
33380
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
33356
33381
  const src = [];
33357
33382
  src.push("#version 300 es");
33358
33383
  src.push("// Lambertian drawing fragment shader");
@@ -33379,7 +33404,7 @@ function buildFragment$5(mesh) {
33379
33404
  if (clipping) {
33380
33405
  src.push("in vec4 vWorldPosition;");
33381
33406
  src.push("uniform bool clippable;");
33382
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
33407
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
33383
33408
  src.push("uniform bool sectionPlaneActive" + i + ";");
33384
33409
  src.push("uniform vec3 sectionPlanePos" + i + ";");
33385
33410
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -33391,7 +33416,7 @@ function buildFragment$5(mesh) {
33391
33416
  if (clipping) {
33392
33417
  src.push("if (clippable) {");
33393
33418
  src.push(" float dist = 0.0;");
33394
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
33419
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
33395
33420
  src.push("if (sectionPlaneActive" + i + ") {");
33396
33421
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
33397
33422
  src.push("}");
@@ -33497,19 +33522,29 @@ EmphasisFillRenderer.prototype.drawMesh = function (frameCtx, mesh, mode) {
33497
33522
  gl.uniformMatrix4fv(this._uViewNormalMatrix, false, camera.viewNormalMatrix);
33498
33523
 
33499
33524
  if (meshState.clippable) {
33525
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
33500
33526
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
33501
- if (numSectionPlanes > 0) {
33527
+ if (numAllocatedSectionPlanes > 0) {
33502
33528
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
33503
33529
  const renderFlags = mesh.renderFlags;
33504
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
33530
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
33505
33531
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
33506
33532
  if (sectionPlaneUniforms) {
33507
- const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];
33508
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
33509
- if (active) {
33510
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
33511
- gl.uniform3fv(sectionPlaneUniforms.pos, origin ? getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$z) : sectionPlane.pos);
33512
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
33533
+ if (sectionPlaneIndex < numSectionPlanes) {
33534
+ const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];
33535
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
33536
+ if (active) {
33537
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
33538
+ if (origin) {
33539
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$z);
33540
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
33541
+ } else {
33542
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
33543
+ }
33544
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
33545
+ }
33546
+ } else {
33547
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
33513
33548
  }
33514
33549
  }
33515
33550
  }
@@ -33618,7 +33653,7 @@ EmphasisFillRenderer.prototype._allocate = function (mesh) {
33618
33653
  }
33619
33654
  }
33620
33655
  this._uSectionPlanes = [];
33621
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
33656
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
33622
33657
  this._uSectionPlanes.push({
33623
33658
  active: program.getLocation("sectionPlaneActive" + i),
33624
33659
  pos: program.getLocation("sectionPlanePos" + i),
@@ -33781,7 +33816,7 @@ function buildFragment$4(mesh) {
33781
33816
  const scene = mesh.scene;
33782
33817
  const sectionPlanesState = mesh.scene._sectionPlanesState;
33783
33818
  const gammaOutput = mesh.scene.gammaOutput;
33784
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
33819
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
33785
33820
  const src = [];
33786
33821
  src.push("#version 300 es");
33787
33822
  src.push("// Edges drawing fragment shader");
@@ -33806,7 +33841,7 @@ function buildFragment$4(mesh) {
33806
33841
  if (clipping) {
33807
33842
  src.push("in vec4 vWorldPosition;");
33808
33843
  src.push("uniform bool clippable;");
33809
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
33844
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
33810
33845
  src.push("uniform bool sectionPlaneActive" + i + ";");
33811
33846
  src.push("uniform vec3 sectionPlanePos" + i + ";");
33812
33847
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -33818,7 +33853,7 @@ function buildFragment$4(mesh) {
33818
33853
  if (clipping) {
33819
33854
  src.push("if (clippable) {");
33820
33855
  src.push(" float dist = 0.0;");
33821
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
33856
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
33822
33857
  src.push("if (sectionPlaneActive" + i + ") {");
33823
33858
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
33824
33859
  src.push("}");
@@ -33916,19 +33951,29 @@ EmphasisEdgesRenderer.prototype.drawMesh = function (frameCtx, mesh, mode) {
33916
33951
  gl.uniformMatrix4fv(this._uViewMatrix, false, origin ? frameCtx.getRTCViewMatrix(meshState.originHash, origin) : camera.viewMatrix);
33917
33952
 
33918
33953
  if (meshState.clippable) {
33954
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
33919
33955
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
33920
- if (numSectionPlanes > 0) {
33956
+ if (numAllocatedSectionPlanes > 0) {
33921
33957
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
33922
33958
  const renderFlags = mesh.renderFlags;
33923
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
33959
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
33924
33960
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
33925
33961
  if (sectionPlaneUniforms) {
33926
- const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];
33927
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
33928
- if (active) {
33929
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
33930
- gl.uniform3fv(sectionPlaneUniforms.pos, origin ? getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$y) : sectionPlane.pos);
33931
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
33962
+ if (sectionPlaneIndex < numSectionPlanes) {
33963
+ const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];
33964
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
33965
+ if (active) {
33966
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
33967
+ if (origin) {
33968
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$y);
33969
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
33970
+ } else {
33971
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
33972
+ }
33973
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
33974
+ }
33975
+ } else {
33976
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
33932
33977
  }
33933
33978
  }
33934
33979
  }
@@ -34029,7 +34074,7 @@ EmphasisEdgesRenderer.prototype._allocate = function (mesh) {
34029
34074
  this._uViewMatrix = program.getLocation("viewMatrix");
34030
34075
  this._uProjMatrix = program.getLocation("projMatrix");
34031
34076
  this._uSectionPlanes = [];
34032
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
34077
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
34033
34078
  this._uSectionPlanes.push({
34034
34079
  active: program.getLocation("sectionPlaneActive" + i),
34035
34080
  pos: program.getLocation("sectionPlanePos" + i),
@@ -34181,7 +34226,7 @@ function buildVertex$3(mesh) {
34181
34226
  function buildFragment$3(mesh) {
34182
34227
  const scene = mesh.scene;
34183
34228
  const sectionPlanesState = scene._sectionPlanesState;
34184
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
34229
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
34185
34230
  const src = [];
34186
34231
  src.push('#version 300 es');
34187
34232
  src.push("// Mesh picking fragment shader");
@@ -34201,7 +34246,7 @@ function buildFragment$3(mesh) {
34201
34246
  if (clipping) {
34202
34247
  src.push("uniform bool clippable;");
34203
34248
  src.push("in vec4 vWorldPosition;");
34204
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
34249
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
34205
34250
  src.push("uniform bool sectionPlaneActive" + i + ";");
34206
34251
  src.push("uniform vec3 sectionPlanePos" + i + ";");
34207
34252
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -34212,7 +34257,7 @@ function buildFragment$3(mesh) {
34212
34257
  if (clipping) {
34213
34258
  src.push("if (clippable) {");
34214
34259
  src.push(" float dist = 0.0;");
34215
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
34260
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
34216
34261
  src.push("if (sectionPlaneActive" + i + ") {");
34217
34262
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
34218
34263
  src.push("}");
@@ -34305,19 +34350,29 @@ PickMeshRenderer.prototype.drawMesh = function (frameCtx, mesh) {
34305
34350
  gl.uniformMatrix4fv(this._uViewMatrix, false, origin ? frameCtx.getRTCPickViewMatrix(meshState.originHash, origin) : frameCtx.pickViewMatrix);
34306
34351
 
34307
34352
  if (meshState.clippable) {
34353
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
34308
34354
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
34309
- if (numSectionPlanes > 0) {
34355
+ if (numAllocatedSectionPlanes > 0) {
34310
34356
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
34311
34357
  const renderFlags = mesh.renderFlags;
34312
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
34358
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
34313
34359
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
34314
34360
  if (sectionPlaneUniforms) {
34315
- const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];
34316
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
34317
- if (active) {
34318
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
34319
- gl.uniform3fv(sectionPlaneUniforms.pos, origin ? getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$x) : sectionPlane.pos);
34320
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
34361
+ if (sectionPlaneIndex < numSectionPlanes) {
34362
+ const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];
34363
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
34364
+ if (active) {
34365
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
34366
+ if (origin) {
34367
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$x);
34368
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
34369
+ } else {
34370
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
34371
+ }
34372
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
34373
+ }
34374
+ } else {
34375
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
34321
34376
  }
34322
34377
  }
34323
34378
  }
@@ -34509,7 +34564,7 @@ function buildVertex$2(mesh) {
34509
34564
  function buildFragment$2(mesh) {
34510
34565
  const scene = mesh.scene;
34511
34566
  const sectionPlanesState = scene._sectionPlanesState;
34512
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
34567
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
34513
34568
  const src = [];
34514
34569
  src.push('#version 300 es');
34515
34570
  src.push("// Surface picking fragment shader");
@@ -34529,7 +34584,7 @@ function buildFragment$2(mesh) {
34529
34584
  if (clipping) {
34530
34585
  src.push("uniform bool clippable;");
34531
34586
  src.push("in vec4 vWorldPosition;");
34532
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
34587
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
34533
34588
  src.push("uniform bool sectionPlaneActive" + i + ";");
34534
34589
  src.push("uniform vec3 sectionPlanePos" + i + ";");
34535
34590
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -34540,7 +34595,7 @@ function buildFragment$2(mesh) {
34540
34595
  if (clipping) {
34541
34596
  src.push("if (clippable) {");
34542
34597
  src.push(" float dist = 0.0;");
34543
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
34598
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
34544
34599
  src.push("if (sectionPlaneActive" + i + ") {");
34545
34600
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
34546
34601
  src.push("}");
@@ -34641,19 +34696,29 @@ PickTriangleRenderer.prototype.drawMesh = function (frameCtx, mesh) {
34641
34696
  gl.uniformMatrix4fv(this._uViewMatrix, false, origin ? frameCtx.getRTCPickViewMatrix(meshState.originHash, origin) : frameCtx.pickViewMatrix);
34642
34697
 
34643
34698
  if (meshState.clippable) {
34699
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
34644
34700
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
34645
- if (numSectionPlanes > 0) {
34701
+ if (numAllocatedSectionPlanes > 0) {
34646
34702
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
34647
34703
  const renderFlags = mesh.renderFlags;
34648
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
34704
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
34649
34705
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
34650
34706
  if (sectionPlaneUniforms) {
34651
- const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];
34652
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
34653
- if (active) {
34654
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
34655
- gl.uniform3fv(sectionPlaneUniforms.pos, origin ? getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$w) : sectionPlane.pos);
34656
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
34707
+ if (sectionPlaneIndex < numSectionPlanes) {
34708
+ const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];
34709
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
34710
+ if (active) {
34711
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
34712
+ if (origin) {
34713
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$w);
34714
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
34715
+ } else {
34716
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
34717
+ }
34718
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
34719
+ }
34720
+ } else {
34721
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
34657
34722
  }
34658
34723
  }
34659
34724
  }
@@ -34834,7 +34899,7 @@ function buildFragment$1(mesh) {
34834
34899
 
34835
34900
  const scene = mesh.scene;
34836
34901
  const sectionPlanesState = scene._sectionPlanesState;
34837
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
34902
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
34838
34903
  const src = [];
34839
34904
  src.push('#version 300 es');
34840
34905
  src.push("// Mesh occlusion fragment shader");
@@ -34855,7 +34920,7 @@ function buildFragment$1(mesh) {
34855
34920
  if (clipping) {
34856
34921
  src.push("uniform bool clippable;");
34857
34922
  src.push("in vec4 vWorldPosition;");
34858
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
34923
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
34859
34924
  src.push("uniform bool sectionPlaneActive" + i + ";");
34860
34925
  src.push("uniform vec3 sectionPlanePos" + i + ";");
34861
34926
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -34869,7 +34934,7 @@ function buildFragment$1(mesh) {
34869
34934
  if (clipping) {
34870
34935
  src.push("if (clippable) {");
34871
34936
  src.push(" float dist = 0.0;");
34872
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
34937
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
34873
34938
  src.push("if (sectionPlaneActive" + i + ") {");
34874
34939
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
34875
34940
  src.push("}");
@@ -34990,19 +35055,29 @@ OcclusionRenderer.prototype.drawMesh = function (frameCtx, mesh) {
34990
35055
  gl.uniformMatrix4fv(this._uViewMatrix, false, origin ? frameCtx.getRTCViewMatrix(meshState.originHash, origin) : camera.viewMatrix);
34991
35056
 
34992
35057
  if (meshState.clippable) {
35058
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
34993
35059
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
34994
- if (numSectionPlanes > 0) {
35060
+ if (numAllocatedSectionPlanes > 0) {
34995
35061
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
34996
35062
  const renderFlags = mesh.renderFlags;
34997
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
35063
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
34998
35064
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
34999
35065
  if (sectionPlaneUniforms) {
35000
- const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];
35001
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
35002
- if (active) {
35003
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
35004
- gl.uniform3fv(sectionPlaneUniforms.pos, origin ? getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$v) : sectionPlane.pos);
35005
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
35066
+ if (sectionPlaneIndex < numSectionPlanes) {
35067
+ const active = renderFlags.sectionPlanesActivePerLayer[sectionPlaneIndex];
35068
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
35069
+ if (active) {
35070
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
35071
+ if (origin) {
35072
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$v);
35073
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
35074
+ } else {
35075
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
35076
+ }
35077
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
35078
+ }
35079
+ } else {
35080
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
35006
35081
  }
35007
35082
  }
35008
35083
  }
@@ -35137,7 +35212,7 @@ function buildFragment(mesh) {
35137
35212
  const scene = mesh.scene;
35138
35213
  scene.canvas.gl;
35139
35214
  const sectionPlanesState = scene._sectionPlanesState;
35140
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
35215
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
35141
35216
  const src = [];
35142
35217
  src.push("// Mesh shadow fragment shader");
35143
35218
 
@@ -35152,7 +35227,7 @@ function buildFragment(mesh) {
35152
35227
  if (clipping) {
35153
35228
  src.push("uniform bool clippable;");
35154
35229
  src.push("in vec4 vWorldPosition;");
35155
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
35230
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
35156
35231
  src.push("uniform bool sectionPlaneActive" + i + ";");
35157
35232
  src.push("uniform vec3 sectionPlanePos" + i + ";");
35158
35233
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -35173,7 +35248,7 @@ function buildFragment(mesh) {
35173
35248
  if (clipping) {
35174
35249
  src.push("if (clippable) {");
35175
35250
  src.push(" float dist = 0.0;");
35176
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
35251
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
35177
35252
  src.push("if (sectionPlaneActive" + i + ") {");
35178
35253
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
35179
35254
  src.push("}");
@@ -35368,7 +35443,7 @@ ShadowRenderer.prototype._bindProgram = function (frame) {
35368
35443
  this._lastMaterialId = null;
35369
35444
  this._lastVertexBufsId = null;
35370
35445
  this._lastGeometryId = null;
35371
- if (sectionPlanesState.sectionPlanes.length > 0) {
35446
+ if (sectionPlanesState.getNumAllocatedSectionPlanes() > 0) {
35372
35447
  let sectionPlaneUniforms;
35373
35448
  let uSectionPlaneActive;
35374
35449
  let sectionPlane;
@@ -56361,10 +56436,15 @@ class SceneModelMesh {
56361
56436
  */
56362
56437
  get aabb() { // called by SceneModelEntity
56363
56438
  if (this._aabbDirty) {
56364
- if (this.obb && this.transform) {
56365
- math.transformOBB3(this.transform.worldMatrix, this.obb, tempOBB3);
56366
- math.transformOBB3(this.model.worldMatrix, tempOBB3, tempOBB3b);
56367
- math.OBB3ToAABB3(tempOBB3b, this._aabb);
56439
+ if (this.obb) {
56440
+ if (this.transform) {
56441
+ math.transformOBB3(this.transform.worldMatrix, this.obb, tempOBB3);
56442
+ math.transformOBB3(this.model.worldMatrix, tempOBB3, tempOBB3b);
56443
+ math.OBB3ToAABB3(tempOBB3b, this._aabb);
56444
+ } else {
56445
+ math.transformOBB3(this.model.worldMatrix, this.obb, tempOBB3);
56446
+ math.OBB3ToAABB3(tempOBB3, this._aabb);
56447
+ }
56368
56448
  }
56369
56449
  this._aabbDirty = false;
56370
56450
  }
@@ -56580,32 +56660,38 @@ class VBOSceneModelRenderer {
56580
56660
  const {gl} = scene.canvas;
56581
56661
  const {model, layerIndex} = layer;
56582
56662
 
56663
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
56583
56664
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
56584
- if (numSectionPlanes > 0) {
56665
+ if (numAllocatedSectionPlanes > 0) {
56585
56666
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
56586
56667
  const baseIndex = layerIndex * numSectionPlanes;
56587
56668
  const renderFlags = model.renderFlags;
56588
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
56669
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
56589
56670
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
56590
56671
  if (sectionPlaneUniforms) {
56591
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
56592
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
56593
- if (active) {
56594
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
56595
- const origin = layer._state.origin;
56596
- if (origin) {
56597
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$s);
56598
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
56599
- } else {
56600
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
56672
+ if (sectionPlaneIndex < numSectionPlanes) {
56673
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
56674
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
56675
+ if (active) {
56676
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
56677
+ const origin = layer._state.origin;
56678
+ if (origin) {
56679
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$s);
56680
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
56681
+ } else {
56682
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
56683
+ }
56684
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
56601
56685
  }
56602
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
56686
+ } else {
56687
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
56603
56688
  }
56604
56689
  }
56605
56690
  }
56606
56691
  }
56607
56692
  }
56608
56693
 
56694
+
56609
56695
  _allocate() {
56610
56696
  const scene = this._scene;
56611
56697
  const gl = scene.canvas.gl;
@@ -56686,7 +56772,7 @@ class VBOSceneModelRenderer {
56686
56772
 
56687
56773
  this._uSectionPlanes = [];
56688
56774
 
56689
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
56775
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
56690
56776
  this._uSectionPlanes.push({
56691
56777
  active: program.getLocation("sectionPlaneActive" + i),
56692
56778
  pos: program.getLocation("sectionPlanePos" + i),
@@ -57152,12 +57238,11 @@ class VBOSceneModelTriangleBatchingEdgesRenderer extends VBOSceneModelTriangleBa
57152
57238
  }
57153
57239
 
57154
57240
 
57155
-
57156
57241
  /**
57157
57242
  * @private
57158
57243
  */
57159
57244
  class VBOSceneModelTriangleInstancingRenderer extends VBOSceneModelRenderer {
57160
- constructor(scene, withSAO, { edges = false} = {}) {
57245
+ constructor(scene, withSAO, {edges = false} = {}) {
57161
57246
  super(scene, withSAO, {instancing: true, edges});
57162
57247
  }
57163
57248
 
@@ -57304,7 +57389,7 @@ class TrianglesBatchingColorRenderer extends VBOSceneModelTriangleBatchingRender
57304
57389
  const scene = this._scene;
57305
57390
  const sectionPlanesState = scene._sectionPlanesState;
57306
57391
  const lightsState = scene._lightsState;
57307
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
57392
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57308
57393
  let light;
57309
57394
  const src = [];
57310
57395
  src.push("#version 300 es");
@@ -57443,7 +57528,7 @@ class TrianglesBatchingColorRenderer extends VBOSceneModelTriangleBatchingRender
57443
57528
  _buildFragmentShader() {
57444
57529
  const scene = this._scene;
57445
57530
  const sectionPlanesState = scene._sectionPlanesState;
57446
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
57531
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57447
57532
  const src = [];
57448
57533
  src.push("#version 300 es");
57449
57534
  src.push("// Triangles batching draw fragment shader");
@@ -57476,7 +57561,7 @@ class TrianglesBatchingColorRenderer extends VBOSceneModelTriangleBatchingRender
57476
57561
  if (clipping) {
57477
57562
  src.push("in vec4 vWorldPosition;");
57478
57563
  src.push("in float vFlags;");
57479
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
57564
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
57480
57565
  src.push("uniform bool sectionPlaneActive" + i + ";");
57481
57566
  src.push("uniform vec3 sectionPlanePos" + i + ";");
57482
57567
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -57490,7 +57575,7 @@ class TrianglesBatchingColorRenderer extends VBOSceneModelTriangleBatchingRender
57490
57575
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
57491
57576
  src.push(" if (clippable) {");
57492
57577
  src.push(" float dist = 0.0;");
57493
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
57578
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
57494
57579
  src.push("if (sectionPlaneActive" + i + ") {");
57495
57580
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
57496
57581
  src.push("}");
@@ -57536,7 +57621,7 @@ class TrianglesBatchingFlatColorRenderer extends VBOSceneModelTriangleBatchingRe
57536
57621
  _buildVertexShader() {
57537
57622
  const scene = this._scene;
57538
57623
  const sectionPlanesState = scene._sectionPlanesState;
57539
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
57624
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57540
57625
  const src = [];
57541
57626
  src.push("#version 300 es");
57542
57627
  src.push("// Triangles batching flat-shading draw vertex shader");
@@ -57608,7 +57693,7 @@ class TrianglesBatchingFlatColorRenderer extends VBOSceneModelTriangleBatchingRe
57608
57693
  const scene = this._scene;
57609
57694
  const lightsState = scene._lightsState;
57610
57695
  const sectionPlanesState = scene._sectionPlanesState;
57611
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
57696
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57612
57697
  const src = [];
57613
57698
  src.push("#version 300 es");
57614
57699
  src.push("// Triangles batching flat-shading draw fragment shader");
@@ -57644,7 +57729,7 @@ class TrianglesBatchingFlatColorRenderer extends VBOSceneModelTriangleBatchingRe
57644
57729
  if (clipping) {
57645
57730
  src.push("in vec4 vWorldPosition;");
57646
57731
  src.push("in float vFlags;");
57647
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
57732
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
57648
57733
  src.push("uniform bool sectionPlaneActive" + i + ";");
57649
57734
  src.push("uniform vec3 sectionPlanePos" + i + ";");
57650
57735
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -57682,7 +57767,7 @@ class TrianglesBatchingFlatColorRenderer extends VBOSceneModelTriangleBatchingRe
57682
57767
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
57683
57768
  src.push(" if (clippable) {");
57684
57769
  src.push(" float dist = 0.0;");
57685
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
57770
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
57686
57771
  src.push("if (sectionPlaneActive" + i + ") {");
57687
57772
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
57688
57773
  src.push("}");
@@ -57771,7 +57856,7 @@ class TrianglesBatchingSilhouetteRenderer extends VBOSceneModelTriangleBatchingR
57771
57856
 
57772
57857
  const scene = this._scene;
57773
57858
  const sectionPlanesState = scene._sectionPlanesState;
57774
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
57859
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57775
57860
 
57776
57861
  const src = [];
57777
57862
  src.push("#version 300 es");
@@ -57842,7 +57927,7 @@ class TrianglesBatchingSilhouetteRenderer extends VBOSceneModelTriangleBatchingR
57842
57927
  const sectionPlanesState = scene._sectionPlanesState;
57843
57928
  let i;
57844
57929
  let len;
57845
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
57930
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57846
57931
  const src = [];
57847
57932
  src.push("#version 300 es");
57848
57933
  src.push("// Triangles batching silhouette fragment shader");
@@ -57862,7 +57947,7 @@ class TrianglesBatchingSilhouetteRenderer extends VBOSceneModelTriangleBatchingR
57862
57947
  if (clipping) {
57863
57948
  src.push("in vec4 vWorldPosition;");
57864
57949
  src.push("in float vFlags;");
57865
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
57950
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
57866
57951
  src.push("uniform bool sectionPlaneActive" + i + ";");
57867
57952
  src.push("uniform vec3 sectionPlanePos" + i + ";");
57868
57953
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -57875,7 +57960,7 @@ class TrianglesBatchingSilhouetteRenderer extends VBOSceneModelTriangleBatchingR
57875
57960
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
57876
57961
  src.push(" if (clippable) {");
57877
57962
  src.push(" float dist = 0.0;");
57878
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
57963
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
57879
57964
  src.push("if (sectionPlaneActive" + i + ") {");
57880
57965
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
57881
57966
  src.push("}");
@@ -57904,7 +57989,7 @@ class TrianglesBatchingEdgesRenderer extends VBOSceneModelTriangleBatchingEdgesR
57904
57989
  _buildVertexShader() {
57905
57990
  const scene = this._scene;
57906
57991
  const sectionPlanesState = scene._sectionPlanesState;
57907
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
57992
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57908
57993
  const src = [];
57909
57994
 
57910
57995
  src.push("#version 300 es");
@@ -57973,7 +58058,7 @@ class TrianglesBatchingEdgesRenderer extends VBOSceneModelTriangleBatchingEdgesR
57973
58058
  _buildFragmentShader() {
57974
58059
  const scene = this._scene;
57975
58060
  const sectionPlanesState = scene._sectionPlanesState;
57976
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
58061
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57977
58062
  const src = [];
57978
58063
  src.push("#version 300 es");
57979
58064
  src.push("// Batched geometry edges drawing fragment shader");
@@ -57993,7 +58078,7 @@ class TrianglesBatchingEdgesRenderer extends VBOSceneModelTriangleBatchingEdgesR
57993
58078
  if (clipping) {
57994
58079
  src.push("in vec4 vWorldPosition;");
57995
58080
  src.push("in float vFlags;");
57996
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
58081
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
57997
58082
  src.push("uniform bool sectionPlaneActive" + i + ";");
57998
58083
  src.push("uniform vec3 sectionPlanePos" + i + ";");
57999
58084
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58006,7 +58091,7 @@ class TrianglesBatchingEdgesRenderer extends VBOSceneModelTriangleBatchingEdgesR
58006
58091
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58007
58092
  src.push(" if (clippable) {");
58008
58093
  src.push(" float dist = 0.0;");
58009
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
58094
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
58010
58095
  src.push("if (sectionPlaneActive" + i + ") {");
58011
58096
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58012
58097
  src.push("}");
@@ -58031,7 +58116,7 @@ class TrianglesBatchingEdgesColorRenderer extends VBOSceneModelTriangleBatchingE
58031
58116
  _buildVertexShader() {
58032
58117
  const scene = this._scene;
58033
58118
  const sectionPlanesState = scene._sectionPlanesState;
58034
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
58119
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58035
58120
  const src = [];
58036
58121
  src.push("#version 300 es");
58037
58122
  src.push("// Batched geometry edges drawing vertex shader");
@@ -58100,7 +58185,7 @@ class TrianglesBatchingEdgesColorRenderer extends VBOSceneModelTriangleBatchingE
58100
58185
  _buildFragmentShader() {
58101
58186
  const scene = this._scene;
58102
58187
  const sectionPlanesState = scene._sectionPlanesState;
58103
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
58188
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58104
58189
  const src = [];
58105
58190
  src.push("#version 300 es");
58106
58191
  src.push("// Batched geometry edges drawing fragment shader");
@@ -58119,7 +58204,7 @@ class TrianglesBatchingEdgesColorRenderer extends VBOSceneModelTriangleBatchingE
58119
58204
  if (clipping) {
58120
58205
  src.push("in vec4 vWorldPosition;");
58121
58206
  src.push("in float vFlags;");
58122
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
58207
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
58123
58208
  src.push("uniform bool sectionPlaneActive" + i + ";");
58124
58209
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58125
58210
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58132,7 +58217,7 @@ class TrianglesBatchingEdgesColorRenderer extends VBOSceneModelTriangleBatchingE
58132
58217
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58133
58218
  src.push(" if (clippable) {");
58134
58219
  src.push(" float dist = 0.0;");
58135
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
58220
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
58136
58221
  src.push("if (sectionPlaneActive" + i + ") {");
58137
58222
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58138
58223
  src.push("}");
@@ -58156,7 +58241,7 @@ class TrianglesBatchingPickMeshRenderer extends VBOSceneModelTriangleBatchingRen
58156
58241
 
58157
58242
  _buildVertexShader() {
58158
58243
  const scene = this._scene;
58159
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
58244
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58160
58245
  const src = [];
58161
58246
  src.push("#version 300 es");
58162
58247
  src.push("// Batched geometry picking vertex shader");
@@ -58228,7 +58313,7 @@ class TrianglesBatchingPickMeshRenderer extends VBOSceneModelTriangleBatchingRen
58228
58313
  _buildFragmentShader() {
58229
58314
  const scene = this._scene;
58230
58315
  const sectionPlanesState = scene._sectionPlanesState;
58231
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
58316
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58232
58317
  const src = [];
58233
58318
  src.push("#version 300 es");
58234
58319
  src.push("// Batched geometry picking fragment shader");
@@ -58248,7 +58333,7 @@ class TrianglesBatchingPickMeshRenderer extends VBOSceneModelTriangleBatchingRen
58248
58333
  if (clipping) {
58249
58334
  src.push("in vec4 vWorldPosition;");
58250
58335
  src.push("in float vFlags;");
58251
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58336
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58252
58337
  src.push("uniform bool sectionPlaneActive" + i + ";");
58253
58338
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58254
58339
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58261,7 +58346,7 @@ class TrianglesBatchingPickMeshRenderer extends VBOSceneModelTriangleBatchingRen
58261
58346
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58262
58347
  src.push(" if (clippable) {");
58263
58348
  src.push(" float dist = 0.0;");
58264
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58349
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58265
58350
  src.push(" if (sectionPlaneActive" + i + ") {");
58266
58351
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58267
58352
  src.push(" }");
@@ -58286,7 +58371,7 @@ class TrianglesBatchingPickDepthRenderer extends VBOSceneModelTriangleBatchingRe
58286
58371
  _buildVertexShader() {
58287
58372
 
58288
58373
  const scene = this._scene;
58289
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
58374
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58290
58375
  const src = [];
58291
58376
  src.push("#version 300 es");
58292
58377
  src.push("// Triangles batching pick depth vertex shader");
@@ -58356,7 +58441,7 @@ class TrianglesBatchingPickDepthRenderer extends VBOSceneModelTriangleBatchingRe
58356
58441
 
58357
58442
  const scene = this._scene;
58358
58443
  const sectionPlanesState = scene._sectionPlanesState;
58359
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
58444
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58360
58445
  const src = [];
58361
58446
  src.push("#version 300 es");
58362
58447
  src.push("// Triangles batching pick depth fragment shader");
@@ -58383,7 +58468,7 @@ class TrianglesBatchingPickDepthRenderer extends VBOSceneModelTriangleBatchingRe
58383
58468
  if (clipping) {
58384
58469
  src.push("in vec4 vWorldPosition;");
58385
58470
  src.push("in float vFlags;");
58386
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58471
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58387
58472
  src.push("uniform bool sectionPlaneActive" + i + ";");
58388
58473
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58389
58474
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58403,7 +58488,7 @@ class TrianglesBatchingPickDepthRenderer extends VBOSceneModelTriangleBatchingRe
58403
58488
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58404
58489
  src.push(" if (clippable) {");
58405
58490
  src.push(" float dist = 0.0;");
58406
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58491
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58407
58492
  src.push(" if (sectionPlaneActive" + i + ") {");
58408
58493
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58409
58494
  src.push(" }");
@@ -58428,7 +58513,7 @@ class TrianglesBatchingPickNormalsRenderer extends VBOSceneModelTriangleBatching
58428
58513
 
58429
58514
  _buildVertexShader() {
58430
58515
  const scene = this._scene;
58431
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
58516
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58432
58517
  const src = [];
58433
58518
  src.push("#version 300 es");
58434
58519
  src.push("// Triangles batching pick normals vertex shader");
@@ -58499,7 +58584,7 @@ class TrianglesBatchingPickNormalsRenderer extends VBOSceneModelTriangleBatching
58499
58584
  _buildFragmentShader() {
58500
58585
  const scene = this._scene;
58501
58586
  const sectionPlanesState = scene._sectionPlanesState;
58502
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
58587
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58503
58588
  const src = [];
58504
58589
  src.push("#version 300 es");
58505
58590
  src.push("// Triangles batching pick normals fragment shader");
@@ -58519,7 +58604,7 @@ class TrianglesBatchingPickNormalsRenderer extends VBOSceneModelTriangleBatching
58519
58604
  if (clipping) {
58520
58605
  src.push("in vec4 vWorldPosition;");
58521
58606
  src.push("in float vFlags;");
58522
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58607
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58523
58608
  src.push("uniform bool sectionPlaneActive" + i + ";");
58524
58609
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58525
58610
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58532,7 +58617,7 @@ class TrianglesBatchingPickNormalsRenderer extends VBOSceneModelTriangleBatching
58532
58617
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58533
58618
  src.push(" if (clippable) {");
58534
58619
  src.push(" float dist = 0.0;");
58535
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58620
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58536
58621
  src.push(" if (sectionPlaneActive" + i + ") {");
58537
58622
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58538
58623
  src.push(" }");
@@ -58556,7 +58641,7 @@ class TrianglesBatchingOcclusionRenderer extends VBOSceneModelTriangleBatchingRe
58556
58641
 
58557
58642
  _buildVertexShader() {
58558
58643
  const scene = this._scene;
58559
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
58644
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58560
58645
  const src = [];
58561
58646
  src.push("#version 300 es");
58562
58647
  src.push("// Triangles batching occlusion vertex shader");
@@ -58605,7 +58690,7 @@ class TrianglesBatchingOcclusionRenderer extends VBOSceneModelTriangleBatchingRe
58605
58690
  _buildFragmentShader() {
58606
58691
  const scene = this._scene;
58607
58692
  const sectionPlanesState = scene._sectionPlanesState;
58608
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
58693
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58609
58694
  const src = [];
58610
58695
  src.push("#version 300 es");
58611
58696
  src.push("// Triangles batching occlusion fragment shader");
@@ -58620,7 +58705,7 @@ class TrianglesBatchingOcclusionRenderer extends VBOSceneModelTriangleBatchingRe
58620
58705
  if (clipping) {
58621
58706
  src.push("in vec4 vWorldPosition;");
58622
58707
  src.push("in float vFlags;");
58623
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58708
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58624
58709
  src.push("uniform bool sectionPlaneActive" + i + ";");
58625
58710
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58626
58711
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58632,7 +58717,7 @@ class TrianglesBatchingOcclusionRenderer extends VBOSceneModelTriangleBatchingRe
58632
58717
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58633
58718
  src.push(" if (clippable) {");
58634
58719
  src.push(" float dist = 0.0;");
58635
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58720
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58636
58721
  src.push(" if (sectionPlaneActive" + i + ") {");
58637
58722
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58638
58723
  src.push(" }");
@@ -58653,7 +58738,7 @@ class TrianglesBatchingDepthRenderer extends VBOSceneModelTriangleBatchingRender
58653
58738
 
58654
58739
  _buildVertexShader() {
58655
58740
  const scene = this._scene;
58656
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
58741
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58657
58742
  const src = [];
58658
58743
  src.push("#version 300 es");
58659
58744
  src.push("// Triangles batching depth vertex shader");
@@ -58713,7 +58798,7 @@ class TrianglesBatchingDepthRenderer extends VBOSceneModelTriangleBatchingRender
58713
58798
  _buildFragmentShader() {
58714
58799
  const scene = this._scene;
58715
58800
  const sectionPlanesState = scene._sectionPlanesState;
58716
- const clipping = (sectionPlanesState.sectionPlanes.length > 0);
58801
+ const clipping = (sectionPlanesState.getNumAllocatedSectionPlanes() > 0);
58717
58802
  const src = [];
58718
58803
  src.push("#version 300 es");
58719
58804
  src.push("// Triangles batching depth fragment shader");
@@ -58728,7 +58813,7 @@ class TrianglesBatchingDepthRenderer extends VBOSceneModelTriangleBatchingRender
58728
58813
  if (clipping) {
58729
58814
  src.push("in vec4 vWorldPosition;");
58730
58815
  src.push("in float vFlags;");
58731
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58816
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58732
58817
  src.push("uniform bool sectionPlaneActive" + i + ";");
58733
58818
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58734
58819
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58752,7 +58837,7 @@ class TrianglesBatchingDepthRenderer extends VBOSceneModelTriangleBatchingRender
58752
58837
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58753
58838
  src.push(" if (clippable) {");
58754
58839
  src.push(" float dist = 0.0;");
58755
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58840
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58756
58841
  src.push(" if (sectionPlaneActive" + i + ") {");
58757
58842
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58758
58843
  src.push(" }");
@@ -58777,7 +58862,7 @@ class TrianglesBatchingNormalsRenderer extends VBOSceneModelTriangleBatchingRend
58777
58862
 
58778
58863
  _buildVertexShader() {
58779
58864
  const scene = this._scene;
58780
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
58865
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58781
58866
  const src = [];
58782
58867
  src.push("#version 300 es");
58783
58868
  src.push("// Batched geometry normals vertex shader");
@@ -58848,7 +58933,7 @@ class TrianglesBatchingNormalsRenderer extends VBOSceneModelTriangleBatchingRend
58848
58933
  _buildFragmentShader() {
58849
58934
  const scene = this._scene;
58850
58935
  const sectionPlanesState = scene._sectionPlanesState;
58851
- const clipping = (sectionPlanesState.sectionPlanes.length > 0);
58936
+ const clipping = (sectionPlanesState.getNumAllocatedSectionPlanes() > 0);
58852
58937
  const src = [];
58853
58938
  src.push("#version 300 es");
58854
58939
  src.push("// Batched geometry normals fragment shader");
@@ -58872,7 +58957,7 @@ class TrianglesBatchingNormalsRenderer extends VBOSceneModelTriangleBatchingRend
58872
58957
  if (clipping) {
58873
58958
  src.push("in vec4 vWorldPosition;");
58874
58959
  src.push("in float vFlags;");
58875
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58960
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58876
58961
  src.push("uniform bool sectionPlaneActive" + i + ";");
58877
58962
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58878
58963
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58889,7 +58974,7 @@ class TrianglesBatchingNormalsRenderer extends VBOSceneModelTriangleBatchingRend
58889
58974
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58890
58975
  src.push(" if (clippable) {");
58891
58976
  src.push(" float dist = 0.0;");
58892
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58977
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58893
58978
  src.push(" if (sectionPlaneActive" + i + ") {");
58894
58979
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58895
58980
  src.push(" }");
@@ -58915,7 +59000,7 @@ class TrianglesBatchingShadowRenderer extends VBOSceneModelTriangleBatchingRende
58915
59000
 
58916
59001
  _buildVertexShader() {
58917
59002
  const scene = this._scene;
58918
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
59003
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58919
59004
  const src = [];
58920
59005
  src.push("#version 300 es");
58921
59006
  src.push("// Batched geometry shadow vertex shader");
@@ -58962,7 +59047,7 @@ class TrianglesBatchingShadowRenderer extends VBOSceneModelTriangleBatchingRende
58962
59047
  _buildFragmentShader() {
58963
59048
  const scene = this._scene;
58964
59049
  const sectionPlanesState = scene._sectionPlanesState;
58965
- const clipping = (sectionPlanesState.sectionPlanes.length > 0);
59050
+ const clipping = (sectionPlanesState.getNumAllocatedSectionPlanes() > 0);
58966
59051
  const src = [];
58967
59052
  src.push("#version 300 es");
58968
59053
  src.push("// Batched geometry shadow fragment shader");
@@ -58976,7 +59061,7 @@ class TrianglesBatchingShadowRenderer extends VBOSceneModelTriangleBatchingRende
58976
59061
  if (clipping) {
58977
59062
  src.push("in vec4 vWorldPosition;");
58978
59063
  src.push("in float vFlags;");
58979
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
59064
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58980
59065
  src.push("uniform bool sectionPlaneActive" + i + ";");
58981
59066
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58982
59067
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58997,7 +59082,7 @@ class TrianglesBatchingShadowRenderer extends VBOSceneModelTriangleBatchingRende
58997
59082
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58998
59083
  src.push(" if (clippable) {");
58999
59084
  src.push(" float dist = 0.0;");
59000
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
59085
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
59001
59086
  src.push(" if (sectionPlaneActive" + i + ") {");
59002
59087
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
59003
59088
  src.push(" }");
@@ -59033,7 +59118,7 @@ class TrianglesBatchingPBRRenderer extends VBOSceneModelTriangleBatchingRenderer
59033
59118
  const scene = this._scene;
59034
59119
  const sectionPlanesState = scene._sectionPlanesState;
59035
59120
  const lightsState = scene._lightsState;
59036
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
59121
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
59037
59122
  const clippingCaps = sectionPlanesState.clippingCaps;
59038
59123
 
59039
59124
  const src = [];
@@ -59163,7 +59248,7 @@ class TrianglesBatchingPBRRenderer extends VBOSceneModelTriangleBatchingRenderer
59163
59248
  const gammaOutput = scene.gammaOutput; // If set, then it expects that all textures and colors need to be outputted in premultiplied gamma. Default is false.
59164
59249
  const sectionPlanesState = scene._sectionPlanesState;
59165
59250
  const lightsState = scene._lightsState;
59166
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
59251
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
59167
59252
  const clippingCaps = sectionPlanesState.clippingCaps;
59168
59253
  const src = [];
59169
59254
 
@@ -59267,7 +59352,7 @@ class TrianglesBatchingPBRRenderer extends VBOSceneModelTriangleBatchingRenderer
59267
59352
  if (clippingCaps) {
59268
59353
  src.push("in vec4 vClipPosition;");
59269
59354
  }
59270
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
59355
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
59271
59356
  src.push("uniform bool sectionPlaneActive" + i + ";");
59272
59357
  src.push("uniform vec3 sectionPlanePos" + i + ";");
59273
59358
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -59440,7 +59525,7 @@ class TrianglesBatchingPBRRenderer extends VBOSceneModelTriangleBatchingRenderer
59440
59525
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
59441
59526
  src.push(" if (clippable) {");
59442
59527
  src.push(" float dist = 0.0;");
59443
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
59528
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
59444
59529
  src.push("if (sectionPlaneActive" + i + ") {");
59445
59530
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
59446
59531
  src.push("}");
@@ -59578,7 +59663,7 @@ class TrianglesBatchingPickNormalsFlatRenderer extends VBOSceneModelTriangleBatc
59578
59663
 
59579
59664
  _buildVertexShader() {
59580
59665
  const scene = this._scene;
59581
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
59666
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
59582
59667
  const src = [];
59583
59668
  src.push("#version 300 es");
59584
59669
  src.push("// Triangles batching pick flat normals vertex shader");
@@ -59637,7 +59722,7 @@ class TrianglesBatchingPickNormalsFlatRenderer extends VBOSceneModelTriangleBatc
59637
59722
  _buildFragmentShader() {
59638
59723
  const scene = this._scene;
59639
59724
  const sectionPlanesState = scene._sectionPlanesState;
59640
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
59725
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
59641
59726
  const src = [];
59642
59727
  src.push("#version 300 es");
59643
59728
  src.push("// Triangles batching pick flat normals fragment shader");
@@ -59657,7 +59742,7 @@ class TrianglesBatchingPickNormalsFlatRenderer extends VBOSceneModelTriangleBatc
59657
59742
  src.push("in vec4 vWorldPosition;");
59658
59743
  if (clipping) {
59659
59744
  src.push("in float vFlags;");
59660
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
59745
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
59661
59746
  src.push("uniform bool sectionPlaneActive" + i + ";");
59662
59747
  src.push("uniform vec3 sectionPlanePos" + i + ";");
59663
59748
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -59669,7 +59754,7 @@ class TrianglesBatchingPickNormalsFlatRenderer extends VBOSceneModelTriangleBatc
59669
59754
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
59670
59755
  src.push(" if (clippable) {");
59671
59756
  src.push(" float dist = 0.0;");
59672
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
59757
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
59673
59758
  src.push(" if (sectionPlaneActive" + i + ") {");
59674
59759
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
59675
59760
  src.push(" }");
@@ -59706,7 +59791,7 @@ class TrianglesBatchingColorTextureRenderer extends VBOSceneModelTriangleBatchin
59706
59791
 
59707
59792
  const scene = this._scene;
59708
59793
  const sectionPlanesState = scene._sectionPlanesState;
59709
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
59794
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
59710
59795
  const src = [];
59711
59796
  src.push("#version 300 es");
59712
59797
  src.push("// Triangles batching color texture vertex shader");
@@ -59783,7 +59868,7 @@ class TrianglesBatchingColorTextureRenderer extends VBOSceneModelTriangleBatchin
59783
59868
  const gammaOutput = scene.gammaOutput; // If set, then it expects that all textures and colors need to be outputted in premultiplied gamma. Default is false.
59784
59869
  const lightsState = scene._lightsState;
59785
59870
  const sectionPlanesState = scene._sectionPlanesState;
59786
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
59871
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
59787
59872
  const src = [];
59788
59873
  src.push("#version 300 es");
59789
59874
  src.push("// Triangles batching color texture fragment shader");
@@ -59833,7 +59918,7 @@ class TrianglesBatchingColorTextureRenderer extends VBOSceneModelTriangleBatchin
59833
59918
  if (clipping) {
59834
59919
  src.push("in vec4 vWorldPosition;");
59835
59920
  src.push("in float vFlags;");
59836
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
59921
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
59837
59922
  src.push("uniform bool sectionPlaneActive" + i + ";");
59838
59923
  src.push("uniform vec3 sectionPlanePos" + i + ";");
59839
59924
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -59870,7 +59955,7 @@ class TrianglesBatchingColorTextureRenderer extends VBOSceneModelTriangleBatchin
59870
59955
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
59871
59956
  src.push(" if (clippable) {");
59872
59957
  src.push(" float dist = 0.0;");
59873
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
59958
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
59874
59959
  src.push("if (sectionPlaneActive" + i + ") {");
59875
59960
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
59876
59961
  src.push("}");
@@ -60460,7 +60545,7 @@ function octDecodeVec2(oct) { // Decode an oct-encoded normal
60460
60545
  const tempVec3a$r = math.vec3();
60461
60546
  const tempVec3b$n = math.vec3();
60462
60547
  const tempVec3c$k = math.vec3();
60463
- const tempVec3d$g = math.vec3();
60548
+ const tempVec3d$8 = math.vec3();
60464
60549
  const tempMat4a$g = math.mat4();
60465
60550
 
60466
60551
  /**
@@ -60526,7 +60611,7 @@ class SnapBatchingDepthBufInitRenderer extends VBOSceneModelRenderer {
60526
60611
  rtcOrigin[1] += position[1];
60527
60612
  rtcOrigin[2] += position[2];
60528
60613
  rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a$g);
60529
- rtcCameraEye = tempVec3d$g;
60614
+ rtcCameraEye = tempVec3d$8;
60530
60615
  rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];
60531
60616
  rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];
60532
60617
  rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];
@@ -60601,7 +60686,7 @@ class SnapBatchingDepthBufInitRenderer extends VBOSceneModelRenderer {
60601
60686
 
60602
60687
  _buildVertexShader() {
60603
60688
  const scene = this._scene;
60604
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
60689
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
60605
60690
  const src = [];
60606
60691
  src.push ('#version 300 es');
60607
60692
  src.push("// VBO SnapBatchingDepthBufInitRenderer vertex shader");
@@ -60688,7 +60773,7 @@ class SnapBatchingDepthBufInitRenderer extends VBOSceneModelRenderer {
60688
60773
  _buildFragmentShader() {
60689
60774
  const scene = this._scene;
60690
60775
  const sectionPlanesState = scene._sectionPlanesState;
60691
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
60776
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
60692
60777
  const src = [];
60693
60778
  src.push ('#version 300 es');
60694
60779
  src.push("// VBO SnapBatchingDepthBufInitRenderer fragment shader");
@@ -60710,7 +60795,7 @@ class SnapBatchingDepthBufInitRenderer extends VBOSceneModelRenderer {
60710
60795
  src.push("flat in vec4 vPickColor;");
60711
60796
  if (clipping) {
60712
60797
  src.push("in float vFlags;");
60713
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
60798
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
60714
60799
  src.push("uniform bool sectionPlaneActive" + i + ";");
60715
60800
  src.push("uniform vec3 sectionPlanePos" + i + ";");
60716
60801
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -60725,7 +60810,7 @@ class SnapBatchingDepthBufInitRenderer extends VBOSceneModelRenderer {
60725
60810
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
60726
60811
  src.push(" if (clippable) {");
60727
60812
  src.push(" float dist = 0.0;");
60728
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
60813
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
60729
60814
  src.push(" if (sectionPlaneActive" + i + ") {");
60730
60815
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
60731
60816
  src.push(" }");
@@ -60765,7 +60850,7 @@ class SnapBatchingDepthBufInitRenderer extends VBOSceneModelRenderer {
60765
60850
  const tempVec3a$q = math.vec3();
60766
60851
  const tempVec3b$m = math.vec3();
60767
60852
  const tempVec3c$j = math.vec3();
60768
- const tempVec3d$f = math.vec3();
60853
+ const tempVec3d$7 = math.vec3();
60769
60854
  const tempMat4a$f = math.mat4();
60770
60855
 
60771
60856
  /**
@@ -60835,7 +60920,7 @@ class SnapBatchingDepthRenderer extends VBOSceneModelRenderer{
60835
60920
  rtcOrigin[1] += position[1];
60836
60921
  rtcOrigin[2] += position[2];
60837
60922
  rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a$f);
60838
- rtcCameraEye = tempVec3d$f;
60923
+ rtcCameraEye = tempVec3d$7;
60839
60924
  rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];
60840
60925
  rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];
60841
60926
  rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];
@@ -60916,7 +61001,7 @@ class SnapBatchingDepthRenderer extends VBOSceneModelRenderer{
60916
61001
 
60917
61002
  _buildVertexShader() {
60918
61003
  const scene = this._scene;
60919
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
61004
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
60920
61005
  scene.pointsMaterial._state;
60921
61006
  const src = [];
60922
61007
  src.push ('#version 300 es');
@@ -61003,7 +61088,7 @@ class SnapBatchingDepthRenderer extends VBOSceneModelRenderer{
61003
61088
  _buildFragmentShader() {
61004
61089
  const scene = this._scene;
61005
61090
  const sectionPlanesState = scene._sectionPlanesState;
61006
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
61091
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
61007
61092
  const src = [];
61008
61093
  src.push ('#version 300 es');
61009
61094
  src.push("// SnapBatchingDepthRenderer fragment shader");
@@ -61024,7 +61109,7 @@ class SnapBatchingDepthRenderer extends VBOSceneModelRenderer{
61024
61109
  if (clipping) {
61025
61110
  src.push("in vec4 vWorldPosition;");
61026
61111
  src.push("in float vFlags;");
61027
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
61112
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
61028
61113
  src.push("uniform bool sectionPlaneActive" + i + ";");
61029
61114
  src.push("uniform vec3 sectionPlanePos" + i + ";");
61030
61115
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -61037,7 +61122,7 @@ class SnapBatchingDepthRenderer extends VBOSceneModelRenderer{
61037
61122
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
61038
61123
  src.push(" if (clippable) {");
61039
61124
  src.push(" float dist = 0.0;");
61040
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
61125
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
61041
61126
  src.push(" if (sectionPlaneActive" + i + ") {");
61042
61127
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
61043
61128
  src.push(" }");
@@ -61158,8 +61243,8 @@ math.OBB3();
61158
61243
  const tempVec3a$p = math.vec3();
61159
61244
  const tempVec3b$l = math.vec3();
61160
61245
  const tempVec3c$i = math.vec3();
61161
- const tempVec3d$e = math.vec3();
61162
- const tempVec3e$3 = math.vec3();
61246
+ const tempVec3d$6 = math.vec3();
61247
+ const tempVec3e$1 = math.vec3();
61163
61248
  const tempVec3f$1 = math.vec3();
61164
61249
  const tempVec3g$1 = math.vec3();
61165
61250
 
@@ -62350,8 +62435,8 @@ class TrianglesBatchingLayer {
62350
62435
 
62351
62436
  math.transformRay(this.model.worldNormalMatrix, rtcRayOrigin, rtcRayDir, rtcRayOrigin, rtcRayDir); // RTC -> local
62352
62437
 
62353
- const a = tempVec3d$e;
62354
- const b = tempVec3e$3;
62438
+ const a = tempVec3d$6;
62439
+ const b = tempVec3e$1;
62355
62440
  const c = tempVec3f$1;
62356
62441
 
62357
62442
  let gotIntersect = false;
@@ -62474,7 +62559,7 @@ class TrianglesInstancingColorRenderer extends VBOSceneModelTriangleInstancingRe
62474
62559
  const scene = this._scene;
62475
62560
  const sectionPlanesState = scene._sectionPlanesState;
62476
62561
  const lightsState = scene._lightsState;
62477
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
62562
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
62478
62563
  let i;
62479
62564
  let len;
62480
62565
  let light;
@@ -62626,7 +62711,7 @@ class TrianglesInstancingColorRenderer extends VBOSceneModelTriangleInstancingRe
62626
62711
  _buildFragmentShader() {
62627
62712
  const scene = this._scene;
62628
62713
  const sectionPlanesState = scene._sectionPlanesState;
62629
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
62714
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
62630
62715
  const src = [];
62631
62716
  src.push("#version 300 es");
62632
62717
  src.push("// Instancing geometry drawing fragment shader");
@@ -62659,7 +62744,7 @@ class TrianglesInstancingColorRenderer extends VBOSceneModelTriangleInstancingRe
62659
62744
  if (clipping) {
62660
62745
  src.push("in vec4 vWorldPosition;");
62661
62746
  src.push("in float vFlags;");
62662
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
62747
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
62663
62748
  src.push("uniform bool sectionPlaneActive" + i + ";");
62664
62749
  src.push("uniform vec3 sectionPlanePos" + i + ";");
62665
62750
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -62673,7 +62758,7 @@ class TrianglesInstancingColorRenderer extends VBOSceneModelTriangleInstancingRe
62673
62758
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
62674
62759
  src.push(" if (clippable) {");
62675
62760
  src.push(" float dist = 0.0;");
62676
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
62761
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
62677
62762
  src.push("if (sectionPlaneActive" + i + ") {");
62678
62763
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
62679
62764
  src.push("}");
@@ -62719,7 +62804,7 @@ class TrianglesInstancingFlatColorRenderer extends VBOSceneModelTriangleInstanci
62719
62804
  _buildVertexShader() {
62720
62805
  const scene = this._scene;
62721
62806
  const sectionPlanesState = scene._sectionPlanesState;
62722
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
62807
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
62723
62808
  const src = [];
62724
62809
  src.push("#version 300 es");
62725
62810
  src.push("// Instancing geometry flat-shading drawing vertex shader");
@@ -62801,7 +62886,7 @@ class TrianglesInstancingFlatColorRenderer extends VBOSceneModelTriangleInstanci
62801
62886
  const lightsState = scene._lightsState;
62802
62887
  let i;
62803
62888
  let len;
62804
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
62889
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
62805
62890
  const src = [];
62806
62891
  src.push("#version 300 es");
62807
62892
  src.push("// Instancing geometry flat-shading drawing fragment shader");
@@ -62834,7 +62919,7 @@ class TrianglesInstancingFlatColorRenderer extends VBOSceneModelTriangleInstanci
62834
62919
  if (clipping) {
62835
62920
  src.push("in vec4 vWorldPosition;");
62836
62921
  src.push("in float vFlags;");
62837
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
62922
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
62838
62923
  src.push("uniform bool sectionPlaneActive" + i + ";");
62839
62924
  src.push("uniform vec3 sectionPlanePos" + i + ";");
62840
62925
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -62873,7 +62958,7 @@ class TrianglesInstancingFlatColorRenderer extends VBOSceneModelTriangleInstanci
62873
62958
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
62874
62959
  src.push(" if (clippable) {");
62875
62960
  src.push(" float dist = 0.0;");
62876
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
62961
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
62877
62962
  src.push("if (sectionPlaneActive" + i + ") {");
62878
62963
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
62879
62964
  src.push("}");
@@ -62961,7 +63046,7 @@ class TrianglesInstancingSilhouetteRenderer extends VBOSceneModelTriangleInstanc
62961
63046
  _buildVertexShader() {
62962
63047
  const scene = this._scene;
62963
63048
  const sectionPlanesState = scene._sectionPlanesState;
62964
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63049
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
62965
63050
  const src = [];
62966
63051
  src.push("#version 300 es");
62967
63052
  src.push("// Instancing silhouette vertex shader");
@@ -63036,7 +63121,7 @@ class TrianglesInstancingSilhouetteRenderer extends VBOSceneModelTriangleInstanc
63036
63121
  _buildFragmentShader() {
63037
63122
  const scene = this._scene;
63038
63123
  const sectionPlanesState = scene._sectionPlanesState;
63039
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63124
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63040
63125
  const src = [];
63041
63126
  src.push("#version 300 es");
63042
63127
  src.push("// Instancing fill fragment shader");
@@ -63056,7 +63141,7 @@ class TrianglesInstancingSilhouetteRenderer extends VBOSceneModelTriangleInstanc
63056
63141
  if (clipping) {
63057
63142
  src.push("in vec4 vWorldPosition;");
63058
63143
  src.push("in float vFlags;");
63059
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
63144
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63060
63145
  src.push("uniform bool sectionPlaneActive" + i + ";");
63061
63146
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63062
63147
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63069,7 +63154,7 @@ class TrianglesInstancingSilhouetteRenderer extends VBOSceneModelTriangleInstanc
63069
63154
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63070
63155
  src.push(" if (clippable) {");
63071
63156
  src.push(" float dist = 0.0;");
63072
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
63157
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63073
63158
  src.push("if (sectionPlaneActive" + i + ") {");
63074
63159
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63075
63160
  src.push("}");
@@ -63098,7 +63183,7 @@ class TrianglesInstancingEdgesRenderer extends VBOSceneModelTriangleInstancingEd
63098
63183
  _buildVertexShader() {
63099
63184
  const scene = this._scene;
63100
63185
  const sectionPlanesState = scene._sectionPlanesState;
63101
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63186
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63102
63187
  const src = [];
63103
63188
  src.push("#version 300 es");
63104
63189
  src.push("// Triangles instancing edges vertex shader");
@@ -63167,7 +63252,7 @@ class TrianglesInstancingEdgesRenderer extends VBOSceneModelTriangleInstancingEd
63167
63252
  _buildFragmentShader() {
63168
63253
  const scene = this._scene;
63169
63254
  const sectionPlanesState = scene._sectionPlanesState;
63170
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63255
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63171
63256
  const src = [];
63172
63257
  src.push("#version 300 es");
63173
63258
  src.push("// Batched geometry edges drawing fragment shader");
@@ -63187,7 +63272,7 @@ class TrianglesInstancingEdgesRenderer extends VBOSceneModelTriangleInstancingEd
63187
63272
  if (clipping) {
63188
63273
  src.push("in vec4 vWorldPosition;");
63189
63274
  src.push("in float vFlags;");
63190
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
63275
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63191
63276
  src.push("uniform bool sectionPlaneActive" + i + ";");
63192
63277
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63193
63278
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63200,7 +63285,7 @@ class TrianglesInstancingEdgesRenderer extends VBOSceneModelTriangleInstancingEd
63200
63285
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63201
63286
  src.push(" if (clippable) {");
63202
63287
  src.push(" float dist = 0.0;");
63203
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
63288
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63204
63289
  src.push("if (sectionPlaneActive" + i + ") {");
63205
63290
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63206
63291
  src.push("}");
@@ -63225,7 +63310,7 @@ class TrianglesInstancingEdgesColorRenderer extends VBOSceneModelTriangleInstanc
63225
63310
  _buildVertexShader() {
63226
63311
  const scene = this._scene;
63227
63312
  const sectionPlanesState = scene._sectionPlanesState;
63228
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63313
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63229
63314
  const src = [];
63230
63315
  src.push("#version 300 es");
63231
63316
  src.push("// Triangles instancing edges vertex shader");
@@ -63295,7 +63380,7 @@ class TrianglesInstancingEdgesColorRenderer extends VBOSceneModelTriangleInstanc
63295
63380
  _buildFragmentShader() {
63296
63381
  const scene = this._scene;
63297
63382
  const sectionPlanesState = scene._sectionPlanesState;
63298
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63383
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63299
63384
  const src = [];
63300
63385
  src.push("#version 300 es");
63301
63386
  src.push("// Batched geometry edges drawing fragment shader");
@@ -63315,7 +63400,7 @@ class TrianglesInstancingEdgesColorRenderer extends VBOSceneModelTriangleInstanc
63315
63400
  if (clipping) {
63316
63401
  src.push("in vec4 vWorldPosition;");
63317
63402
  src.push("in float vFlags;");
63318
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
63403
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63319
63404
  src.push("uniform bool sectionPlaneActive" + i + ";");
63320
63405
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63321
63406
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63328,7 +63413,7 @@ class TrianglesInstancingEdgesColorRenderer extends VBOSceneModelTriangleInstanc
63328
63413
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63329
63414
  src.push(" if (clippable) {");
63330
63415
  src.push(" float dist = 0.0;");
63331
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
63416
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63332
63417
  src.push("if (sectionPlaneActive" + i + ") {");
63333
63418
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63334
63419
  src.push("}");
@@ -63353,7 +63438,7 @@ class TrianglesInstancingPickMeshRenderer extends VBOSceneModelTriangleInstancin
63353
63438
  _buildVertexShader() {
63354
63439
  const scene = this._scene;
63355
63440
  const sectionPlanesState = scene._sectionPlanesState;
63356
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63441
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63357
63442
  const src = [];
63358
63443
  src.push("#version 300 es");
63359
63444
  src.push("// Instancing geometry picking vertex shader");
@@ -63429,7 +63514,7 @@ class TrianglesInstancingPickMeshRenderer extends VBOSceneModelTriangleInstancin
63429
63514
  _buildFragmentShader() {
63430
63515
  const scene = this._scene;
63431
63516
  const sectionPlanesState = scene._sectionPlanesState;
63432
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63517
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63433
63518
  const src = [];
63434
63519
  src.push("#version 300 es");
63435
63520
  src.push("// Batched geometry picking fragment shader");
@@ -63449,7 +63534,7 @@ class TrianglesInstancingPickMeshRenderer extends VBOSceneModelTriangleInstancin
63449
63534
  if (clipping) {
63450
63535
  src.push("in vec4 vWorldPosition;");
63451
63536
  src.push("in float vFlags;");
63452
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63537
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63453
63538
  src.push("uniform bool sectionPlaneActive" + i + ";");
63454
63539
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63455
63540
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63462,7 +63547,7 @@ class TrianglesInstancingPickMeshRenderer extends VBOSceneModelTriangleInstancin
63462
63547
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63463
63548
  src.push(" if (clippable) {");
63464
63549
  src.push(" float dist = 0.0;");
63465
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63550
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63466
63551
  src.push("if (sectionPlaneActive" + i + ") {");
63467
63552
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63468
63553
  src.push("}");
@@ -63487,7 +63572,7 @@ class TrianglesInstancingPickDepthRenderer extends VBOSceneModelTriangleInstanci
63487
63572
  _buildVertexShader() {
63488
63573
  const scene = this._scene;
63489
63574
  const sectionPlanesState = scene._sectionPlanesState;
63490
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63575
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63491
63576
  const src = [];
63492
63577
  src.push("#version 300 es");
63493
63578
  src.push("// Instancing geometry depth vertex shader");
@@ -63563,7 +63648,7 @@ class TrianglesInstancingPickDepthRenderer extends VBOSceneModelTriangleInstanci
63563
63648
  _buildFragmentShader() {
63564
63649
  const scene = this._scene;
63565
63650
  const sectionPlanesState = scene._sectionPlanesState;
63566
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63651
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63567
63652
  const src = [];
63568
63653
  src.push("#version 300 es");
63569
63654
  src.push("// Batched geometry depth fragment shader");
@@ -63589,7 +63674,7 @@ class TrianglesInstancingPickDepthRenderer extends VBOSceneModelTriangleInstanci
63589
63674
  if (clipping) {
63590
63675
  src.push("in vec4 vWorldPosition;");
63591
63676
  src.push("in float vFlags;");
63592
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63677
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63593
63678
  src.push("uniform bool sectionPlaneActive" + i + ";");
63594
63679
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63595
63680
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63609,7 +63694,7 @@ class TrianglesInstancingPickDepthRenderer extends VBOSceneModelTriangleInstanci
63609
63694
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63610
63695
  src.push(" if (clippable) {");
63611
63696
  src.push(" float dist = 0.0;");
63612
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63697
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63613
63698
  src.push("if (sectionPlaneActive" + i + ") {");
63614
63699
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63615
63700
  src.push("}");
@@ -63635,7 +63720,7 @@ class TrianglesInstancingPickNormalsRenderer extends VBOSceneModelTriangleInstan
63635
63720
  _buildVertexShader() {
63636
63721
  const scene = this._scene;
63637
63722
  const sectionPlanesState = scene._sectionPlanesState;
63638
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63723
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63639
63724
  const src = [];
63640
63725
  src.push("#version 300 es");
63641
63726
  src.push("// Instancing geometry normals vertex shader");
@@ -63716,7 +63801,7 @@ class TrianglesInstancingPickNormalsRenderer extends VBOSceneModelTriangleInstan
63716
63801
  _buildFragmentShader() {
63717
63802
  const scene = this._scene;
63718
63803
  const sectionPlanesState = scene._sectionPlanesState;
63719
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63804
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63720
63805
  const src = [];
63721
63806
  src.push("#version 300 es");
63722
63807
  src.push("// Batched geometry normals fragment shader");
@@ -63740,7 +63825,7 @@ class TrianglesInstancingPickNormalsRenderer extends VBOSceneModelTriangleInstan
63740
63825
  if (clipping) {
63741
63826
  src.push("in vec4 vWorldPosition;");
63742
63827
  src.push("in float vFlags;");
63743
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63828
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63744
63829
  src.push("uniform bool sectionPlaneActive" + i + ";");
63745
63830
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63746
63831
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63753,7 +63838,7 @@ class TrianglesInstancingPickNormalsRenderer extends VBOSceneModelTriangleInstan
63753
63838
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63754
63839
  src.push(" if (clippable) {");
63755
63840
  src.push(" float dist = 0.0;");
63756
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63841
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63757
63842
  src.push("if (sectionPlaneActive" + i + ") {");
63758
63843
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63759
63844
  src.push("}");
@@ -63778,7 +63863,7 @@ class TrianglesInstancingOcclusionRenderer extends VBOSceneModelTriangleInstanci
63778
63863
  _buildVertexShader() {
63779
63864
  const scene = this._scene;
63780
63865
  const sectionPlanesState = scene._sectionPlanesState;
63781
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63866
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63782
63867
  const src = [];
63783
63868
  src.push("#version 300 es");
63784
63869
  src.push("// TrianglesInstancingOcclusionRenderer vertex shader");
@@ -63829,7 +63914,7 @@ class TrianglesInstancingOcclusionRenderer extends VBOSceneModelTriangleInstanci
63829
63914
  _buildFragmentShader() {
63830
63915
  const scene = this._scene;
63831
63916
  const sectionPlanesState = scene._sectionPlanesState;
63832
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63917
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63833
63918
  const src = [];
63834
63919
  src.push("#version 300 es");
63835
63920
  src.push("// TrianglesInstancingOcclusionRenderer fragment shader");
@@ -63844,7 +63929,7 @@ class TrianglesInstancingOcclusionRenderer extends VBOSceneModelTriangleInstanci
63844
63929
  if (clipping) {
63845
63930
  src.push("in vec4 vWorldPosition;");
63846
63931
  src.push("in float vFlags;");
63847
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63932
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63848
63933
  src.push("uniform bool sectionPlaneActive" + i + ";");
63849
63934
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63850
63935
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63856,7 +63941,7 @@ class TrianglesInstancingOcclusionRenderer extends VBOSceneModelTriangleInstanci
63856
63941
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63857
63942
  src.push(" if (clippable) {");
63858
63943
  src.push(" float dist = 0.0;");
63859
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63944
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63860
63945
  src.push("if (sectionPlaneActive" + i + ") {");
63861
63946
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63862
63947
  src.push("}");
@@ -63878,7 +63963,7 @@ class TrianglesInstancingDepthRenderer extends VBOSceneModelTriangleInstancingRe
63878
63963
  _buildVertexShader() {
63879
63964
  const scene = this._scene;
63880
63965
  const sectionPlanesState = scene._sectionPlanesState;
63881
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63966
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63882
63967
  const src = [];
63883
63968
  src.push("#version 300 es");
63884
63969
  src.push("// Instancing geometry depth drawing vertex shader");
@@ -63946,7 +64031,7 @@ class TrianglesInstancingDepthRenderer extends VBOSceneModelTriangleInstancingRe
63946
64031
  const sectionPlanesState = scene._sectionPlanesState;
63947
64032
  let i;
63948
64033
  let len;
63949
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64034
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63950
64035
  const src = [];
63951
64036
  src.push("#version 300 es");
63952
64037
  src.push("// Instancing geometry depth drawing fragment shader");
@@ -63961,7 +64046,7 @@ class TrianglesInstancingDepthRenderer extends VBOSceneModelTriangleInstancingRe
63961
64046
  if (clipping) {
63962
64047
  src.push("in vec4 vWorldPosition;");
63963
64048
  src.push("in float vFlags;");
63964
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64049
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63965
64050
  src.push("uniform bool sectionPlaneActive" + i + ";");
63966
64051
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63967
64052
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63974,7 +64059,7 @@ class TrianglesInstancingDepthRenderer extends VBOSceneModelTriangleInstancingRe
63974
64059
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63975
64060
  src.push(" if (clippable) {");
63976
64061
  src.push(" float dist = 0.0;");
63977
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64062
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63978
64063
  src.push("if (sectionPlaneActive" + i + ") {");
63979
64064
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63980
64065
  src.push("}");
@@ -64000,7 +64085,7 @@ class TrianglesInstancingNormalsRenderer extends VBOSceneModelTriangleInstancing
64000
64085
  _buildVertexShader() {
64001
64086
  const scene = this._scene;
64002
64087
  const sectionPlanesState = scene._sectionPlanesState;
64003
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64088
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64004
64089
  const src = [];
64005
64090
  src.push("#version 300 es");
64006
64091
  src.push("// Instancing geometry normals drawing vertex shader");
@@ -64076,7 +64161,7 @@ class TrianglesInstancingNormalsRenderer extends VBOSceneModelTriangleInstancing
64076
64161
  _buildFragmentShader() {
64077
64162
  const scene = this._scene;
64078
64163
  const sectionPlanesState = scene._sectionPlanesState;
64079
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64164
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64080
64165
  const src = [];
64081
64166
  src.push("#version 300 es");
64082
64167
  src.push("// Instancing geometry depth drawing fragment shader");
@@ -64096,7 +64181,7 @@ class TrianglesInstancingNormalsRenderer extends VBOSceneModelTriangleInstancing
64096
64181
  if (clipping) {
64097
64182
  src.push("in vec4 vWorldPosition;");
64098
64183
  src.push("in float vFlags;");
64099
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64184
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
64100
64185
  src.push("uniform bool sectionPlaneActive" + i + ";");
64101
64186
  src.push("uniform vec3 sectionPlanePos" + i + ";");
64102
64187
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -64112,7 +64197,7 @@ class TrianglesInstancingNormalsRenderer extends VBOSceneModelTriangleInstancing
64112
64197
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
64113
64198
  src.push(" if (clippable) {");
64114
64199
  src.push(" float dist = 0.0;");
64115
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64200
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
64116
64201
  src.push("if (sectionPlaneActive" + i + ") {");
64117
64202
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
64118
64203
  src.push("}");
@@ -64139,7 +64224,7 @@ class TrianglesInstancingShadowRenderer extends VBOSceneModelTriangleInstancingR
64139
64224
  _buildVertexShader() {
64140
64225
  const scene = this._scene;
64141
64226
  const sectionPlanesState = scene._sectionPlanesState;
64142
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64227
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64143
64228
  const src = [];
64144
64229
  src.push("#version 300 es");
64145
64230
  src.push("// Instancing geometry shadow drawing vertex shader");
@@ -64188,7 +64273,7 @@ class TrianglesInstancingShadowRenderer extends VBOSceneModelTriangleInstancingR
64188
64273
  _buildFragmentShader() {
64189
64274
  const scene = this._scene;
64190
64275
  const sectionPlanesState = scene._sectionPlanesState;
64191
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64276
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64192
64277
  const src = [];
64193
64278
  src.push("#version 300 es");
64194
64279
  src.push("// Instancing geometry depth drawing fragment shader");
@@ -64207,7 +64292,7 @@ class TrianglesInstancingShadowRenderer extends VBOSceneModelTriangleInstancingR
64207
64292
  if (clipping) {
64208
64293
  src.push("in vec4 vWorldPosition;");
64209
64294
  src.push("in float vFlags;");
64210
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64295
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
64211
64296
  src.push("uniform bool sectionPlaneActive" + i + ";");
64212
64297
  src.push("uniform vec3 sectionPlanePos" + i + ";");
64213
64298
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -64223,7 +64308,7 @@ class TrianglesInstancingShadowRenderer extends VBOSceneModelTriangleInstancingR
64223
64308
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
64224
64309
  src.push(" if (clippable) {");
64225
64310
  src.push(" float dist = 0.0;");
64226
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64311
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
64227
64312
  src.push("if (sectionPlaneActive" + i + ") {");
64228
64313
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
64229
64314
  src.push("}");
@@ -64262,7 +64347,7 @@ class TrianglesInstancingPBRRenderer extends VBOSceneModelTriangleInstancingRend
64262
64347
  const scene = this._scene;
64263
64348
  const sectionPlanesState = scene._sectionPlanesState;
64264
64349
  const lightsState = scene._lightsState;
64265
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64350
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64266
64351
  const clippingCaps = sectionPlanesState.clippingCaps;
64267
64352
  const src = [];
64268
64353
  src.push("#version 300 es");
@@ -64388,7 +64473,7 @@ class TrianglesInstancingPBRRenderer extends VBOSceneModelTriangleInstancingRend
64388
64473
  const gammaOutput = scene.gammaOutput; // If set, then it expects that all textures and colors need to be outputted in premultiplied gamma. Default is false.
64389
64474
  const sectionPlanesState = scene._sectionPlanesState;
64390
64475
  const lightsState = scene._lightsState;
64391
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64476
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64392
64477
  const clippingCaps = sectionPlanesState.clippingCaps;
64393
64478
  const src = [];
64394
64479
  src.push("#version 300 es");
@@ -64478,7 +64563,7 @@ class TrianglesInstancingPBRRenderer extends VBOSceneModelTriangleInstancingRend
64478
64563
  if (clippingCaps) {
64479
64564
  src.push("in vec4 vClipPosition;");
64480
64565
  }
64481
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64566
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
64482
64567
  src.push("uniform bool sectionPlaneActive" + i + ";");
64483
64568
  src.push("uniform vec3 sectionPlanePos" + i + ";");
64484
64569
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -64667,7 +64752,7 @@ class TrianglesInstancingPBRRenderer extends VBOSceneModelTriangleInstancingRend
64667
64752
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
64668
64753
  src.push(" if (clippable) {");
64669
64754
  src.push(" float dist = 0.0;");
64670
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64755
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
64671
64756
  src.push("if (sectionPlaneActive" + i + ") {");
64672
64757
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
64673
64758
  src.push("}");
@@ -64807,7 +64892,7 @@ class TrianglesInstancingPickNormalsFlatRenderer extends VBOSceneModelTriangleIn
64807
64892
  _buildVertexShader() {
64808
64893
  const scene = this._scene;
64809
64894
  const sectionPlanesState = scene._sectionPlanesState;
64810
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64895
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64811
64896
  const src = [];
64812
64897
  src.push("#version 300 es");
64813
64898
  src.push("// Instancing geometry normals vertex shader");
@@ -64874,7 +64959,7 @@ class TrianglesInstancingPickNormalsFlatRenderer extends VBOSceneModelTriangleIn
64874
64959
  _buildFragmentShader() {
64875
64960
  const scene = this._scene;
64876
64961
  const sectionPlanesState = scene._sectionPlanesState;
64877
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64962
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64878
64963
  const src = [];
64879
64964
  src.push("#version 300 es");
64880
64965
  src.push("// Batched geometry normals fragment shader");
@@ -64895,7 +64980,7 @@ class TrianglesInstancingPickNormalsFlatRenderer extends VBOSceneModelTriangleIn
64895
64980
  src.push("in vec4 vWorldPosition;");
64896
64981
  if (clipping) {
64897
64982
  src.push("in float vFlags;");
64898
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
64983
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
64899
64984
  src.push("uniform bool sectionPlaneActive" + i + ";");
64900
64985
  src.push("uniform vec3 sectionPlanePos" + i + ";");
64901
64986
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -64907,7 +64992,7 @@ class TrianglesInstancingPickNormalsFlatRenderer extends VBOSceneModelTriangleIn
64907
64992
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
64908
64993
  src.push(" if (clippable) {");
64909
64994
  src.push(" float dist = 0.0;");
64910
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
64995
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
64911
64996
  src.push("if (sectionPlaneActive" + i + ") {");
64912
64997
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
64913
64998
  src.push("}");
@@ -64943,7 +65028,7 @@ class TrianglesInstancingColorTextureRenderer extends VBOSceneModelTriangleInsta
64943
65028
  _buildVertexShader() {
64944
65029
  const scene = this._scene;
64945
65030
  const sectionPlanesState = scene._sectionPlanesState;
64946
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
65031
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64947
65032
  const src = [];
64948
65033
  src.push("#version 300 es");
64949
65034
  src.push("// Instancing geometry drawing vertex shader");
@@ -65030,7 +65115,7 @@ class TrianglesInstancingColorTextureRenderer extends VBOSceneModelTriangleInsta
65030
65115
  const lightsState = scene._lightsState;
65031
65116
  let i;
65032
65117
  let len;
65033
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
65118
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
65034
65119
  const src = [];
65035
65120
  src.push("#version 300 es");
65036
65121
  src.push("// Instancing geometry drawing fragment shader");
@@ -65079,7 +65164,7 @@ class TrianglesInstancingColorTextureRenderer extends VBOSceneModelTriangleInsta
65079
65164
  if (clipping) {
65080
65165
  src.push("in vec4 vWorldPosition;");
65081
65166
  src.push("in float vFlags;");
65082
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
65167
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
65083
65168
  src.push("uniform bool sectionPlaneActive" + i + ";");
65084
65169
  src.push("uniform vec3 sectionPlanePos" + i + ";");
65085
65170
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -65117,7 +65202,7 @@ class TrianglesInstancingColorTextureRenderer extends VBOSceneModelTriangleInsta
65117
65202
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
65118
65203
  src.push(" if (clippable) {");
65119
65204
  src.push(" float dist = 0.0;");
65120
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
65205
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
65121
65206
  src.push("if (sectionPlaneActive" + i + ") {");
65122
65207
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
65123
65208
  src.push("}");
@@ -65529,7 +65614,7 @@ function getInstancingRenderers$1(scene) {
65529
65614
  const tempVec3a$o = math.vec3();
65530
65615
  const tempVec3b$k = math.vec3();
65531
65616
  const tempVec3c$h = math.vec3();
65532
- const tempVec3d$d = math.vec3();
65617
+ const tempVec3d$5 = math.vec3();
65533
65618
  const tempMat4a$e = math.mat4();
65534
65619
 
65535
65620
  /**
@@ -65598,7 +65683,7 @@ class SnapInstancingDepthBufInitRenderer extends VBOSceneModelRenderer {
65598
65683
  rtcOrigin[1] += position[1];
65599
65684
  rtcOrigin[2] += position[2];
65600
65685
  rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a$e);
65601
- rtcCameraEye = tempVec3d$d;
65686
+ rtcCameraEye = tempVec3d$5;
65602
65687
  rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];
65603
65688
  rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];
65604
65689
  rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];
@@ -65698,7 +65783,7 @@ class SnapInstancingDepthBufInitRenderer extends VBOSceneModelRenderer {
65698
65783
  _buildVertexShader() {
65699
65784
  const scene = this._scene;
65700
65785
  const sectionPlanesState = scene._sectionPlanesState;
65701
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
65786
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
65702
65787
  const src = [];
65703
65788
  src.push ('#version 300 es');
65704
65789
  src.push("// SnapInstancingDepthBufInitRenderer vertex shader");
@@ -65788,7 +65873,7 @@ class SnapInstancingDepthBufInitRenderer extends VBOSceneModelRenderer {
65788
65873
  _buildFragmentShader() {
65789
65874
  const scene = this._scene;
65790
65875
  const sectionPlanesState = scene._sectionPlanesState;
65791
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
65876
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
65792
65877
  const src = [];
65793
65878
  src.push ('#version 300 es');
65794
65879
  src.push("// Points instancing pick depth fragment shader");
@@ -65810,7 +65895,7 @@ class SnapInstancingDepthBufInitRenderer extends VBOSceneModelRenderer {
65810
65895
  src.push("flat in vec4 vPickColor;");
65811
65896
  if (clipping) {
65812
65897
  src.push("in float vFlags;");
65813
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
65898
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
65814
65899
  src.push("uniform bool sectionPlaneActive" + i + ";");
65815
65900
  src.push("uniform vec3 sectionPlanePos" + i + ";");
65816
65901
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -65825,7 +65910,7 @@ class SnapInstancingDepthBufInitRenderer extends VBOSceneModelRenderer {
65825
65910
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
65826
65911
  src.push(" if (clippable) {");
65827
65912
  src.push(" float dist = 0.0;");
65828
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
65913
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
65829
65914
  src.push("if (sectionPlaneActive" + i + ") {");
65830
65915
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
65831
65916
  src.push("}");
@@ -65865,7 +65950,7 @@ class SnapInstancingDepthBufInitRenderer extends VBOSceneModelRenderer {
65865
65950
  const tempVec3a$n = math.vec3();
65866
65951
  const tempVec3b$j = math.vec3();
65867
65952
  const tempVec3c$g = math.vec3();
65868
- const tempVec3d$c = math.vec3();
65953
+ const tempVec3d$4 = math.vec3();
65869
65954
  const tempMat4a$d = math.mat4();
65870
65955
 
65871
65956
  /**
@@ -65935,7 +66020,7 @@ class SnapInstancingDepthRenderer extends VBOSceneModelRenderer {
65935
66020
  rtcOrigin[1] += position[1];
65936
66021
  rtcOrigin[2] += position[2];
65937
66022
  rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a$d);
65938
- rtcCameraEye = tempVec3d$c;
66023
+ rtcCameraEye = tempVec3d$4;
65939
66024
  rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];
65940
66025
  rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];
65941
66026
  rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];
@@ -66032,7 +66117,7 @@ class SnapInstancingDepthRenderer extends VBOSceneModelRenderer {
66032
66117
  _buildVertexShader() {
66033
66118
  const scene = this._scene;
66034
66119
  const sectionPlanesState = scene._sectionPlanesState;
66035
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
66120
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
66036
66121
  const src = [];
66037
66122
  src.push ('#version 300 es');
66038
66123
  src.push("// SnapInstancingDepthRenderer vertex shader");
@@ -66120,7 +66205,7 @@ class SnapInstancingDepthRenderer extends VBOSceneModelRenderer {
66120
66205
  _buildFragmentShader() {
66121
66206
  const scene = this._scene;
66122
66207
  const sectionPlanesState = scene._sectionPlanesState;
66123
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
66208
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
66124
66209
  const src = [];
66125
66210
  src.push ('#version 300 es');
66126
66211
  src.push("// SnapInstancingDepthRenderer fragment shader");
@@ -66141,7 +66226,7 @@ class SnapInstancingDepthRenderer extends VBOSceneModelRenderer {
66141
66226
  if (clipping) {
66142
66227
  src.push("in vec4 vWorldPosition;");
66143
66228
  src.push("in float vFlags;");
66144
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
66229
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
66145
66230
  src.push("uniform bool sectionPlaneActive" + i + ";");
66146
66231
  src.push("uniform vec3 sectionPlanePos" + i + ";");
66147
66232
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -66154,7 +66239,7 @@ class SnapInstancingDepthRenderer extends VBOSceneModelRenderer {
66154
66239
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
66155
66240
  src.push(" if (clippable) {");
66156
66241
  src.push(" float dist = 0.0;");
66157
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
66242
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
66158
66243
  src.push("if (sectionPlaneActive" + i + ") {");
66159
66244
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
66160
66245
  src.push("}");
@@ -66275,8 +66360,8 @@ const tempVec3fa$2 = new Float32Array(3);
66275
66360
  const tempVec3a$m = math.vec3();
66276
66361
  const tempVec3b$i = math.vec3();
66277
66362
  const tempVec3c$f = math.vec3();
66278
- const tempVec3d$b = math.vec3();
66279
- const tempVec3e$2 = math.vec3();
66363
+ const tempVec3d$3 = math.vec3();
66364
+ const tempVec3e = math.vec3();
66280
66365
  const tempVec3f = math.vec3();
66281
66366
  const tempVec3g = math.vec3();
66282
66367
 
@@ -67352,8 +67437,8 @@ class TrianglesInstancingLayer {
67352
67437
 
67353
67438
  math.transformRay(portion.inverseMatrix, rtcRayOrigin, rtcRayDir, rtcRayOrigin, rtcRayDir);
67354
67439
 
67355
- const a = tempVec3d$b;
67356
- const b = tempVec3e$2;
67440
+ const a = tempVec3d$3;
67441
+ const b = tempVec3e;
67357
67442
  const c = tempVec3f;
67358
67443
 
67359
67444
  let gotIntersect = false;
@@ -67483,7 +67568,7 @@ class LinesBatchingColorRenderer extends VBOSceneModelLineBatchingRenderer {
67483
67568
  _buildVertexShader() {
67484
67569
  const scene = this._scene;
67485
67570
  const sectionPlanesState = scene._sectionPlanesState;
67486
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
67571
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
67487
67572
  const src = [];
67488
67573
  src.push('#version 300 es');
67489
67574
  src.push("// Lines batching color vertex shader");
@@ -67536,7 +67621,7 @@ class LinesBatchingColorRenderer extends VBOSceneModelLineBatchingRenderer {
67536
67621
  _buildFragmentShader() {
67537
67622
  const scene = this._scene;
67538
67623
  const sectionPlanesState = scene._sectionPlanesState;
67539
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
67624
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
67540
67625
  const src = [];
67541
67626
  src.push('#version 300 es');
67542
67627
  src.push("// Lines batching color fragment shader");
@@ -67554,7 +67639,7 @@ class LinesBatchingColorRenderer extends VBOSceneModelLineBatchingRenderer {
67554
67639
  if (clipping) {
67555
67640
  src.push("in vec4 vWorldPosition;");
67556
67641
  src.push("in float vFlags;");
67557
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
67642
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
67558
67643
  src.push("uniform bool sectionPlaneActive" + i + ";");
67559
67644
  src.push("uniform vec3 sectionPlanePos" + i + ";");
67560
67645
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -67567,7 +67652,7 @@ class LinesBatchingColorRenderer extends VBOSceneModelLineBatchingRenderer {
67567
67652
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
67568
67653
  src.push(" if (clippable) {");
67569
67654
  src.push(" float dist = 0.0;");
67570
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
67655
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
67571
67656
  src.push("if (sectionPlaneActive" + i + ") {");
67572
67657
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
67573
67658
  src.push("}");
@@ -67597,7 +67682,7 @@ class LinesBatchingSilhouetteRenderer extends VBOSceneModelLineBatchingRenderer
67597
67682
 
67598
67683
  const scene = this._scene;
67599
67684
  const sectionPlanesState = scene._sectionPlanesState;
67600
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
67685
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
67601
67686
 
67602
67687
  const src = [];
67603
67688
  src.push('#version 300 es');
@@ -67658,7 +67743,7 @@ class LinesBatchingSilhouetteRenderer extends VBOSceneModelLineBatchingRenderer
67658
67743
 
67659
67744
  const scene = this._scene;
67660
67745
  const sectionPlanesState = scene._sectionPlanesState;
67661
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
67746
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
67662
67747
  const src = [];
67663
67748
  src.push('#version 300 es');
67664
67749
  src.push("// Lines batching silhouette fragment shader");
@@ -67677,7 +67762,7 @@ class LinesBatchingSilhouetteRenderer extends VBOSceneModelLineBatchingRenderer
67677
67762
  if (clipping) {
67678
67763
  src.push("in vec4 vWorldPosition;");
67679
67764
  src.push("in float vFlags;");
67680
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
67765
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
67681
67766
  src.push("uniform bool sectionPlaneActive" + i + ";");
67682
67767
  src.push("uniform vec3 sectionPlanePos" + i + ";");
67683
67768
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -67690,7 +67775,7 @@ class LinesBatchingSilhouetteRenderer extends VBOSceneModelLineBatchingRenderer
67690
67775
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
67691
67776
  src.push(" if (clippable) {");
67692
67777
  src.push(" float dist = 0.0;");
67693
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
67778
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
67694
67779
  src.push("if (sectionPlaneActive" + i + ") {");
67695
67780
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
67696
67781
  src.push("}");
@@ -68538,7 +68623,7 @@ class LinesInstancingColorRenderer extends VBOSceneModelLineInstancingRenderer {
68538
68623
  _buildVertexShader() {
68539
68624
  const scene = this._scene;
68540
68625
  const sectionPlanesState = scene._sectionPlanesState;
68541
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
68626
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
68542
68627
  const src = [];
68543
68628
  src.push('#version 300 es');
68544
68629
  src.push("// Lines instancing color vertex shader");
@@ -68611,7 +68696,7 @@ class LinesInstancingColorRenderer extends VBOSceneModelLineInstancingRenderer {
68611
68696
  const sectionPlanesState = scene._sectionPlanesState;
68612
68697
  let i;
68613
68698
  let len;
68614
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
68699
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
68615
68700
  const src = [];
68616
68701
  src.push('#version 300 es');
68617
68702
  src.push("// Lines instancing color fragment shader");
@@ -68629,7 +68714,7 @@ class LinesInstancingColorRenderer extends VBOSceneModelLineInstancingRenderer {
68629
68714
  if (clipping) {
68630
68715
  src.push("in vec4 vWorldPosition;");
68631
68716
  src.push("in float vFlags;");
68632
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
68717
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
68633
68718
  src.push("uniform bool sectionPlaneActive" + i + ";");
68634
68719
  src.push("uniform vec3 sectionPlanePos" + i + ";");
68635
68720
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -68642,7 +68727,7 @@ class LinesInstancingColorRenderer extends VBOSceneModelLineInstancingRenderer {
68642
68727
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
68643
68728
  src.push(" if (clippable) {");
68644
68729
  src.push(" float dist = 0.0;");
68645
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
68730
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
68646
68731
  src.push("if (sectionPlaneActive" + i + ") {");
68647
68732
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
68648
68733
  src.push("}");
@@ -68685,7 +68770,7 @@ class LinesInstancingSilhouetteRenderer extends VBOSceneModelLineInstancingRende
68685
68770
  _buildVertexShader() {
68686
68771
  const scene = this._scene;
68687
68772
  const sectionPlanesState = scene._sectionPlanesState;
68688
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
68773
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
68689
68774
  const src = [];
68690
68775
  src.push('#version 300 es');
68691
68776
  src.push("// Lines instancing silhouette vertex shader");
@@ -68750,7 +68835,7 @@ class LinesInstancingSilhouetteRenderer extends VBOSceneModelLineInstancingRende
68750
68835
  _buildFragmentShader() {
68751
68836
  const scene = this._scene;
68752
68837
  const sectionPlanesState = scene._sectionPlanesState;
68753
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
68838
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
68754
68839
  const src = [];
68755
68840
  src.push('#version 300 es');
68756
68841
  src.push("// Lines instancing silhouette fragment shader");
@@ -68768,7 +68853,7 @@ class LinesInstancingSilhouetteRenderer extends VBOSceneModelLineInstancingRende
68768
68853
  if (clipping) {
68769
68854
  src.push("in vec4 vWorldPosition;");
68770
68855
  src.push("in float vFlags;");
68771
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
68856
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
68772
68857
  src.push("uniform bool sectionPlaneActive" + i + ";");
68773
68858
  src.push("uniform vec3 sectionPlanePos" + i + ";");
68774
68859
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -68781,7 +68866,7 @@ class LinesInstancingSilhouetteRenderer extends VBOSceneModelLineInstancingRende
68781
68866
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
68782
68867
  src.push(" if (clippable) {");
68783
68868
  src.push(" float dist = 0.0;");
68784
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
68869
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
68785
68870
  src.push("if (sectionPlaneActive" + i + ") {");
68786
68871
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
68787
68872
  src.push("}");
@@ -69560,7 +69645,7 @@ class PointsBatchingColorRenderer extends VBOSceneModelPointBatchingRenderer {
69560
69645
 
69561
69646
  const scene = this._scene;
69562
69647
  const sectionPlanesState = scene._sectionPlanesState;
69563
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
69648
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
69564
69649
  const pointsMaterial = scene.pointsMaterial;
69565
69650
  const src = [];
69566
69651
  src.push('#version 300 es');
@@ -69653,7 +69738,7 @@ class PointsBatchingColorRenderer extends VBOSceneModelPointBatchingRenderer {
69653
69738
 
69654
69739
  const scene = this._scene;
69655
69740
  const sectionPlanesState = scene._sectionPlanesState;
69656
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
69741
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
69657
69742
  const src = [];
69658
69743
  src.push('#version 300 es');
69659
69744
  src.push("// Points batching color fragment shader");
@@ -69672,7 +69757,7 @@ class PointsBatchingColorRenderer extends VBOSceneModelPointBatchingRenderer {
69672
69757
  if (clipping) {
69673
69758
  src.push("in vec4 vWorldPosition;");
69674
69759
  src.push("in float vFlags;");
69675
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
69760
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
69676
69761
  src.push("uniform bool sectionPlaneActive" + i + ";");
69677
69762
  src.push("uniform vec3 sectionPlanePos" + i + ";");
69678
69763
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -69692,7 +69777,7 @@ class PointsBatchingColorRenderer extends VBOSceneModelPointBatchingRenderer {
69692
69777
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
69693
69778
  src.push(" if (clippable) {");
69694
69779
  src.push(" float dist = 0.0;");
69695
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
69780
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
69696
69781
  src.push("if (sectionPlaneActive" + i + ") {");
69697
69782
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
69698
69783
  src.push("}");
@@ -69725,7 +69810,7 @@ class PointsBatchingSilhouetteRenderer extends VBOSceneModelPointBatchingRendere
69725
69810
 
69726
69811
  const scene = this._scene;
69727
69812
  const sectionPlanesState = scene._sectionPlanesState;
69728
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
69813
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
69729
69814
  const pointsMaterial = scene.pointsMaterial._state;
69730
69815
  const src = [];
69731
69816
  src.push ('#version 300 es');
@@ -69798,7 +69883,7 @@ class PointsBatchingSilhouetteRenderer extends VBOSceneModelPointBatchingRendere
69798
69883
  const sectionPlanesState = scene._sectionPlanesState;
69799
69884
  let i;
69800
69885
  let len;
69801
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
69886
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
69802
69887
  const src = [];
69803
69888
  src.push ('#version 300 es');
69804
69889
  src.push("// Points batching silhouette vertex shader");
@@ -69816,7 +69901,7 @@ class PointsBatchingSilhouetteRenderer extends VBOSceneModelPointBatchingRendere
69816
69901
  if (clipping) {
69817
69902
  src.push("in vec4 vWorldPosition;");
69818
69903
  src.push("in float vFlags;");
69819
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
69904
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
69820
69905
  src.push("uniform bool sectionPlaneActive" + i + ";");
69821
69906
  src.push("uniform vec3 sectionPlanePos" + i + ";");
69822
69907
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -69836,7 +69921,7 @@ class PointsBatchingSilhouetteRenderer extends VBOSceneModelPointBatchingRendere
69836
69921
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
69837
69922
  src.push(" if (clippable) {");
69838
69923
  src.push(" float dist = 0.0;");
69839
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
69924
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
69840
69925
  src.push("if (sectionPlaneActive" + i + ") {");
69841
69926
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
69842
69927
  src.push("}");
@@ -69864,7 +69949,7 @@ class PointsBatchingPickMeshRenderer extends VBOSceneModelPointBatchingRenderer
69864
69949
  _buildVertexShader() {
69865
69950
 
69866
69951
  const scene = this._scene;
69867
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
69952
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
69868
69953
  const pointsMaterial = scene.pointsMaterial._state;
69869
69954
  const src = [];
69870
69955
  src.push ('#version 300 es');
@@ -69943,7 +70028,7 @@ class PointsBatchingPickMeshRenderer extends VBOSceneModelPointBatchingRenderer
69943
70028
  _buildFragmentShader() {
69944
70029
  const scene = this._scene;
69945
70030
  const sectionPlanesState = scene._sectionPlanesState;
69946
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
70031
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
69947
70032
  const src = [];
69948
70033
  src.push ('#version 300 es');
69949
70034
  src.push("// Points batching pick mesh vertex shader");
@@ -69961,7 +70046,7 @@ class PointsBatchingPickMeshRenderer extends VBOSceneModelPointBatchingRenderer
69961
70046
  if (clipping) {
69962
70047
  src.push("in vec4 vWorldPosition;");
69963
70048
  src.push("in float vFlags;");
69964
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
70049
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
69965
70050
  src.push("uniform bool sectionPlaneActive" + i + ";");
69966
70051
  src.push("uniform vec3 sectionPlanePos" + i + ";");
69967
70052
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -69981,7 +70066,7 @@ class PointsBatchingPickMeshRenderer extends VBOSceneModelPointBatchingRenderer
69981
70066
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
69982
70067
  src.push(" if (clippable) {");
69983
70068
  src.push(" float dist = 0.0;");
69984
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
70069
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
69985
70070
  src.push(" if (sectionPlaneActive" + i + ") {");
69986
70071
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
69987
70072
  src.push(" }");
@@ -70008,7 +70093,7 @@ class PointsBatchingPickDepthRenderer extends VBOSceneModelPointBatchingRenderer
70008
70093
 
70009
70094
  _buildVertexShader() {
70010
70095
  const scene = this._scene;
70011
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
70096
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
70012
70097
  const pointsMaterial = scene.pointsMaterial._state;
70013
70098
  const src = [];
70014
70099
  src.push ('#version 300 es');
@@ -70082,7 +70167,7 @@ class PointsBatchingPickDepthRenderer extends VBOSceneModelPointBatchingRenderer
70082
70167
  _buildFragmentShader() {
70083
70168
  const scene = this._scene;
70084
70169
  const sectionPlanesState = scene._sectionPlanesState;
70085
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
70170
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
70086
70171
  const src = [];
70087
70172
  src.push ('#version 300 es');
70088
70173
  src.push("// Points batched pick depth fragment shader");
@@ -70106,7 +70191,7 @@ class PointsBatchingPickDepthRenderer extends VBOSceneModelPointBatchingRenderer
70106
70191
  if (clipping) {
70107
70192
  src.push("in vec4 vWorldPosition;");
70108
70193
  src.push("in float vFlags;");
70109
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
70194
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
70110
70195
  src.push("uniform bool sectionPlaneActive" + i + ";");
70111
70196
  src.push("uniform vec3 sectionPlanePos" + i + ";");
70112
70197
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -70133,7 +70218,7 @@ class PointsBatchingPickDepthRenderer extends VBOSceneModelPointBatchingRenderer
70133
70218
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
70134
70219
  src.push(" if (clippable) {");
70135
70220
  src.push(" float dist = 0.0;");
70136
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
70221
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
70137
70222
  src.push(" if (sectionPlaneActive" + i + ") {");
70138
70223
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
70139
70224
  src.push(" }");
@@ -70161,7 +70246,7 @@ class PointsBatchingOcclusionRenderer extends VBOSceneModelPointBatchingRenderer
70161
70246
 
70162
70247
  _buildVertexShader() {
70163
70248
  const scene = this._scene;
70164
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
70249
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
70165
70250
  const pointsMaterial = scene.pointsMaterial._state;
70166
70251
  const src = [];
70167
70252
  src.push ('#version 300 es');
@@ -70229,7 +70314,7 @@ class PointsBatchingOcclusionRenderer extends VBOSceneModelPointBatchingRenderer
70229
70314
  _buildFragmentShader() {
70230
70315
  const scene = this._scene;
70231
70316
  const sectionPlanesState = scene._sectionPlanesState;
70232
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
70317
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
70233
70318
  const src = [];
70234
70319
  src.push ('#version 300 es');
70235
70320
  src.push("// Points batching occlusion fragment shader");
@@ -70247,7 +70332,7 @@ class PointsBatchingOcclusionRenderer extends VBOSceneModelPointBatchingRenderer
70247
70332
  if (clipping) {
70248
70333
  src.push("in vec4 vWorldPosition;");
70249
70334
  src.push("in float vFlags;");
70250
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
70335
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
70251
70336
  src.push("uniform bool sectionPlaneActive" + i + ";");
70252
70337
  src.push("uniform vec3 sectionPlanePos" + i + ";");
70253
70338
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -70266,7 +70351,7 @@ class PointsBatchingOcclusionRenderer extends VBOSceneModelPointBatchingRenderer
70266
70351
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
70267
70352
  src.push(" if (clippable) {");
70268
70353
  src.push(" float dist = 0.0;");
70269
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
70354
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
70270
70355
  src.push(" if (sectionPlaneActive" + i + ") {");
70271
70356
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
70272
70357
  src.push(" }");
@@ -71169,7 +71254,7 @@ class PointsInstancingColorRenderer extends VBOSceneModelPointInstancingRenderer
71169
71254
  _buildVertexShader() {
71170
71255
  const scene = this._scene;
71171
71256
  const sectionPlanesState = scene._sectionPlanesState;
71172
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71257
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71173
71258
  const pointsMaterial = scene.pointsMaterial._state;
71174
71259
  const src = [];
71175
71260
  src.push('#version 300 es');
@@ -71269,7 +71354,7 @@ class PointsInstancingColorRenderer extends VBOSceneModelPointInstancingRenderer
71269
71354
  _buildFragmentShader() {
71270
71355
  const scene = this._scene;
71271
71356
  const sectionPlanesState = scene._sectionPlanesState;
71272
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71357
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71273
71358
  const src = [];
71274
71359
  src.push('#version 300 es');
71275
71360
  src.push("// Points instancing color fragment shader");
@@ -71288,7 +71373,7 @@ class PointsInstancingColorRenderer extends VBOSceneModelPointInstancingRenderer
71288
71373
  if (clipping) {
71289
71374
  src.push("in vec4 vWorldPosition;");
71290
71375
  src.push("in float vFlags;");
71291
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
71376
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
71292
71377
  src.push("uniform bool sectionPlaneActive" + i + ";");
71293
71378
  src.push("uniform vec3 sectionPlanePos" + i + ";");
71294
71379
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -71308,7 +71393,7 @@ class PointsInstancingColorRenderer extends VBOSceneModelPointInstancingRenderer
71308
71393
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
71309
71394
  src.push(" if (clippable) {");
71310
71395
  src.push(" float dist = 0.0;");
71311
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
71396
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
71312
71397
  src.push("if (sectionPlaneActive" + i + ") {");
71313
71398
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
71314
71399
  src.push("}");
@@ -71341,7 +71426,7 @@ class PointsInstancingSilhouetteRenderer extends VBOSceneModelPointInstancingRen
71341
71426
 
71342
71427
  const scene = this._scene;
71343
71428
  const sectionPlanesState = scene._sectionPlanesState;
71344
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71429
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71345
71430
  const pointsMaterial = scene.pointsMaterial._state;
71346
71431
  const src = [];
71347
71432
  src.push ('#version 300 es');
@@ -71423,7 +71508,7 @@ class PointsInstancingSilhouetteRenderer extends VBOSceneModelPointInstancingRen
71423
71508
  _buildFragmentShader() {
71424
71509
  const scene = this._scene;
71425
71510
  const sectionPlanesState = scene._sectionPlanesState;
71426
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71511
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71427
71512
  const src = [];
71428
71513
  src.push ('#version 300 es');
71429
71514
  src.push("// Points instancing silhouette fragment shader");
@@ -71441,7 +71526,7 @@ class PointsInstancingSilhouetteRenderer extends VBOSceneModelPointInstancingRen
71441
71526
  if (clipping) {
71442
71527
  src.push("in vec4 vWorldPosition;");
71443
71528
  src.push("in float vFlags;");
71444
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
71529
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
71445
71530
  src.push("uniform bool sectionPlaneActive" + i + ";");
71446
71531
  src.push("uniform vec3 sectionPlanePos" + i + ";");
71447
71532
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -71461,7 +71546,7 @@ class PointsInstancingSilhouetteRenderer extends VBOSceneModelPointInstancingRen
71461
71546
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
71462
71547
  src.push(" if (clippable) {");
71463
71548
  src.push(" float dist = 0.0;");
71464
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
71549
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
71465
71550
  src.push("if (sectionPlaneActive" + i + ") {");
71466
71551
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
71467
71552
  src.push("}");
@@ -71489,7 +71574,7 @@ class PointsInstancingPickMeshRenderer extends VBOSceneModelPointInstancingRende
71489
71574
  _buildVertexShader() {
71490
71575
  const scene = this._scene;
71491
71576
  const sectionPlanesState = scene._sectionPlanesState;
71492
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71577
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71493
71578
  const pointsMaterial = scene.pointsMaterial._state;
71494
71579
  const src = [];
71495
71580
  src.push ('#version 300 es');
@@ -71572,7 +71657,7 @@ class PointsInstancingPickMeshRenderer extends VBOSceneModelPointInstancingRende
71572
71657
  _buildFragmentShader() {
71573
71658
  const scene = this._scene;
71574
71659
  const sectionPlanesState = scene._sectionPlanesState;
71575
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71660
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71576
71661
  const src = [];
71577
71662
  src.push ('#version 300 es');
71578
71663
  src.push("// Points instancing pick mesh fragment shader");
@@ -71590,7 +71675,7 @@ class PointsInstancingPickMeshRenderer extends VBOSceneModelPointInstancingRende
71590
71675
  if (clipping) {
71591
71676
  src.push("in vec4 vWorldPosition;");
71592
71677
  src.push("in float vFlags;");
71593
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
71678
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
71594
71679
  src.push("uniform bool sectionPlaneActive" + i + ";");
71595
71680
  src.push("uniform vec3 sectionPlanePos" + i + ";");
71596
71681
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -71612,7 +71697,7 @@ class PointsInstancingPickMeshRenderer extends VBOSceneModelPointInstancingRende
71612
71697
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
71613
71698
  src.push(" if (clippable) {");
71614
71699
  src.push(" float dist = 0.0;");
71615
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
71700
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
71616
71701
  src.push("if (sectionPlaneActive" + i + ") {");
71617
71702
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
71618
71703
  src.push("}");
@@ -71640,7 +71725,7 @@ class PointsInstancingPickDepthRenderer extends VBOSceneModelPointInstancingRend
71640
71725
  _buildVertexShader() {
71641
71726
  const scene = this._scene;
71642
71727
  const sectionPlanesState = scene._sectionPlanesState;
71643
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71728
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71644
71729
  const pointsMaterial = scene.pointsMaterial._state;
71645
71730
  const src = [];
71646
71731
 
@@ -71725,7 +71810,7 @@ class PointsInstancingPickDepthRenderer extends VBOSceneModelPointInstancingRend
71725
71810
  _buildFragmentShader() {
71726
71811
  const scene = this._scene;
71727
71812
  const sectionPlanesState = scene._sectionPlanesState;
71728
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71813
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71729
71814
  const src = [];
71730
71815
  src.push ('#version 300 es');
71731
71816
  src.push("// Points instancing pick depth fragment shader");
@@ -71749,7 +71834,7 @@ class PointsInstancingPickDepthRenderer extends VBOSceneModelPointInstancingRend
71749
71834
  if (clipping) {
71750
71835
  src.push("in vec4 vWorldPosition;");
71751
71836
  src.push("in float vFlags;");
71752
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
71837
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
71753
71838
  src.push("uniform bool sectionPlaneActive" + i + ";");
71754
71839
  src.push("uniform vec3 sectionPlanePos" + i + ";");
71755
71840
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -71778,7 +71863,7 @@ class PointsInstancingPickDepthRenderer extends VBOSceneModelPointInstancingRend
71778
71863
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
71779
71864
  src.push(" if (clippable) {");
71780
71865
  src.push(" float dist = 0.0;");
71781
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
71866
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
71782
71867
  src.push("if (sectionPlaneActive" + i + ") {");
71783
71868
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
71784
71869
  src.push("}");
@@ -71808,7 +71893,7 @@ class PointsInstancingOcclusionRenderer extends VBOSceneModelPointInstancingRend
71808
71893
 
71809
71894
  const scene = this._scene;
71810
71895
  const sectionPlanesState = scene._sectionPlanesState;
71811
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71896
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71812
71897
  const pointsMaterial = scene.pointsMaterial._state;
71813
71898
  const src = [];
71814
71899
 
@@ -71890,7 +71975,7 @@ class PointsInstancingOcclusionRenderer extends VBOSceneModelPointInstancingRend
71890
71975
  _buildFragmentShader() {
71891
71976
  const scene = this._scene;
71892
71977
  const sectionPlanesState = scene._sectionPlanesState;
71893
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71978
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71894
71979
  const src = [];
71895
71980
  src.push ('#version 300 es');
71896
71981
  src.push("// Points instancing occlusion vertex shader");
@@ -71908,7 +71993,7 @@ class PointsInstancingOcclusionRenderer extends VBOSceneModelPointInstancingRend
71908
71993
  if (clipping) {
71909
71994
  src.push("in vec4 vWorldPosition;");
71910
71995
  src.push("in float vFlags;");
71911
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
71996
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
71912
71997
  src.push("uniform bool sectionPlaneActive" + i + ";");
71913
71998
  src.push("uniform vec3 sectionPlanePos" + i + ";");
71914
71999
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -71927,7 +72012,7 @@ class PointsInstancingOcclusionRenderer extends VBOSceneModelPointInstancingRend
71927
72012
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
71928
72013
  src.push(" if (clippable) {");
71929
72014
  src.push(" float dist = 0.0;");
71930
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
72015
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
71931
72016
  src.push("if (sectionPlaneActive" + i + ") {");
71932
72017
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
71933
72018
  src.push("}");
@@ -71955,7 +72040,7 @@ class PointsInstancingDepthRenderer extends VBOSceneModelPointInstancingRenderer
71955
72040
  _buildVertexShader() {
71956
72041
  const scene = this._scene;
71957
72042
  const sectionPlanesState = scene._sectionPlanesState;
71958
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
72043
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71959
72044
  const pointsMaterial = scene.pointsMaterial._state;
71960
72045
  const src = [];
71961
72046
  src.push('#version 300 es');
@@ -72028,7 +72113,7 @@ class PointsInstancingDepthRenderer extends VBOSceneModelPointInstancingRenderer
72028
72113
  const sectionPlanesState = scene._sectionPlanesState;
72029
72114
  let i;
72030
72115
  let len;
72031
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
72116
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
72032
72117
  const src = [];
72033
72118
  src.push('#version 300 es');
72034
72119
  src.push("// Points instancing depth vertex shader");
@@ -72046,7 +72131,7 @@ class PointsInstancingDepthRenderer extends VBOSceneModelPointInstancingRenderer
72046
72131
  if (clipping) {
72047
72132
  src.push("in vec4 vWorldPosition;");
72048
72133
  src.push("in float vFlags;");
72049
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
72134
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
72050
72135
  src.push("uniform bool sectionPlaneActive" + i + ";");
72051
72136
  src.push("uniform vec3 sectionPlanePos" + i + ";");
72052
72137
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -72080,7 +72165,7 @@ class PointsInstancingDepthRenderer extends VBOSceneModelPointInstancingRenderer
72080
72165
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
72081
72166
  src.push(" if (clippable) {");
72082
72167
  src.push(" float dist = 0.0;");
72083
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
72168
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
72084
72169
  src.push("if (sectionPlaneActive" + i + ") {");
72085
72170
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
72086
72171
  src.push("}");
@@ -72107,7 +72192,7 @@ class PointsInstancingShadowRenderer extends VBOSceneModelPointInstancingRendere
72107
72192
  _buildVertexShader() {
72108
72193
  const scene = this._scene;
72109
72194
  const sectionPlanesState = scene._sectionPlanesState;
72110
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
72195
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
72111
72196
  const src = [];
72112
72197
  src.push ('#version 300 es');
72113
72198
  src.push("// Instancing geometry shadow drawing vertex shader");
@@ -72158,7 +72243,7 @@ class PointsInstancingShadowRenderer extends VBOSceneModelPointInstancingRendere
72158
72243
  _buildFragmentShader() {
72159
72244
  const scene = this._scene;
72160
72245
  const sectionPlanesState = scene._sectionPlanesState;
72161
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
72246
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
72162
72247
  const src = [];
72163
72248
  src.push ('#version 300 es');
72164
72249
  src.push("// Instancing geometry depth drawing fragment shader");
@@ -72177,7 +72262,7 @@ class PointsInstancingShadowRenderer extends VBOSceneModelPointInstancingRendere
72177
72262
  if (clipping) {
72178
72263
  src.push("in vec4 vWorldPosition;");
72179
72264
  src.push("in float vFlags;");
72180
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
72265
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
72181
72266
  src.push("uniform bool sectionPlaneActive" + i + ";");
72182
72267
  src.push("uniform vec3 sectionPlanePos" + i + ";");
72183
72268
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -72198,7 +72283,7 @@ class PointsInstancingShadowRenderer extends VBOSceneModelPointInstancingRendere
72198
72283
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
72199
72284
  src.push(" if (clippable) {");
72200
72285
  src.push(" float dist = 0.0;");
72201
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
72286
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
72202
72287
  src.push("if (sectionPlaneActive" + i + ") {");
72203
72288
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
72204
72289
  src.push("}");
@@ -74655,7 +74740,7 @@ function doCheckResult(buckets, mesh) {
74655
74740
  const tempVec3a$k = math.vec3();
74656
74741
  const tempVec3b$g = math.vec3();
74657
74742
  const tempVec3c$e = math.vec3();
74658
- const tempVec3d$a = math.vec3();
74743
+ math.vec3();
74659
74744
 
74660
74745
  const tempVec4a$6 = math.vec4();
74661
74746
 
@@ -74754,25 +74839,30 @@ class TrianglesDataTextureColorRenderer {
74754
74839
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
74755
74840
  }
74756
74841
 
74842
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
74757
74843
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
74758
- if (numSectionPlanes > 0) {
74844
+ if (numAllocatedSectionPlanes > 0) {
74759
74845
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
74760
74846
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
74761
74847
  const renderFlags = model.renderFlags;
74762
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
74848
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
74763
74849
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
74764
74850
  if (sectionPlaneUniforms) {
74765
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
74766
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
74767
- if (active) {
74768
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
74769
- if (origin) {
74770
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3d$a);
74771
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
74772
- } else {
74773
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
74851
+ if (sectionPlaneIndex < numSectionPlanes) {
74852
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
74853
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
74854
+ if (active) {
74855
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
74856
+ if (origin) {
74857
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$k);
74858
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
74859
+ } else {
74860
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
74861
+ }
74862
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
74774
74863
  }
74775
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
74864
+ } else {
74865
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
74776
74866
  }
74777
74867
  }
74778
74868
  }
@@ -74867,7 +74957,7 @@ class TrianglesDataTextureColorRenderer {
74867
74957
 
74868
74958
  this._uSectionPlanes = [];
74869
74959
 
74870
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
74960
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
74871
74961
  this._uSectionPlanes.push({
74872
74962
  active: program.getLocation("sectionPlaneActive" + i),
74873
74963
  pos: program.getLocation("sectionPlanePos" + i),
@@ -74957,7 +75047,7 @@ class TrianglesDataTextureColorRenderer {
74957
75047
  const scene = this._scene;
74958
75048
  const sectionPlanesState = scene._sectionPlanesState;
74959
75049
  const lightsState = scene._lightsState;
74960
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
75050
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
74961
75051
  let light;
74962
75052
  const src = [];
74963
75053
  src.push("#version 300 es");
@@ -75168,7 +75258,7 @@ class TrianglesDataTextureColorRenderer {
75168
75258
  _buildFragmentShader() {
75169
75259
  const scene = this._scene;
75170
75260
  const sectionPlanesState = scene._sectionPlanesState;
75171
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
75261
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
75172
75262
  const src = [];
75173
75263
  src.push('#version 300 es');
75174
75264
  src.push("// TrianglesDataTextureColorRenderer fragment shader");
@@ -75202,7 +75292,7 @@ class TrianglesDataTextureColorRenderer {
75202
75292
  if (clipping) {
75203
75293
  src.push("in vec4 vWorldPosition;");
75204
75294
  src.push("flat in uint vFlags2;");
75205
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
75295
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
75206
75296
  src.push("uniform bool sectionPlaneActive" + i + ";");
75207
75297
  src.push("uniform vec3 sectionPlanePos" + i + ";");
75208
75298
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -75216,7 +75306,7 @@ class TrianglesDataTextureColorRenderer {
75216
75306
  src.push(" bool clippable = vFlags2 > 0u;");
75217
75307
  src.push(" if (clippable) {");
75218
75308
  src.push(" float dist = 0.0;");
75219
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
75309
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
75220
75310
  src.push("if (sectionPlaneActive" + i + ") {");
75221
75311
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
75222
75312
  src.push("}");
@@ -75267,7 +75357,7 @@ const defaultColor$1 = new Float32Array([1, 1, 1]);
75267
75357
  const tempVec3a$j = math.vec3();
75268
75358
  const tempVec3b$f = math.vec3();
75269
75359
  const tempVec3c$d = math.vec3();
75270
- const tempVec3d$9 = math.vec3();
75360
+ math.vec3();
75271
75361
  const tempMat4a$b = math.mat4();
75272
75362
 
75273
75363
  /**
@@ -75382,25 +75472,30 @@ class TrianglesDataTextureSilhouetteRenderer {
75382
75472
  const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2);
75383
75473
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
75384
75474
  }
75475
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
75385
75476
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
75386
- if (numSectionPlanes > 0) {
75477
+ if (numAllocatedSectionPlanes > 0) {
75387
75478
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
75388
75479
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
75389
75480
  const renderFlags = model.renderFlags;
75390
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
75481
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
75391
75482
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
75392
75483
  if (sectionPlaneUniforms) {
75393
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
75394
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
75395
- if (active) {
75396
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
75397
- if (origin) {
75398
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3d$9);
75399
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
75400
- } else {
75401
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
75484
+ if (sectionPlaneIndex < numSectionPlanes) {
75485
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
75486
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
75487
+ if (active) {
75488
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
75489
+ if (origin) {
75490
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$j);
75491
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
75492
+ } else {
75493
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
75494
+ }
75495
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
75402
75496
  }
75403
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
75497
+ } else {
75498
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
75404
75499
  }
75405
75500
  }
75406
75501
  }
@@ -75502,8 +75597,7 @@ class TrianglesDataTextureSilhouetteRenderer {
75502
75597
  _buildVertexShader() {
75503
75598
 
75504
75599
  const scene = this._scene;
75505
- const sectionPlanesState = scene._sectionPlanesState;
75506
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
75600
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
75507
75601
 
75508
75602
  const src = [];
75509
75603
  src.push("#version 300 es");
@@ -75657,8 +75751,7 @@ class TrianglesDataTextureSilhouetteRenderer {
75657
75751
 
75658
75752
  _buildFragmentShader() {
75659
75753
  const scene = this._scene;
75660
- const sectionPlanesState = scene._sectionPlanesState;
75661
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
75754
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
75662
75755
  const src = [];
75663
75756
  src.push('#version 300 es');
75664
75757
  src.push("// Triangles dataTexture draw fragment shader");
@@ -75677,7 +75770,7 @@ class TrianglesDataTextureSilhouetteRenderer {
75677
75770
  if (clipping) {
75678
75771
  src.push("in vec4 vWorldPosition;");
75679
75772
  src.push("flat in uint vFlags2;");
75680
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
75773
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
75681
75774
  src.push("uniform bool sectionPlaneActive" + i + ";");
75682
75775
  src.push("uniform vec3 sectionPlanePos" + i + ";");
75683
75776
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -75690,7 +75783,7 @@ class TrianglesDataTextureSilhouetteRenderer {
75690
75783
  src.push(" bool clippable = vFlags2 > 0u;");
75691
75784
  src.push(" if (clippable) {");
75692
75785
  src.push(" float dist = 0.0;");
75693
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
75786
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
75694
75787
  src.push("if (sectionPlaneActive" + i + ") {");
75695
75788
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
75696
75789
  src.push("}");
@@ -75724,7 +75817,7 @@ const defaultColor = new Float32Array([0, 0, 0, 1]);
75724
75817
 
75725
75818
  const tempVec3a$i = math.vec3();
75726
75819
  const tempVec3b$e = math.vec3();
75727
- const tempVec3d$8 = math.vec3();
75820
+ math.vec3();
75728
75821
  const tempMat4a$a = math.mat4();
75729
75822
 
75730
75823
  /**
@@ -75829,25 +75922,30 @@ class TrianglesDataTextureEdgesRenderer {
75829
75922
  gl.uniform4fv(this._uColor, defaultColor);
75830
75923
  }
75831
75924
 
75925
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
75832
75926
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
75833
- if (numSectionPlanes > 0) {
75927
+ if (numAllocatedSectionPlanes > 0) {
75834
75928
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
75835
75929
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
75836
75930
  const renderFlags = model.renderFlags;
75837
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
75931
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
75838
75932
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
75839
75933
  if (sectionPlaneUniforms) {
75840
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
75841
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
75842
- if (active) {
75843
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
75844
- if (origin) {
75845
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3d$8);
75846
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
75847
- } else {
75848
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
75934
+ if (sectionPlaneIndex < numSectionPlanes) {
75935
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
75936
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
75937
+ if (active) {
75938
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
75939
+ if (origin) {
75940
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$i);
75941
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
75942
+ } else {
75943
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
75944
+ }
75945
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
75849
75946
  }
75850
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
75947
+ } else {
75948
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
75851
75949
  }
75852
75950
  }
75853
75951
  }
@@ -75944,8 +76042,7 @@ class TrianglesDataTextureEdgesRenderer {
75944
76042
 
75945
76043
  _buildVertexShader() {
75946
76044
  const scene = this._scene;
75947
- const sectionPlanesState = scene._sectionPlanesState;
75948
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
76045
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
75949
76046
  const src = [];
75950
76047
  src.push("#version 300 es");
75951
76048
  src.push("// Batched geometry edges drawing vertex shader");
@@ -76072,8 +76169,7 @@ class TrianglesDataTextureEdgesRenderer {
76072
76169
 
76073
76170
  _buildFragmentShader() {
76074
76171
  const scene = this._scene;
76075
- const sectionPlanesState = scene._sectionPlanesState;
76076
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
76172
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
76077
76173
  const src = [];
76078
76174
  src.push('#version 300 es');
76079
76175
  src.push("// Batched geometry edges drawing fragment shader");
@@ -76095,7 +76191,7 @@ class TrianglesDataTextureEdgesRenderer {
76095
76191
  if (clipping) {
76096
76192
  src.push("in vec4 vWorldPosition;");
76097
76193
  src.push("flat in uint vFlags2;");
76098
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
76194
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
76099
76195
  src.push("uniform bool sectionPlaneActive" + i + ";");
76100
76196
  src.push("uniform vec3 sectionPlanePos" + i + ";");
76101
76197
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -76108,7 +76204,7 @@ class TrianglesDataTextureEdgesRenderer {
76108
76204
  src.push(" bool clippable = vFlags2 > 0u;");
76109
76205
  src.push(" if (clippable) {");
76110
76206
  src.push(" float dist = 0.0;");
76111
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
76207
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
76112
76208
  src.push("if (sectionPlaneActive" + i + ") {");
76113
76209
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
76114
76210
  src.push("}");
@@ -76300,7 +76396,7 @@ class TrianglesDataTextureEdgesColorRenderer {
76300
76396
  this._uProjMatrix = program.getLocation("projMatrix");
76301
76397
  this._uSectionPlanes = [];
76302
76398
 
76303
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
76399
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
76304
76400
  this._uSectionPlanes.push({
76305
76401
  active: program.getLocation("sectionPlaneActive" + i),
76306
76402
  pos: program.getLocation("sectionPlanePos" + i),
@@ -76346,8 +76442,7 @@ class TrianglesDataTextureEdgesColorRenderer {
76346
76442
 
76347
76443
  _buildVertexShader() {
76348
76444
  const scene = this._scene;
76349
- const sectionPlanesState = scene._sectionPlanesState;
76350
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
76445
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
76351
76446
  const src = [];
76352
76447
  src.push("#version 300 es");
76353
76448
  src.push("// TrianglesDataTextureEdgesColorRenderer");
@@ -76482,8 +76577,7 @@ class TrianglesDataTextureEdgesColorRenderer {
76482
76577
 
76483
76578
  _buildFragmentShader() {
76484
76579
  const scene = this._scene;
76485
- const sectionPlanesState = scene._sectionPlanesState;
76486
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
76580
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
76487
76581
  const src = [];
76488
76582
  src.push('#version 300 es');
76489
76583
  src.push("// TrianglesDataTextureEdgesColorRenderer");
@@ -76502,7 +76596,7 @@ class TrianglesDataTextureEdgesColorRenderer {
76502
76596
  if (clipping) {
76503
76597
  src.push("in vec4 vWorldPosition;");
76504
76598
  src.push("flat in uint vFlags2;");
76505
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
76599
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
76506
76600
  src.push("uniform bool sectionPlaneActive" + i + ";");
76507
76601
  src.push("uniform vec3 sectionPlanePos" + i + ";");
76508
76602
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -76515,7 +76609,7 @@ class TrianglesDataTextureEdgesColorRenderer {
76515
76609
  src.push(" bool clippable = vFlags2 > 0u;");
76516
76610
  src.push(" if (clippable) {");
76517
76611
  src.push(" float dist = 0.0;");
76518
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
76612
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
76519
76613
  src.push("if (sectionPlaneActive" + i + ") {");
76520
76614
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
76521
76615
  src.push("}");
@@ -76524,8 +76618,7 @@ class TrianglesDataTextureEdgesColorRenderer {
76524
76618
  src.push("}");
76525
76619
  }
76526
76620
  if (scene.logarithmicDepthBufferEnabled) {
76527
- // src.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;");
76528
- src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");
76621
+ src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");
76529
76622
  }
76530
76623
  src.push(" outColor = vColor;");
76531
76624
  src.push("}");
@@ -76633,25 +76726,30 @@ class TrianglesDataTexturePickMeshRenderer {
76633
76726
  const logDepthBufFC = 2.0 / (Math.log(camera.project.far + 1.0) / Math.LN2); // TODO: Far from pick project matrix?
76634
76727
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
76635
76728
  }
76729
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
76636
76730
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
76637
- if (numSectionPlanes > 0) {
76731
+ if (numAllocatedSectionPlanes > 0) {
76638
76732
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
76639
76733
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
76640
76734
  const renderFlags = model.renderFlags;
76641
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
76735
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
76642
76736
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
76643
76737
  if (sectionPlaneUniforms) {
76644
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
76645
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
76646
- if (active) {
76647
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
76648
- if (origin) {
76649
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$g);
76650
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
76651
- } else {
76652
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
76738
+ if (sectionPlaneIndex < numSectionPlanes) {
76739
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
76740
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
76741
+ if (active) {
76742
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
76743
+ if (origin) {
76744
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$g);
76745
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
76746
+ } else {
76747
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
76748
+ }
76749
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
76653
76750
  }
76654
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
76751
+ } else {
76752
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
76655
76753
  }
76656
76754
  }
76657
76755
  }
@@ -76659,8 +76757,8 @@ class TrianglesDataTexturePickMeshRenderer {
76659
76757
  if (state.numIndices8Bits > 0) {
76660
76758
  textureState.bindTriangleIndicesTextures(
76661
76759
  this._program,
76662
- this._uTexturePerPolygonIdPortionIds,
76663
- this._uTexturePerPolygonIdIndices,
76760
+ this._uTexturePerPolygonIdPortionIds,
76761
+ this._uTexturePerPolygonIdIndices,
76664
76762
  8 // 8 bits indices
76665
76763
  );
76666
76764
  gl.drawArrays(gl.TRIANGLES, 0, state.numIndices8Bits);
@@ -76668,8 +76766,8 @@ class TrianglesDataTexturePickMeshRenderer {
76668
76766
  if (state.numIndices16Bits > 0) {
76669
76767
  textureState.bindTriangleIndicesTextures(
76670
76768
  this._program,
76671
- this._uTexturePerPolygonIdPortionIds,
76672
- this._uTexturePerPolygonIdIndices,
76769
+ this._uTexturePerPolygonIdPortionIds,
76770
+ this._uTexturePerPolygonIdIndices,
76673
76771
  16 // 16 bits indices
76674
76772
  );
76675
76773
  gl.drawArrays(gl.TRIANGLES, 0, state.numIndices16Bits);
@@ -76677,8 +76775,8 @@ class TrianglesDataTexturePickMeshRenderer {
76677
76775
  if (state.numIndices32Bits > 0) {
76678
76776
  textureState.bindTriangleIndicesTextures(
76679
76777
  this._program,
76680
- this._uTexturePerPolygonIdPortionIds,
76681
- this._uTexturePerPolygonIdIndices,
76778
+ this._uTexturePerPolygonIdPortionIds,
76779
+ this._uTexturePerPolygonIdIndices,
76682
76780
  32 // 32 bits indices
76683
76781
  );
76684
76782
  gl.drawArrays(gl.TRIANGLES, 0, state.numIndices32Bits);
@@ -76713,14 +76811,14 @@ class TrianglesDataTexturePickMeshRenderer {
76713
76811
  if (scene.logarithmicDepthBufferEnabled) {
76714
76812
  this._uLogDepthBufFC = program.getLocation("logDepthBufFC");
76715
76813
  }
76716
- this.uTexturePerObjectPositionsDecodeMatrix = "uObjectPerObjectPositionsDecodeMatrix";
76717
- this.uTexturePerObjectColorsAndFlags = "uObjectPerObjectColorsAndFlags";
76718
- this._uTexturePerVertexIdCoordinates = "uTexturePerVertexIdCoordinates";
76719
- this._uTexturePerPolygonIdNormals = "uTexturePerPolygonIdNormals";
76720
- this._uTexturePerPolygonIdIndices = "uTexturePerPolygonIdIndices";
76814
+ this.uTexturePerObjectPositionsDecodeMatrix = "uObjectPerObjectPositionsDecodeMatrix";
76815
+ this.uTexturePerObjectColorsAndFlags = "uObjectPerObjectColorsAndFlags";
76816
+ this._uTexturePerVertexIdCoordinates = "uTexturePerVertexIdCoordinates";
76817
+ this._uTexturePerPolygonIdNormals = "uTexturePerPolygonIdNormals";
76818
+ this._uTexturePerPolygonIdIndices = "uTexturePerPolygonIdIndices";
76721
76819
  this._uTexturePerPolygonIdPortionIds = "uTexturePerPolygonIdPortionIds";
76722
- this._uTexturePerObjectMatrix= "uTexturePerObjectMatrix";
76723
- this._uCameraEyeRtc = program.getLocation("uCameraEyeRtc");
76820
+ this._uTexturePerObjectMatrix = "uTexturePerObjectMatrix";
76821
+ this._uCameraEyeRtc = program.getLocation("uCameraEyeRtc");
76724
76822
  }
76725
76823
 
76726
76824
  _bindProgram(frameCtx) {
@@ -76739,7 +76837,7 @@ class TrianglesDataTexturePickMeshRenderer {
76739
76837
 
76740
76838
  _buildVertexShader() {
76741
76839
  const scene = this._scene;
76742
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
76840
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
76743
76841
  const src = [];
76744
76842
  src.push("#version 300 es");
76745
76843
  src.push("// Batched geometry picking vertex shader");
@@ -76774,10 +76872,10 @@ class TrianglesDataTexturePickMeshRenderer {
76774
76872
  src.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;");
76775
76873
  src.push("uniform highp sampler2D uTexturePerObjectMatrix;");
76776
76874
  src.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;");
76777
- src.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;");
76778
- src.push("uniform highp usampler2D uTexturePerPolygonIdIndices;");
76875
+ src.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;");
76876
+ src.push("uniform highp usampler2D uTexturePerPolygonIdIndices;");
76779
76877
  src.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;");
76780
- src.push("uniform vec3 uCameraEyeRtc;");
76878
+ src.push("uniform vec3 uCameraEyeRtc;");
76781
76879
 
76782
76880
  src.push("vec3 positions[3];");
76783
76881
 
@@ -76820,9 +76918,9 @@ class TrianglesDataTexturePickMeshRenderer {
76820
76918
  src.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);");
76821
76919
 
76822
76920
  // get flags & flags2
76823
- src.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);");
76824
- src.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);");
76825
-
76921
+ src.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);");
76922
+ src.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);");
76923
+
76826
76924
  // flags.w = NOT_RENDERED | PICK
76827
76925
  // renderPass = PICK
76828
76926
 
@@ -76832,9 +76930,9 @@ class TrianglesDataTexturePickMeshRenderer {
76832
76930
  src.push("} else {");
76833
76931
 
76834
76932
  // get vertex base
76835
- src.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));");
76933
+ src.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));");
76836
76934
 
76837
- src.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));");
76935
+ src.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));");
76838
76936
 
76839
76937
  src.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;");
76840
76938
 
@@ -76843,7 +76941,7 @@ class TrianglesDataTexturePickMeshRenderer {
76843
76941
 
76844
76942
  src.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));");
76845
76943
  src.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;");
76846
-
76944
+
76847
76945
  src.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;");
76848
76946
  src.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;");
76849
76947
 
@@ -76851,7 +76949,7 @@ class TrianglesDataTexturePickMeshRenderer {
76851
76949
 
76852
76950
  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));");
76853
76951
 
76854
- src.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;");
76952
+ src.push("uint solid = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;");
76855
76953
 
76856
76954
  // get position
76857
76955
  src.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));");
@@ -76859,7 +76957,7 @@ class TrianglesDataTexturePickMeshRenderer {
76859
76957
  src.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));");
76860
76958
 
76861
76959
  // get color
76862
- src.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);");
76960
+ src.push("uvec4 color = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);");
76863
76961
 
76864
76962
  src.push(`if (color.a == 0u) {`);
76865
76963
  src.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"); // Cull vertex
@@ -76877,17 +76975,17 @@ class TrianglesDataTexturePickMeshRenderer {
76877
76975
 
76878
76976
  // when the geometry is not solid, if needed, flip the triangle winding
76879
76977
  src.push("if (solid != 1u) {");
76880
- src.push("if (isPerspectiveMatrix(projMatrix)) {");
76881
- src.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;");
76882
- src.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {");
76883
- src.push("position = positions[2 - (gl_VertexID % 3)];");
76884
- src.push("}");
76885
- src.push("} else {");
76886
- src.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);");
76887
- src.push("if (viewNormal.z < 0.0) {");
76888
- src.push("position = positions[2 - (gl_VertexID % 3)];");
76889
- src.push("}");
76890
- src.push("}");
76978
+ src.push("if (isPerspectiveMatrix(projMatrix)) {");
76979
+ src.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;");
76980
+ src.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {");
76981
+ src.push("position = positions[2 - (gl_VertexID % 3)];");
76982
+ src.push("}");
76983
+ src.push("} else {");
76984
+ src.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);");
76985
+ src.push("if (viewNormal.z < 0.0) {");
76986
+ src.push("position = positions[2 - (gl_VertexID % 3)];");
76987
+ src.push("}");
76988
+ src.push("}");
76891
76989
  src.push("}");
76892
76990
 
76893
76991
  src.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); ");
@@ -76911,10 +77009,9 @@ class TrianglesDataTexturePickMeshRenderer {
76911
77009
 
76912
77010
  _buildFragmentShader() {
76913
77011
  const scene = this._scene;
76914
- const sectionPlanesState = scene._sectionPlanesState;
76915
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
77012
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
76916
77013
  const src = [];
76917
- src.push ('#version 300 es');
77014
+ src.push('#version 300 es');
76918
77015
  src.push("// Batched geometry picking fragment shader");
76919
77016
  src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");
76920
77017
  src.push("precision highp float;");
@@ -76931,7 +77028,7 @@ class TrianglesDataTexturePickMeshRenderer {
76931
77028
  if (clipping) {
76932
77029
  src.push("in vec4 vWorldPosition;");
76933
77030
  src.push("flat in uvec4 vFlags2;");
76934
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
77031
+ for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
76935
77032
  src.push("uniform bool sectionPlaneActive" + i + ";");
76936
77033
  src.push("uniform vec3 sectionPlanePos" + i + ";");
76937
77034
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -76944,7 +77041,7 @@ class TrianglesDataTexturePickMeshRenderer {
76944
77041
  src.push(" bool clippable = (float(vFlags2.x) > 0.0);");
76945
77042
  src.push(" if (clippable) {");
76946
77043
  src.push(" float dist = 0.0;");
76947
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
77044
+ for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
76948
77045
  src.push(" if (sectionPlaneActive" + i + ") {");
76949
77046
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
76950
77047
  src.push(" }");
@@ -76953,7 +77050,7 @@ class TrianglesDataTexturePickMeshRenderer {
76953
77050
  src.push(" }");
76954
77051
  }
76955
77052
  if (scene.logarithmicDepthBufferEnabled) {
76956
- src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");
77053
+ src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");
76957
77054
  //src.push(" gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;");
76958
77055
  }
76959
77056
  src.push(" outPickColor = vPickColor; ");
@@ -76976,7 +77073,7 @@ class TrianglesDataTexturePickMeshRenderer {
76976
77073
  const tempVec3a$f = math.vec3();
76977
77074
  const tempVec3b$b = math.vec3();
76978
77075
  const tempVec3c$a = math.vec3();
76979
- const tempVec3d$7 = math.vec3();
77076
+ math.vec3();
76980
77077
  const tempMat4a$7 = math.mat4();
76981
77078
 
76982
77079
  /**
@@ -77077,25 +77174,30 @@ class TrianglesDataTexturePickDepthRenderer {
77077
77174
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
77078
77175
  }
77079
77176
 
77177
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
77080
77178
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
77081
- if (numSectionPlanes > 0) {
77179
+ if (numAllocatedSectionPlanes > 0) {
77082
77180
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
77083
77181
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
77084
77182
  const renderFlags = model.renderFlags;
77085
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
77183
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
77086
77184
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
77087
77185
  if (sectionPlaneUniforms) {
77088
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
77089
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
77090
- if (active) {
77091
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
77092
- if (origin) {
77093
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3d$7);
77094
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
77095
- } else {
77096
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
77186
+ if (sectionPlaneIndex < numSectionPlanes) {
77187
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
77188
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
77189
+ if (active) {
77190
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
77191
+ if (origin) {
77192
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$f);
77193
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
77194
+ } else {
77195
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
77196
+ }
77197
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
77097
77198
  }
77098
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
77199
+ } else {
77200
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
77099
77201
  }
77100
77202
  }
77101
77203
  }
@@ -77147,7 +77249,7 @@ class TrianglesDataTexturePickDepthRenderer {
77147
77249
  this._uViewMatrix = program.getLocation("viewMatrix");
77148
77250
  this._uProjMatrix = program.getLocation("projMatrix");
77149
77251
  this._uSectionPlanes = [];
77150
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
77252
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
77151
77253
  this._uSectionPlanes.push({
77152
77254
  active: program.getLocation("sectionPlaneActive" + i),
77153
77255
  pos: program.getLocation("sectionPlanePos" + i),
@@ -77183,7 +77285,7 @@ class TrianglesDataTexturePickDepthRenderer {
77183
77285
  _buildVertexShader() {
77184
77286
 
77185
77287
  const scene = this._scene;
77186
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
77288
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
77187
77289
  const src = [];
77188
77290
  src.push("#version 300 es");
77189
77291
  src.push("// Triangles dataTexture pick depth vertex shader");
@@ -77351,8 +77453,7 @@ class TrianglesDataTexturePickDepthRenderer {
77351
77453
  _buildFragmentShader() {
77352
77454
 
77353
77455
  const scene = this._scene;
77354
- const sectionPlanesState = scene._sectionPlanesState;
77355
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
77456
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
77356
77457
  const src = [];
77357
77458
  src.push('#version 300 es');
77358
77459
  src.push("// Triangles dataTexture pick depth fragment shader");
@@ -77377,7 +77478,7 @@ class TrianglesDataTexturePickDepthRenderer {
77377
77478
  if (clipping) {
77378
77479
  src.push("in vec4 vWorldPosition;");
77379
77480
  src.push("flat in uint vFlags2;");
77380
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
77481
+ for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
77381
77482
  src.push("uniform bool sectionPlaneActive" + i + ";");
77382
77483
  src.push("uniform vec3 sectionPlanePos" + i + ";");
77383
77484
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -77398,7 +77499,7 @@ class TrianglesDataTexturePickDepthRenderer {
77398
77499
  src.push(" bool clippable = vFlags2 > 0u;");
77399
77500
  src.push(" if (clippable) {");
77400
77501
  src.push(" float dist = 0.0;");
77401
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
77502
+ for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
77402
77503
  src.push(" if (sectionPlaneActive" + i + ") {");
77403
77504
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
77404
77505
  src.push(" }");
@@ -77430,8 +77531,8 @@ class TrianglesDataTexturePickDepthRenderer {
77430
77531
  const tempVec3a$e = math.vec3();
77431
77532
  const tempVec3b$a = math.vec3();
77432
77533
  const tempVec3c$9 = math.vec3();
77433
- const tempVec3d$6 = math.vec3();
77434
- const tempVec3e$1 = math.vec3();
77534
+ const tempVec3d$2 = math.vec3();
77535
+ math.vec3();
77435
77536
  const tempMat4a$6 = math.mat4();
77436
77537
 
77437
77538
  /**
@@ -77516,7 +77617,7 @@ class TrianglesDataTextureSnapDepthRenderer {
77516
77617
  rtcOrigin[1] += position[1];
77517
77618
  rtcOrigin[2] += position[2];
77518
77619
  rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a$6);
77519
- rtcCameraEye = tempVec3d$6;
77620
+ rtcCameraEye = tempVec3d$2;
77520
77621
  rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];
77521
77622
  rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];
77522
77623
  rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];
@@ -77545,25 +77646,30 @@ class TrianglesDataTextureSnapDepthRenderer {
77545
77646
  const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2);
77546
77647
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
77547
77648
  }
77649
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
77548
77650
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
77549
- if (numSectionPlanes > 0) {
77651
+ if (numAllocatedSectionPlanes > 0) {
77550
77652
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
77551
77653
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
77552
77654
  const renderFlags = model.renderFlags;
77553
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
77655
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
77554
77656
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
77555
77657
  if (sectionPlaneUniforms) {
77556
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
77557
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
77558
- if (active) {
77559
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
77560
- if (origin) {
77561
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3e$1);
77562
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
77563
- } else {
77564
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
77658
+ if (sectionPlaneIndex < numSectionPlanes) {
77659
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
77660
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
77661
+ if (active) {
77662
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
77663
+ if (origin) {
77664
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$e);
77665
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
77666
+ } else {
77667
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
77668
+ }
77669
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
77565
77670
  }
77566
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
77671
+ } else {
77672
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
77567
77673
  }
77568
77674
  }
77569
77675
  }
@@ -77651,8 +77757,7 @@ class TrianglesDataTextureSnapDepthRenderer {
77651
77757
 
77652
77758
  _buildVertexShader() {
77653
77759
  const scene = this._scene;
77654
- const sectionPlanesState = scene._sectionPlanesState;
77655
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
77760
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
77656
77761
  const src = [];
77657
77762
  src.push("#version 300 es");
77658
77763
  src.push("// Batched geometry edges drawing vertex shader");
@@ -77783,8 +77888,7 @@ class TrianglesDataTextureSnapDepthRenderer {
77783
77888
  _buildFragmentShader() {
77784
77889
 
77785
77890
  const scene = this._scene;
77786
- const sectionPlanesState = scene._sectionPlanesState;
77787
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
77891
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
77788
77892
  const src = [];
77789
77893
  src.push('#version 300 es');
77790
77894
  src.push("// Triangles dataTexture pick depth fragment shader");
@@ -77805,7 +77909,7 @@ class TrianglesDataTextureSnapDepthRenderer {
77805
77909
  if (clipping) {
77806
77910
  src.push("in vec4 vWorldPosition;");
77807
77911
  src.push("flat in uint vFlags2;");
77808
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
77912
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
77809
77913
  src.push("uniform bool sectionPlaneActive" + i + ";");
77810
77914
  src.push("uniform vec3 sectionPlanePos" + i + ";");
77811
77915
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -77818,7 +77922,7 @@ class TrianglesDataTextureSnapDepthRenderer {
77818
77922
  src.push(" bool clippable = vFlags2 > 0u;");
77819
77923
  src.push(" if (clippable) {");
77820
77924
  src.push(" float dist = 0.0;");
77821
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
77925
+ for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
77822
77926
  src.push(" if (sectionPlaneActive" + i + ") {");
77823
77927
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
77824
77928
  src.push(" }");
@@ -77849,8 +77953,8 @@ class TrianglesDataTextureSnapDepthRenderer {
77849
77953
  const tempVec3a$d = math.vec3();
77850
77954
  const tempVec3b$9 = math.vec3();
77851
77955
  const tempVec3c$8 = math.vec3();
77852
- const tempVec3d$5 = math.vec3();
77853
- const tempVec3e = math.vec3();
77956
+ const tempVec3d$1 = math.vec3();
77957
+ math.vec3();
77854
77958
  const tempMat4a$5 = math.mat4();
77855
77959
  /**
77856
77960
  * @private
@@ -77930,7 +78034,7 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
77930
78034
  rtcOrigin[1] += position[1];
77931
78035
  rtcOrigin[2] += position[2];
77932
78036
  rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a$5);
77933
- rtcCameraEye = tempVec3d$5;
78037
+ rtcCameraEye = tempVec3d$1;
77934
78038
  rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];
77935
78039
  rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];
77936
78040
  rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];
@@ -77959,25 +78063,30 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
77959
78063
  const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2);
77960
78064
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
77961
78065
  }
78066
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
77962
78067
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
77963
- if (numSectionPlanes > 0) {
78068
+ if (numAllocatedSectionPlanes > 0) {
77964
78069
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
77965
78070
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
77966
78071
  const renderFlags = model.renderFlags;
77967
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
78072
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
77968
78073
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
77969
78074
  if (sectionPlaneUniforms) {
77970
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
77971
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
77972
- if (active) {
77973
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
77974
- if (origin) {
77975
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3e);
77976
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
77977
- } else {
77978
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
78075
+ if (sectionPlaneIndex < numSectionPlanes) {
78076
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
78077
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
78078
+ if (active) {
78079
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
78080
+ if (origin) {
78081
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$d);
78082
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
78083
+ } else {
78084
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
78085
+ }
78086
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
77979
78087
  }
77980
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
78088
+ } else {
78089
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
77981
78090
  }
77982
78091
  }
77983
78092
  }
@@ -78063,8 +78172,7 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
78063
78172
 
78064
78173
  _buildVertexShader() {
78065
78174
  const scene = this._scene;
78066
- const sectionPlanesState = scene._sectionPlanesState;
78067
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
78175
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
78068
78176
  const src = [];
78069
78177
  src.push("#version 300 es");
78070
78178
  src.push("// TrianglesDataTextureSnapDepthBufInitRenderer vertex shader");
@@ -78226,8 +78334,7 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
78226
78334
 
78227
78335
  _buildFragmentShader() {
78228
78336
  const scene = this._scene;
78229
- const sectionPlanesState = scene._sectionPlanesState;
78230
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
78337
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
78231
78338
  const src = [];
78232
78339
  src.push('#version 300 es');
78233
78340
  src.push("// TrianglesDataTextureSnapDepthBufInitRenderer fragment shader");
@@ -78249,7 +78356,7 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
78249
78356
  src.push("flat in vec4 vPickColor;");
78250
78357
  if (clipping) {
78251
78358
  src.push("flat in uint vFlags2;");
78252
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
78359
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
78253
78360
  src.push("uniform bool sectionPlaneActive" + i + ";");
78254
78361
  src.push("uniform vec3 sectionPlanePos" + i + ";");
78255
78362
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -78264,7 +78371,7 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
78264
78371
  src.push(" bool clippable = vFlags2 > 0u;");
78265
78372
  src.push(" if (clippable) {");
78266
78373
  src.push(" float dist = 0.0;");
78267
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
78374
+ for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
78268
78375
  src.push(" if (sectionPlaneActive" + i + ") {");
78269
78376
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
78270
78377
  src.push(" }");
@@ -78304,7 +78411,7 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
78304
78411
  const tempVec3a$c = math.vec3();
78305
78412
  const tempVec3b$8 = math.vec3();
78306
78413
  const tempVec3c$7 = math.vec3();
78307
- const tempVec3d$4 = math.vec3();
78414
+ math.vec3();
78308
78415
  const tempMat4a$4 = math.mat4();
78309
78416
 
78310
78417
  /**
@@ -78394,25 +78501,30 @@ class TrianglesDataTextureOcclusionRenderer {
78394
78501
 
78395
78502
  gl.uniformMatrix4fv(this._uProjMatrix, false, camera.projMatrix);
78396
78503
 
78504
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
78397
78505
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
78398
- if (numSectionPlanes > 0) {
78506
+ if (numAllocatedSectionPlanes > 0) {
78399
78507
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
78400
78508
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
78401
78509
  const renderFlags = model.renderFlags;
78402
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
78510
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
78403
78511
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
78404
78512
  if (sectionPlaneUniforms) {
78405
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
78406
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
78407
- if (active) {
78408
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
78409
- if (origin) {
78410
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3d$4);
78411
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
78412
- } else {
78413
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
78513
+ if (sectionPlaneIndex < numSectionPlanes) {
78514
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
78515
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
78516
+ if (active) {
78517
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
78518
+ if (origin) {
78519
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$c);
78520
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
78521
+ } else {
78522
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
78523
+ }
78524
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
78414
78525
  }
78415
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
78526
+ } else {
78527
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
78416
78528
  }
78417
78529
  }
78418
78530
  }
@@ -78463,7 +78575,7 @@ class TrianglesDataTextureOcclusionRenderer {
78463
78575
  this._uViewMatrix = program.getLocation("viewMatrix");
78464
78576
  this._uProjMatrix = program.getLocation("projMatrix");
78465
78577
  this._uSectionPlanes = [];
78466
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
78578
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
78467
78579
  this._uSectionPlanes.push({
78468
78580
  active: program.getLocation("sectionPlaneActive" + i),
78469
78581
  pos: program.getLocation("sectionPlanePos" + i),
@@ -78503,7 +78615,7 @@ class TrianglesDataTextureOcclusionRenderer {
78503
78615
 
78504
78616
  _buildVertexShader() {
78505
78617
  const scene = this._scene;
78506
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
78618
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
78507
78619
  const src = [];
78508
78620
  src.push("#version 300 es");
78509
78621
  src.push("// TrianglesDataTextureOcclusionRenderer vertex shader");
@@ -78644,7 +78756,7 @@ class TrianglesDataTextureOcclusionRenderer {
78644
78756
  _buildFragmentShader() {
78645
78757
  const scene = this._scene;
78646
78758
  const sectionPlanesState = scene._sectionPlanesState;
78647
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
78759
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
78648
78760
  const src = [];
78649
78761
  src.push('#version 300 es');
78650
78762
  src.push("// TrianglesDataTextureColorRenderer fragment shader");
@@ -78658,7 +78770,7 @@ class TrianglesDataTextureOcclusionRenderer {
78658
78770
  if (clipping) {
78659
78771
  src.push("in vec4 vWorldPosition;");
78660
78772
  src.push("flat in uint vFlags2;");
78661
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
78773
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
78662
78774
  src.push("uniform bool sectionPlaneActive" + i + ";");
78663
78775
  src.push("uniform vec3 sectionPlanePos" + i + ";");
78664
78776
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -78670,7 +78782,7 @@ class TrianglesDataTextureOcclusionRenderer {
78670
78782
  src.push(" bool clippable = (float(vFlags2) > 0.0);");
78671
78783
  src.push(" if (clippable) {");
78672
78784
  src.push(" float dist = 0.0;");
78673
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
78785
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
78674
78786
  src.push(" if (sectionPlaneActive" + i + ") {");
78675
78787
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
78676
78788
  src.push(" }");
@@ -78698,7 +78810,7 @@ class TrianglesDataTextureOcclusionRenderer {
78698
78810
  const tempVec3a$b = math.vec3();
78699
78811
  const tempVec3b$7 = math.vec3();
78700
78812
  const tempVec3c$6 = math.vec3();
78701
- const tempVec3d$3 = math.vec3();
78813
+ math.vec3();
78702
78814
  const tempMat4a$3 = math.mat4();
78703
78815
 
78704
78816
  /**
@@ -78792,25 +78904,30 @@ class TrianglesDataTextureDepthRenderer {
78792
78904
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
78793
78905
  }
78794
78906
 
78907
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
78795
78908
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
78796
- if (numSectionPlanes > 0) {
78909
+ if (numAllocatedSectionPlanes > 0) {
78797
78910
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
78798
78911
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
78799
78912
  const renderFlags = model.renderFlags;
78800
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
78913
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
78801
78914
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
78802
78915
  if (sectionPlaneUniforms) {
78803
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
78804
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
78805
- if (active) {
78806
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
78807
- if (origin) {
78808
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3d$3);
78809
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
78810
- } else {
78811
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
78916
+ if (sectionPlaneIndex < numSectionPlanes) {
78917
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
78918
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
78919
+ if (active) {
78920
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
78921
+ if (origin) {
78922
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$b);
78923
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
78924
+ } else {
78925
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
78926
+ }
78927
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
78812
78928
  }
78813
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
78929
+ } else {
78930
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
78814
78931
  }
78815
78932
  }
78816
78933
  }
@@ -78921,9 +79038,7 @@ class TrianglesDataTextureDepthRenderer {
78921
79038
 
78922
79039
  _buildVertexShader() {
78923
79040
  const scene = this._scene;
78924
- const sectionPlanesState = scene._sectionPlanesState;
78925
- scene._lightsState;
78926
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
79041
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
78927
79042
  const src = [];
78928
79043
  src.push("#version 300 es");
78929
79044
  src.push("// Triangles dataTexture draw vertex shader");
@@ -79084,8 +79199,7 @@ class TrianglesDataTextureDepthRenderer {
79084
79199
 
79085
79200
  _buildFragmentShader() {
79086
79201
  const scene = this._scene;
79087
- const sectionPlanesState = scene._sectionPlanesState;
79088
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
79202
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
79089
79203
  const src = [];
79090
79204
  src.push('#version 300 es');
79091
79205
  src.push("// Triangles dataTexture draw fragment shader");
@@ -79108,7 +79222,7 @@ class TrianglesDataTextureDepthRenderer {
79108
79222
  if (clipping) {
79109
79223
  src.push("in vec4 vWorldPosition;");
79110
79224
  src.push("flat in uint vFlags2;");
79111
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
79225
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
79112
79226
  src.push("uniform bool sectionPlaneActive" + i + ";");
79113
79227
  src.push("uniform vec3 sectionPlanePos" + i + ";");
79114
79228
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -79120,7 +79234,7 @@ class TrianglesDataTextureDepthRenderer {
79120
79234
  src.push(" bool clippable = vFlags2 > 0u;");
79121
79235
  src.push(" if (clippable) {");
79122
79236
  src.push(" float dist = 0.0;");
79123
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
79237
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
79124
79238
  src.push("if (sectionPlaneActive" + i + ") {");
79125
79239
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
79126
79240
  src.push("}");
@@ -79156,7 +79270,7 @@ class TrianglesDataTextureDepthRenderer {
79156
79270
  const tempVec3a$a = math.vec3();
79157
79271
  const tempVec3b$6 = math.vec3();
79158
79272
  const tempVec3c$5 = math.vec3();
79159
- const tempVec3d$2 = math.vec3();
79273
+ math.vec3();
79160
79274
  const tempMat4a$2 = math.mat4();
79161
79275
 
79162
79276
  /**
@@ -79241,25 +79355,30 @@ class TrianglesDataTextureNormalsRenderer {
79241
79355
  gl.uniformMatrix4fv(this._uViewNormalMatrix, false, camera.viewNormalMatrix);
79242
79356
  gl.uniformMatrix4fv(this._uWorldNormalMatrix, false, model.worldNormalMatrix);
79243
79357
 
79358
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
79244
79359
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
79245
- if (numSectionPlanes > 0) {
79360
+ if (numAllocatedSectionPlanes > 0) {
79246
79361
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
79247
79362
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
79248
79363
  const renderFlags = model.renderFlags;
79249
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
79364
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
79250
79365
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
79251
79366
  if (sectionPlaneUniforms) {
79252
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
79253
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
79254
- if (active) {
79255
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
79256
- if (origin) {
79257
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3d$2);
79258
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
79259
- } else {
79260
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
79367
+ if (sectionPlaneIndex < numSectionPlanes) {
79368
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
79369
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
79370
+ if (active) {
79371
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
79372
+ if (origin) {
79373
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$a);
79374
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
79375
+ } else {
79376
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
79377
+ }
79378
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
79261
79379
  }
79262
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
79380
+ } else {
79381
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
79263
79382
  }
79264
79383
  }
79265
79384
  }
@@ -79297,7 +79416,7 @@ class TrianglesDataTextureNormalsRenderer {
79297
79416
  this._uViewNormalMatrix = program.getLocation("viewNormalMatrix");
79298
79417
  this._uProjMatrix = program.getLocation("projMatrix");
79299
79418
  this._uSectionPlanes = [];
79300
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
79419
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
79301
79420
  this._uSectionPlanes.push({
79302
79421
  active: program.getLocation("sectionPlaneActive" + i),
79303
79422
  pos: program.getLocation("sectionPlanePos" + i),
@@ -79338,7 +79457,7 @@ class TrianglesDataTextureNormalsRenderer {
79338
79457
 
79339
79458
  _buildVertexShader() {
79340
79459
  const scene = this._scene;
79341
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
79460
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
79342
79461
  const src = [];
79343
79462
  src.push("// Batched geometry normals vertex shader");
79344
79463
  if (scene.logarithmicDepthBufferEnabled && WEBGL_INFO.SUPPORTED_EXTENSIONS["EXT_frag_depth"]) {
@@ -79420,8 +79539,7 @@ class TrianglesDataTextureNormalsRenderer {
79420
79539
 
79421
79540
  _buildFragmentShader() {
79422
79541
  const scene = this._scene;
79423
- const sectionPlanesState = scene._sectionPlanesState;
79424
- const clipping = (sectionPlanesState.sectionPlanes.length > 0);
79542
+ const clipping = (scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0);
79425
79543
  const src = [];
79426
79544
  src.push("#version 300 es");
79427
79545
  src.push("// Batched geometry normals fragment shader");
@@ -79447,7 +79565,7 @@ class TrianglesDataTextureNormalsRenderer {
79447
79565
  if (clipping) {
79448
79566
  src.push("in vec4 vWorldPosition;");
79449
79567
  src.push("in vec4 vFlags2;");
79450
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
79568
+ for (let i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
79451
79569
  src.push("uniform bool sectionPlaneActive" + i + ";");
79452
79570
  src.push("uniform vec3 sectionPlanePos" + i + ";");
79453
79571
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -79462,7 +79580,7 @@ class TrianglesDataTextureNormalsRenderer {
79462
79580
  src.push(" bool clippable = (float(vFlags2.x) > 0.0);");
79463
79581
  src.push(" if (clippable) {");
79464
79582
  src.push(" float dist = 0.0;");
79465
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
79583
+ for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
79466
79584
  src.push(" if (sectionPlaneActive" + i + ") {");
79467
79585
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
79468
79586
  src.push(" }");
@@ -79493,7 +79611,7 @@ class TrianglesDataTextureNormalsRenderer {
79493
79611
  const tempVec3a$9 = math.vec3();
79494
79612
  const tempVec3b$5 = math.vec3();
79495
79613
  const tempVec3c$4 = math.vec3();
79496
- const tempVec3d$1 = math.vec3();
79614
+ math.vec3();
79497
79615
 
79498
79616
  math.vec4();
79499
79617
 
@@ -79591,25 +79709,30 @@ class TrianglesDataTexturePickNormalsFlatRenderer {
79591
79709
  const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2);
79592
79710
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
79593
79711
  }
79712
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
79594
79713
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
79595
- if (numSectionPlanes > 0) {
79714
+ if (numAllocatedSectionPlanes > 0) {
79596
79715
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
79597
79716
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
79598
79717
  const renderFlags = model.renderFlags;
79599
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
79718
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
79600
79719
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
79601
79720
  if (sectionPlaneUniforms) {
79602
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
79603
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
79604
- if (active) {
79605
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
79606
- if (origin) {
79607
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3d$1);
79608
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
79609
- } else {
79610
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
79721
+ if (sectionPlaneIndex < numSectionPlanes) {
79722
+ const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
79723
+ gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
79724
+ if (active) {
79725
+ const sectionPlane = sectionPlanes[sectionPlaneIndex];
79726
+ if (origin) {
79727
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$9);
79728
+ gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
79729
+ } else {
79730
+ gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
79731
+ }
79732
+ gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
79611
79733
  }
79612
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
79734
+ } else {
79735
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
79613
79736
  }
79614
79737
  }
79615
79738
  }
@@ -79706,9 +79829,7 @@ class TrianglesDataTexturePickNormalsFlatRenderer {
79706
79829
 
79707
79830
  _buildVertexShader() {
79708
79831
  const scene = this._scene;
79709
- const sectionPlanesState = scene._sectionPlanesState;
79710
- scene._lightsState;
79711
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
79832
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
79712
79833
  const src = [];
79713
79834
  src.push("#version 300 es");
79714
79835
  src.push("// trianglesDatatextureNormalsRenderer vertex shader");
@@ -79874,8 +79995,7 @@ class TrianglesDataTexturePickNormalsFlatRenderer {
79874
79995
 
79875
79996
  _buildFragmentShader() {
79876
79997
  const scene = this._scene;
79877
- const sectionPlanesState = scene._sectionPlanesState;
79878
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
79998
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
79879
79999
  const src = [];
79880
80000
  src.push('#version 300 es');
79881
80001
  src.push("// TrianglesDataTexturePickNormalsRenderer fragment shader");
@@ -79894,7 +80014,7 @@ class TrianglesDataTexturePickNormalsFlatRenderer {
79894
80014
  src.push("in vec4 vWorldPosition;");
79895
80015
  if (clipping) {
79896
80016
  src.push("flat in uint vFlags2;");
79897
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
80017
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
79898
80018
  src.push("uniform bool sectionPlaneActive" + i + ";");
79899
80019
  src.push("uniform vec3 sectionPlanePos" + i + ";");
79900
80020
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -79906,7 +80026,7 @@ class TrianglesDataTexturePickNormalsFlatRenderer {
79906
80026
  src.push(" bool clippable = vFlags2 > 0u;");
79907
80027
  src.push(" if (clippable) {");
79908
80028
  src.push(" float dist = 0.0;");
79909
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
80029
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
79910
80030
  src.push("if (sectionPlaneActive" + i + ") {");
79911
80031
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
79912
80032
  src.push("}");
@@ -100249,6 +100369,11 @@ class Viewer {
100249
100369
  * 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
100250
100370
  * 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)
100251
100371
  * mode for storing geometry, which is the standard technique used in most graphics engines, and will work adequately on most low-end GPUs.
100372
+ * @param {number} [cfg.numPreallocatedSectionPlanes=0] Enhances the efficiency of SectionPlane creation by proactively allocating Viewer resources for a specified quantity
100373
+ * of SectionPlanes. Introducing this parameter streamlines the initial creation speed of SectionPlanes, particularly up to the designated quantity. This parameter internally
100374
+ * configures renderer logic for the specified number of SectionPlanes, eliminating the need for setting up logic with each SectionPlane creation and thereby enhancing
100375
+ * 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
100376
+ * your expected usage.
100252
100377
  */
100253
100378
  constructor(cfg) {
100254
100379
 
@@ -100306,7 +100431,8 @@ class Viewer {
100306
100431
  logarithmicDepthBufferEnabled: (!!cfg.logarithmicDepthBufferEnabled),
100307
100432
  pbrEnabled: (!!cfg.pbrEnabled),
100308
100433
  colorTextureEnabled: (cfg.colorTextureEnabled !== false),
100309
- dtxEnabled: (!!cfg.dtxEnabled)
100434
+ dtxEnabled: (!!cfg.dtxEnabled),
100435
+ numPreallocatedSectionPlanes: cfg.numPreallocatedSectionPlanes
100310
100436
  });
100311
100437
 
100312
100438
  /**