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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/dist/xeokit-sdk.cjs.js +709 -588
  2. package/dist/xeokit-sdk.es.js +709 -588
  3. package/dist/xeokit-sdk.es5.js +203 -194
  4. package/dist/xeokit-sdk.min.cjs.js +4 -4
  5. package/dist/xeokit-sdk.min.es.js +4 -4
  6. package/dist/xeokit-sdk.min.es5.js +3 -3
  7. package/package.json +1 -1
  8. package/src/viewer/Viewer.js +7 -1
  9. package/src/viewer/scene/mesh/draw/DrawRenderer.js +18 -8
  10. package/src/viewer/scene/mesh/draw/DrawShaderSource.js +8 -8
  11. package/src/viewer/scene/mesh/emphasis/EmphasisEdgesRenderer.js +19 -9
  12. package/src/viewer/scene/mesh/emphasis/EmphasisEdgesShaderSource.js +3 -3
  13. package/src/viewer/scene/mesh/emphasis/EmphasisFillRenderer.js +19 -9
  14. package/src/viewer/scene/mesh/emphasis/EmphasisFillShaderSource.js +3 -3
  15. package/src/viewer/scene/mesh/occlusion/OcclusionRenderer.js +18 -8
  16. package/src/viewer/scene/mesh/occlusion/OcclusionShaderSource.js +3 -3
  17. package/src/viewer/scene/mesh/pick/PickMeshRenderer.js +18 -8
  18. package/src/viewer/scene/mesh/pick/PickMeshShaderSource.js +3 -3
  19. package/src/viewer/scene/mesh/pick/PickTriangleRenderer.js +18 -8
  20. package/src/viewer/scene/mesh/pick/PickTriangleShaderSource.js +3 -3
  21. package/src/viewer/scene/mesh/shadow/ShadowRenderer.js +1 -1
  22. package/src/viewer/scene/mesh/shadow/ShadowShaderSource.js +3 -3
  23. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureColorRenderer.js +22 -17
  24. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureDepthRenderer.js +21 -20
  25. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureEdgesColorRenderer.js +6 -9
  26. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureEdgesRenderer.js +21 -18
  27. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureNormalsRenderer.js +22 -18
  28. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureOcclusionRenderer.js +22 -17
  29. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTexturePickDepthRenderer.js +22 -18
  30. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTexturePickMeshRenderer.js +58 -54
  31. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTexturePickNormalsFlatRenderer.js +21 -19
  32. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTexturePickNormalsRenderer.js +22 -18
  33. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureSilhouetteRenderer.js +21 -18
  34. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureSnapDepthBufInitRenderer.js +21 -18
  35. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureSnapDepthRenderer.js +21 -18
  36. package/src/viewer/scene/model/vbo/VBOSceneModelRenderers.js +21 -16
  37. package/src/viewer/scene/model/vbo/linesBatching/renderers/LinesBatchingColorRenderer.js +4 -4
  38. package/src/viewer/scene/model/vbo/linesBatching/renderers/LinesBatchingSilhouetteRenderer.js +4 -4
  39. package/src/viewer/scene/model/vbo/linesInstancing/renderers/LinesInstancingColorRenderer.js +4 -4
  40. package/src/viewer/scene/model/vbo/linesInstancing/renderers/LinesInstancingSilhouetteRenderer.js +4 -4
  41. package/src/viewer/scene/model/vbo/pointsBatching/renderers/PointsBatchingColorRenderer.js +4 -4
  42. package/src/viewer/scene/model/vbo/pointsBatching/renderers/PointsBatchingOcclusionRenderer.js +4 -4
  43. package/src/viewer/scene/model/vbo/pointsBatching/renderers/PointsBatchingPickDepthRenderer.js +4 -4
  44. package/src/viewer/scene/model/vbo/pointsBatching/renderers/PointsBatchingPickMeshRenderer.js +4 -4
  45. package/src/viewer/scene/model/vbo/pointsBatching/renderers/PointsBatchingShadowRenderer.js +4 -4
  46. package/src/viewer/scene/model/vbo/pointsBatching/renderers/PointsBatchingSilhouetteRenderer.js +4 -4
  47. package/src/viewer/scene/model/vbo/pointsInstancing/renderers/PointsInstancingColorRenderer.js +4 -4
  48. package/src/viewer/scene/model/vbo/pointsInstancing/renderers/PointsInstancingDepthRenderer.js +4 -4
  49. package/src/viewer/scene/model/vbo/pointsInstancing/renderers/PointsInstancingOcclusionRenderer.js +4 -4
  50. package/src/viewer/scene/model/vbo/pointsInstancing/renderers/PointsInstancingPickDepthRenderer.js +4 -4
  51. package/src/viewer/scene/model/vbo/pointsInstancing/renderers/PointsInstancingPickMeshRenderer.js +4 -4
  52. package/src/viewer/scene/model/vbo/pointsInstancing/renderers/PointsInstancingShadowRenderer.js +4 -4
  53. package/src/viewer/scene/model/vbo/pointsInstancing/renderers/PointsInstancingSilhouetteRenderer.js +4 -4
  54. package/src/viewer/scene/model/vbo/snapBatching/SnapBatchingDepthBufInitRenderer.js +4 -4
  55. package/src/viewer/scene/model/vbo/snapBatching/SnapBatchingDepthRenderer.js +4 -4
  56. package/src/viewer/scene/model/vbo/snapInstancing/SnapInstancingDepthBufInitRenderer.js +4 -4
  57. package/src/viewer/scene/model/vbo/snapInstancing/SnapInstancingDepthRenderer.js +4 -4
  58. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingColorRenderer.js +4 -4
  59. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingColorTextureRenderer.js +4 -4
  60. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingDepthRenderer.js +4 -4
  61. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingEdgesColorRenderer.js +4 -4
  62. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingEdgesRenderer.js +4 -4
  63. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingFlatColorRenderer.js +4 -4
  64. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingNormalsRenderer.js +4 -4
  65. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingOcclusionRenderer.js +4 -4
  66. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingPBRRenderer.js +4 -4
  67. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingPickDepthRenderer.js +4 -4
  68. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingPickMeshRenderer.js +4 -4
  69. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingPickNormalsFlatRenderer.js +4 -4
  70. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingPickNormalsRenderer.js +4 -4
  71. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingShadowRenderer.js +4 -4
  72. package/src/viewer/scene/model/vbo/trianglesBatching/renderers/TrianglesBatchingSilhouetteRenderer.js +4 -4
  73. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingColorRenderer.js +4 -4
  74. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingColorTextureRenderer.js +4 -4
  75. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingDepthRenderer.js +4 -4
  76. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingEdgesColorRenderer.js +4 -4
  77. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingEdgesRenderer.js +4 -4
  78. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingFlatColorRenderer.js +4 -4
  79. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingFlatNormalsRenderer.js +4 -4
  80. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingNormalsRenderer.js +4 -4
  81. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingOcclusionRenderer.js +4 -4
  82. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingPBRRenderer.js +4 -4
  83. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingPickDepthRenderer.js +4 -4
  84. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingPickMeshRenderer.js +4 -4
  85. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingPickNormalsFlatRenderer.js +4 -4
  86. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingPickNormalsRenderer.js +4 -4
  87. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingShadowRenderer.js +4 -4
  88. package/src/viewer/scene/model/vbo/trianglesInstancing/renderers/TrianglesInstancingSilhouetteRenderer.js +4 -4
  89. package/src/viewer/scene/scene/Scene.js +24 -9
  90. package/src/viewer/scene/sectionPlane/SectionPlaneCache.js +101 -0
@@ -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;
@@ -56585,32 +56660,38 @@ class VBOSceneModelRenderer {
56585
56660
  const {gl} = scene.canvas;
56586
56661
  const {model, layerIndex} = layer;
56587
56662
 
56663
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
56588
56664
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
56589
- if (numSectionPlanes > 0) {
56665
+ if (numAllocatedSectionPlanes > 0) {
56590
56666
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
56591
56667
  const baseIndex = layerIndex * numSectionPlanes;
56592
56668
  const renderFlags = model.renderFlags;
56593
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
56669
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
56594
56670
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
56595
56671
  if (sectionPlaneUniforms) {
56596
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
56597
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
56598
- if (active) {
56599
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
56600
- const origin = layer._state.origin;
56601
- if (origin) {
56602
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$s);
56603
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
56604
- } else {
56605
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
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);
56606
56685
  }
56607
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
56686
+ } else {
56687
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
56608
56688
  }
56609
56689
  }
56610
56690
  }
56611
56691
  }
56612
56692
  }
56613
56693
 
56694
+
56614
56695
  _allocate() {
56615
56696
  const scene = this._scene;
56616
56697
  const gl = scene.canvas.gl;
@@ -56691,7 +56772,7 @@ class VBOSceneModelRenderer {
56691
56772
 
56692
56773
  this._uSectionPlanes = [];
56693
56774
 
56694
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
56775
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
56695
56776
  this._uSectionPlanes.push({
56696
56777
  active: program.getLocation("sectionPlaneActive" + i),
56697
56778
  pos: program.getLocation("sectionPlanePos" + i),
@@ -57157,12 +57238,11 @@ class VBOSceneModelTriangleBatchingEdgesRenderer extends VBOSceneModelTriangleBa
57157
57238
  }
57158
57239
 
57159
57240
 
57160
-
57161
57241
  /**
57162
57242
  * @private
57163
57243
  */
57164
57244
  class VBOSceneModelTriangleInstancingRenderer extends VBOSceneModelRenderer {
57165
- constructor(scene, withSAO, { edges = false} = {}) {
57245
+ constructor(scene, withSAO, {edges = false} = {}) {
57166
57246
  super(scene, withSAO, {instancing: true, edges});
57167
57247
  }
57168
57248
 
@@ -57309,7 +57389,7 @@ class TrianglesBatchingColorRenderer extends VBOSceneModelTriangleBatchingRender
57309
57389
  const scene = this._scene;
57310
57390
  const sectionPlanesState = scene._sectionPlanesState;
57311
57391
  const lightsState = scene._lightsState;
57312
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
57392
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57313
57393
  let light;
57314
57394
  const src = [];
57315
57395
  src.push("#version 300 es");
@@ -57448,7 +57528,7 @@ class TrianglesBatchingColorRenderer extends VBOSceneModelTriangleBatchingRender
57448
57528
  _buildFragmentShader() {
57449
57529
  const scene = this._scene;
57450
57530
  const sectionPlanesState = scene._sectionPlanesState;
57451
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
57531
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57452
57532
  const src = [];
57453
57533
  src.push("#version 300 es");
57454
57534
  src.push("// Triangles batching draw fragment shader");
@@ -57481,7 +57561,7 @@ class TrianglesBatchingColorRenderer extends VBOSceneModelTriangleBatchingRender
57481
57561
  if (clipping) {
57482
57562
  src.push("in vec4 vWorldPosition;");
57483
57563
  src.push("in float vFlags;");
57484
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
57564
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
57485
57565
  src.push("uniform bool sectionPlaneActive" + i + ";");
57486
57566
  src.push("uniform vec3 sectionPlanePos" + i + ";");
57487
57567
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -57495,7 +57575,7 @@ class TrianglesBatchingColorRenderer extends VBOSceneModelTriangleBatchingRender
57495
57575
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
57496
57576
  src.push(" if (clippable) {");
57497
57577
  src.push(" float dist = 0.0;");
57498
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
57578
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
57499
57579
  src.push("if (sectionPlaneActive" + i + ") {");
57500
57580
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
57501
57581
  src.push("}");
@@ -57541,7 +57621,7 @@ class TrianglesBatchingFlatColorRenderer extends VBOSceneModelTriangleBatchingRe
57541
57621
  _buildVertexShader() {
57542
57622
  const scene = this._scene;
57543
57623
  const sectionPlanesState = scene._sectionPlanesState;
57544
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
57624
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57545
57625
  const src = [];
57546
57626
  src.push("#version 300 es");
57547
57627
  src.push("// Triangles batching flat-shading draw vertex shader");
@@ -57613,7 +57693,7 @@ class TrianglesBatchingFlatColorRenderer extends VBOSceneModelTriangleBatchingRe
57613
57693
  const scene = this._scene;
57614
57694
  const lightsState = scene._lightsState;
57615
57695
  const sectionPlanesState = scene._sectionPlanesState;
57616
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
57696
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57617
57697
  const src = [];
57618
57698
  src.push("#version 300 es");
57619
57699
  src.push("// Triangles batching flat-shading draw fragment shader");
@@ -57649,7 +57729,7 @@ class TrianglesBatchingFlatColorRenderer extends VBOSceneModelTriangleBatchingRe
57649
57729
  if (clipping) {
57650
57730
  src.push("in vec4 vWorldPosition;");
57651
57731
  src.push("in float vFlags;");
57652
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
57732
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
57653
57733
  src.push("uniform bool sectionPlaneActive" + i + ";");
57654
57734
  src.push("uniform vec3 sectionPlanePos" + i + ";");
57655
57735
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -57687,7 +57767,7 @@ class TrianglesBatchingFlatColorRenderer extends VBOSceneModelTriangleBatchingRe
57687
57767
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
57688
57768
  src.push(" if (clippable) {");
57689
57769
  src.push(" float dist = 0.0;");
57690
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
57770
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
57691
57771
  src.push("if (sectionPlaneActive" + i + ") {");
57692
57772
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
57693
57773
  src.push("}");
@@ -57776,7 +57856,7 @@ class TrianglesBatchingSilhouetteRenderer extends VBOSceneModelTriangleBatchingR
57776
57856
 
57777
57857
  const scene = this._scene;
57778
57858
  const sectionPlanesState = scene._sectionPlanesState;
57779
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
57859
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57780
57860
 
57781
57861
  const src = [];
57782
57862
  src.push("#version 300 es");
@@ -57847,7 +57927,7 @@ class TrianglesBatchingSilhouetteRenderer extends VBOSceneModelTriangleBatchingR
57847
57927
  const sectionPlanesState = scene._sectionPlanesState;
57848
57928
  let i;
57849
57929
  let len;
57850
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
57930
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57851
57931
  const src = [];
57852
57932
  src.push("#version 300 es");
57853
57933
  src.push("// Triangles batching silhouette fragment shader");
@@ -57867,7 +57947,7 @@ class TrianglesBatchingSilhouetteRenderer extends VBOSceneModelTriangleBatchingR
57867
57947
  if (clipping) {
57868
57948
  src.push("in vec4 vWorldPosition;");
57869
57949
  src.push("in float vFlags;");
57870
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
57950
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
57871
57951
  src.push("uniform bool sectionPlaneActive" + i + ";");
57872
57952
  src.push("uniform vec3 sectionPlanePos" + i + ";");
57873
57953
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -57880,7 +57960,7 @@ class TrianglesBatchingSilhouetteRenderer extends VBOSceneModelTriangleBatchingR
57880
57960
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
57881
57961
  src.push(" if (clippable) {");
57882
57962
  src.push(" float dist = 0.0;");
57883
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
57963
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
57884
57964
  src.push("if (sectionPlaneActive" + i + ") {");
57885
57965
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
57886
57966
  src.push("}");
@@ -57909,7 +57989,7 @@ class TrianglesBatchingEdgesRenderer extends VBOSceneModelTriangleBatchingEdgesR
57909
57989
  _buildVertexShader() {
57910
57990
  const scene = this._scene;
57911
57991
  const sectionPlanesState = scene._sectionPlanesState;
57912
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
57992
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57913
57993
  const src = [];
57914
57994
 
57915
57995
  src.push("#version 300 es");
@@ -57978,7 +58058,7 @@ class TrianglesBatchingEdgesRenderer extends VBOSceneModelTriangleBatchingEdgesR
57978
58058
  _buildFragmentShader() {
57979
58059
  const scene = this._scene;
57980
58060
  const sectionPlanesState = scene._sectionPlanesState;
57981
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
58061
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
57982
58062
  const src = [];
57983
58063
  src.push("#version 300 es");
57984
58064
  src.push("// Batched geometry edges drawing fragment shader");
@@ -57998,7 +58078,7 @@ class TrianglesBatchingEdgesRenderer extends VBOSceneModelTriangleBatchingEdgesR
57998
58078
  if (clipping) {
57999
58079
  src.push("in vec4 vWorldPosition;");
58000
58080
  src.push("in float vFlags;");
58001
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
58081
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
58002
58082
  src.push("uniform bool sectionPlaneActive" + i + ";");
58003
58083
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58004
58084
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58011,7 +58091,7 @@ class TrianglesBatchingEdgesRenderer extends VBOSceneModelTriangleBatchingEdgesR
58011
58091
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58012
58092
  src.push(" if (clippable) {");
58013
58093
  src.push(" float dist = 0.0;");
58014
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
58094
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
58015
58095
  src.push("if (sectionPlaneActive" + i + ") {");
58016
58096
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58017
58097
  src.push("}");
@@ -58036,7 +58116,7 @@ class TrianglesBatchingEdgesColorRenderer extends VBOSceneModelTriangleBatchingE
58036
58116
  _buildVertexShader() {
58037
58117
  const scene = this._scene;
58038
58118
  const sectionPlanesState = scene._sectionPlanesState;
58039
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
58119
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58040
58120
  const src = [];
58041
58121
  src.push("#version 300 es");
58042
58122
  src.push("// Batched geometry edges drawing vertex shader");
@@ -58105,7 +58185,7 @@ class TrianglesBatchingEdgesColorRenderer extends VBOSceneModelTriangleBatchingE
58105
58185
  _buildFragmentShader() {
58106
58186
  const scene = this._scene;
58107
58187
  const sectionPlanesState = scene._sectionPlanesState;
58108
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
58188
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58109
58189
  const src = [];
58110
58190
  src.push("#version 300 es");
58111
58191
  src.push("// Batched geometry edges drawing fragment shader");
@@ -58124,7 +58204,7 @@ class TrianglesBatchingEdgesColorRenderer extends VBOSceneModelTriangleBatchingE
58124
58204
  if (clipping) {
58125
58205
  src.push("in vec4 vWorldPosition;");
58126
58206
  src.push("in float vFlags;");
58127
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
58207
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
58128
58208
  src.push("uniform bool sectionPlaneActive" + i + ";");
58129
58209
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58130
58210
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58137,7 +58217,7 @@ class TrianglesBatchingEdgesColorRenderer extends VBOSceneModelTriangleBatchingE
58137
58217
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58138
58218
  src.push(" if (clippable) {");
58139
58219
  src.push(" float dist = 0.0;");
58140
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
58220
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
58141
58221
  src.push("if (sectionPlaneActive" + i + ") {");
58142
58222
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58143
58223
  src.push("}");
@@ -58161,7 +58241,7 @@ class TrianglesBatchingPickMeshRenderer extends VBOSceneModelTriangleBatchingRen
58161
58241
 
58162
58242
  _buildVertexShader() {
58163
58243
  const scene = this._scene;
58164
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
58244
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58165
58245
  const src = [];
58166
58246
  src.push("#version 300 es");
58167
58247
  src.push("// Batched geometry picking vertex shader");
@@ -58233,7 +58313,7 @@ class TrianglesBatchingPickMeshRenderer extends VBOSceneModelTriangleBatchingRen
58233
58313
  _buildFragmentShader() {
58234
58314
  const scene = this._scene;
58235
58315
  const sectionPlanesState = scene._sectionPlanesState;
58236
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
58316
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58237
58317
  const src = [];
58238
58318
  src.push("#version 300 es");
58239
58319
  src.push("// Batched geometry picking fragment shader");
@@ -58253,7 +58333,7 @@ class TrianglesBatchingPickMeshRenderer extends VBOSceneModelTriangleBatchingRen
58253
58333
  if (clipping) {
58254
58334
  src.push("in vec4 vWorldPosition;");
58255
58335
  src.push("in float vFlags;");
58256
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58336
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58257
58337
  src.push("uniform bool sectionPlaneActive" + i + ";");
58258
58338
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58259
58339
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58266,7 +58346,7 @@ class TrianglesBatchingPickMeshRenderer extends VBOSceneModelTriangleBatchingRen
58266
58346
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58267
58347
  src.push(" if (clippable) {");
58268
58348
  src.push(" float dist = 0.0;");
58269
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58349
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58270
58350
  src.push(" if (sectionPlaneActive" + i + ") {");
58271
58351
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58272
58352
  src.push(" }");
@@ -58291,7 +58371,7 @@ class TrianglesBatchingPickDepthRenderer extends VBOSceneModelTriangleBatchingRe
58291
58371
  _buildVertexShader() {
58292
58372
 
58293
58373
  const scene = this._scene;
58294
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
58374
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58295
58375
  const src = [];
58296
58376
  src.push("#version 300 es");
58297
58377
  src.push("// Triangles batching pick depth vertex shader");
@@ -58361,7 +58441,7 @@ class TrianglesBatchingPickDepthRenderer extends VBOSceneModelTriangleBatchingRe
58361
58441
 
58362
58442
  const scene = this._scene;
58363
58443
  const sectionPlanesState = scene._sectionPlanesState;
58364
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
58444
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58365
58445
  const src = [];
58366
58446
  src.push("#version 300 es");
58367
58447
  src.push("// Triangles batching pick depth fragment shader");
@@ -58388,7 +58468,7 @@ class TrianglesBatchingPickDepthRenderer extends VBOSceneModelTriangleBatchingRe
58388
58468
  if (clipping) {
58389
58469
  src.push("in vec4 vWorldPosition;");
58390
58470
  src.push("in float vFlags;");
58391
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58471
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58392
58472
  src.push("uniform bool sectionPlaneActive" + i + ";");
58393
58473
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58394
58474
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58408,7 +58488,7 @@ class TrianglesBatchingPickDepthRenderer extends VBOSceneModelTriangleBatchingRe
58408
58488
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58409
58489
  src.push(" if (clippable) {");
58410
58490
  src.push(" float dist = 0.0;");
58411
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58491
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58412
58492
  src.push(" if (sectionPlaneActive" + i + ") {");
58413
58493
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58414
58494
  src.push(" }");
@@ -58433,7 +58513,7 @@ class TrianglesBatchingPickNormalsRenderer extends VBOSceneModelTriangleBatching
58433
58513
 
58434
58514
  _buildVertexShader() {
58435
58515
  const scene = this._scene;
58436
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
58516
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58437
58517
  const src = [];
58438
58518
  src.push("#version 300 es");
58439
58519
  src.push("// Triangles batching pick normals vertex shader");
@@ -58504,7 +58584,7 @@ class TrianglesBatchingPickNormalsRenderer extends VBOSceneModelTriangleBatching
58504
58584
  _buildFragmentShader() {
58505
58585
  const scene = this._scene;
58506
58586
  const sectionPlanesState = scene._sectionPlanesState;
58507
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
58587
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58508
58588
  const src = [];
58509
58589
  src.push("#version 300 es");
58510
58590
  src.push("// Triangles batching pick normals fragment shader");
@@ -58524,7 +58604,7 @@ class TrianglesBatchingPickNormalsRenderer extends VBOSceneModelTriangleBatching
58524
58604
  if (clipping) {
58525
58605
  src.push("in vec4 vWorldPosition;");
58526
58606
  src.push("in float vFlags;");
58527
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58607
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58528
58608
  src.push("uniform bool sectionPlaneActive" + i + ";");
58529
58609
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58530
58610
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58537,7 +58617,7 @@ class TrianglesBatchingPickNormalsRenderer extends VBOSceneModelTriangleBatching
58537
58617
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58538
58618
  src.push(" if (clippable) {");
58539
58619
  src.push(" float dist = 0.0;");
58540
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58620
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58541
58621
  src.push(" if (sectionPlaneActive" + i + ") {");
58542
58622
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58543
58623
  src.push(" }");
@@ -58561,7 +58641,7 @@ class TrianglesBatchingOcclusionRenderer extends VBOSceneModelTriangleBatchingRe
58561
58641
 
58562
58642
  _buildVertexShader() {
58563
58643
  const scene = this._scene;
58564
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
58644
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58565
58645
  const src = [];
58566
58646
  src.push("#version 300 es");
58567
58647
  src.push("// Triangles batching occlusion vertex shader");
@@ -58610,7 +58690,7 @@ class TrianglesBatchingOcclusionRenderer extends VBOSceneModelTriangleBatchingRe
58610
58690
  _buildFragmentShader() {
58611
58691
  const scene = this._scene;
58612
58692
  const sectionPlanesState = scene._sectionPlanesState;
58613
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
58693
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58614
58694
  const src = [];
58615
58695
  src.push("#version 300 es");
58616
58696
  src.push("// Triangles batching occlusion fragment shader");
@@ -58625,7 +58705,7 @@ class TrianglesBatchingOcclusionRenderer extends VBOSceneModelTriangleBatchingRe
58625
58705
  if (clipping) {
58626
58706
  src.push("in vec4 vWorldPosition;");
58627
58707
  src.push("in float vFlags;");
58628
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58708
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58629
58709
  src.push("uniform bool sectionPlaneActive" + i + ";");
58630
58710
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58631
58711
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58637,7 +58717,7 @@ class TrianglesBatchingOcclusionRenderer extends VBOSceneModelTriangleBatchingRe
58637
58717
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58638
58718
  src.push(" if (clippable) {");
58639
58719
  src.push(" float dist = 0.0;");
58640
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58720
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58641
58721
  src.push(" if (sectionPlaneActive" + i + ") {");
58642
58722
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58643
58723
  src.push(" }");
@@ -58658,7 +58738,7 @@ class TrianglesBatchingDepthRenderer extends VBOSceneModelTriangleBatchingRender
58658
58738
 
58659
58739
  _buildVertexShader() {
58660
58740
  const scene = this._scene;
58661
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
58741
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58662
58742
  const src = [];
58663
58743
  src.push("#version 300 es");
58664
58744
  src.push("// Triangles batching depth vertex shader");
@@ -58718,7 +58798,7 @@ class TrianglesBatchingDepthRenderer extends VBOSceneModelTriangleBatchingRender
58718
58798
  _buildFragmentShader() {
58719
58799
  const scene = this._scene;
58720
58800
  const sectionPlanesState = scene._sectionPlanesState;
58721
- const clipping = (sectionPlanesState.sectionPlanes.length > 0);
58801
+ const clipping = (sectionPlanesState.getNumAllocatedSectionPlanes() > 0);
58722
58802
  const src = [];
58723
58803
  src.push("#version 300 es");
58724
58804
  src.push("// Triangles batching depth fragment shader");
@@ -58733,7 +58813,7 @@ class TrianglesBatchingDepthRenderer extends VBOSceneModelTriangleBatchingRender
58733
58813
  if (clipping) {
58734
58814
  src.push("in vec4 vWorldPosition;");
58735
58815
  src.push("in float vFlags;");
58736
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58816
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58737
58817
  src.push("uniform bool sectionPlaneActive" + i + ";");
58738
58818
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58739
58819
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58757,7 +58837,7 @@ class TrianglesBatchingDepthRenderer extends VBOSceneModelTriangleBatchingRender
58757
58837
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58758
58838
  src.push(" if (clippable) {");
58759
58839
  src.push(" float dist = 0.0;");
58760
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58840
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58761
58841
  src.push(" if (sectionPlaneActive" + i + ") {");
58762
58842
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58763
58843
  src.push(" }");
@@ -58782,7 +58862,7 @@ class TrianglesBatchingNormalsRenderer extends VBOSceneModelTriangleBatchingRend
58782
58862
 
58783
58863
  _buildVertexShader() {
58784
58864
  const scene = this._scene;
58785
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
58865
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58786
58866
  const src = [];
58787
58867
  src.push("#version 300 es");
58788
58868
  src.push("// Batched geometry normals vertex shader");
@@ -58853,7 +58933,7 @@ class TrianglesBatchingNormalsRenderer extends VBOSceneModelTriangleBatchingRend
58853
58933
  _buildFragmentShader() {
58854
58934
  const scene = this._scene;
58855
58935
  const sectionPlanesState = scene._sectionPlanesState;
58856
- const clipping = (sectionPlanesState.sectionPlanes.length > 0);
58936
+ const clipping = (sectionPlanesState.getNumAllocatedSectionPlanes() > 0);
58857
58937
  const src = [];
58858
58938
  src.push("#version 300 es");
58859
58939
  src.push("// Batched geometry normals fragment shader");
@@ -58877,7 +58957,7 @@ class TrianglesBatchingNormalsRenderer extends VBOSceneModelTriangleBatchingRend
58877
58957
  if (clipping) {
58878
58958
  src.push("in vec4 vWorldPosition;");
58879
58959
  src.push("in float vFlags;");
58880
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58960
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58881
58961
  src.push("uniform bool sectionPlaneActive" + i + ";");
58882
58962
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58883
58963
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -58894,7 +58974,7 @@ class TrianglesBatchingNormalsRenderer extends VBOSceneModelTriangleBatchingRend
58894
58974
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
58895
58975
  src.push(" if (clippable) {");
58896
58976
  src.push(" float dist = 0.0;");
58897
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
58977
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58898
58978
  src.push(" if (sectionPlaneActive" + i + ") {");
58899
58979
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
58900
58980
  src.push(" }");
@@ -58920,7 +59000,7 @@ class TrianglesBatchingShadowRenderer extends VBOSceneModelTriangleBatchingRende
58920
59000
 
58921
59001
  _buildVertexShader() {
58922
59002
  const scene = this._scene;
58923
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
59003
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
58924
59004
  const src = [];
58925
59005
  src.push("#version 300 es");
58926
59006
  src.push("// Batched geometry shadow vertex shader");
@@ -58967,7 +59047,7 @@ class TrianglesBatchingShadowRenderer extends VBOSceneModelTriangleBatchingRende
58967
59047
  _buildFragmentShader() {
58968
59048
  const scene = this._scene;
58969
59049
  const sectionPlanesState = scene._sectionPlanesState;
58970
- const clipping = (sectionPlanesState.sectionPlanes.length > 0);
59050
+ const clipping = (sectionPlanesState.getNumAllocatedSectionPlanes() > 0);
58971
59051
  const src = [];
58972
59052
  src.push("#version 300 es");
58973
59053
  src.push("// Batched geometry shadow fragment shader");
@@ -58981,7 +59061,7 @@ class TrianglesBatchingShadowRenderer extends VBOSceneModelTriangleBatchingRende
58981
59061
  if (clipping) {
58982
59062
  src.push("in vec4 vWorldPosition;");
58983
59063
  src.push("in float vFlags;");
58984
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
59064
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
58985
59065
  src.push("uniform bool sectionPlaneActive" + i + ";");
58986
59066
  src.push("uniform vec3 sectionPlanePos" + i + ";");
58987
59067
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -59002,7 +59082,7 @@ class TrianglesBatchingShadowRenderer extends VBOSceneModelTriangleBatchingRende
59002
59082
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
59003
59083
  src.push(" if (clippable) {");
59004
59084
  src.push(" float dist = 0.0;");
59005
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
59085
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
59006
59086
  src.push(" if (sectionPlaneActive" + i + ") {");
59007
59087
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
59008
59088
  src.push(" }");
@@ -59038,7 +59118,7 @@ class TrianglesBatchingPBRRenderer extends VBOSceneModelTriangleBatchingRenderer
59038
59118
  const scene = this._scene;
59039
59119
  const sectionPlanesState = scene._sectionPlanesState;
59040
59120
  const lightsState = scene._lightsState;
59041
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
59121
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
59042
59122
  const clippingCaps = sectionPlanesState.clippingCaps;
59043
59123
 
59044
59124
  const src = [];
@@ -59168,7 +59248,7 @@ class TrianglesBatchingPBRRenderer extends VBOSceneModelTriangleBatchingRenderer
59168
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.
59169
59249
  const sectionPlanesState = scene._sectionPlanesState;
59170
59250
  const lightsState = scene._lightsState;
59171
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
59251
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
59172
59252
  const clippingCaps = sectionPlanesState.clippingCaps;
59173
59253
  const src = [];
59174
59254
 
@@ -59272,7 +59352,7 @@ class TrianglesBatchingPBRRenderer extends VBOSceneModelTriangleBatchingRenderer
59272
59352
  if (clippingCaps) {
59273
59353
  src.push("in vec4 vClipPosition;");
59274
59354
  }
59275
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
59355
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
59276
59356
  src.push("uniform bool sectionPlaneActive" + i + ";");
59277
59357
  src.push("uniform vec3 sectionPlanePos" + i + ";");
59278
59358
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -59445,7 +59525,7 @@ class TrianglesBatchingPBRRenderer extends VBOSceneModelTriangleBatchingRenderer
59445
59525
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
59446
59526
  src.push(" if (clippable) {");
59447
59527
  src.push(" float dist = 0.0;");
59448
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
59528
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
59449
59529
  src.push("if (sectionPlaneActive" + i + ") {");
59450
59530
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
59451
59531
  src.push("}");
@@ -59583,7 +59663,7 @@ class TrianglesBatchingPickNormalsFlatRenderer extends VBOSceneModelTriangleBatc
59583
59663
 
59584
59664
  _buildVertexShader() {
59585
59665
  const scene = this._scene;
59586
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
59666
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
59587
59667
  const src = [];
59588
59668
  src.push("#version 300 es");
59589
59669
  src.push("// Triangles batching pick flat normals vertex shader");
@@ -59642,7 +59722,7 @@ class TrianglesBatchingPickNormalsFlatRenderer extends VBOSceneModelTriangleBatc
59642
59722
  _buildFragmentShader() {
59643
59723
  const scene = this._scene;
59644
59724
  const sectionPlanesState = scene._sectionPlanesState;
59645
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
59725
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
59646
59726
  const src = [];
59647
59727
  src.push("#version 300 es");
59648
59728
  src.push("// Triangles batching pick flat normals fragment shader");
@@ -59662,7 +59742,7 @@ class TrianglesBatchingPickNormalsFlatRenderer extends VBOSceneModelTriangleBatc
59662
59742
  src.push("in vec4 vWorldPosition;");
59663
59743
  if (clipping) {
59664
59744
  src.push("in float vFlags;");
59665
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
59745
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
59666
59746
  src.push("uniform bool sectionPlaneActive" + i + ";");
59667
59747
  src.push("uniform vec3 sectionPlanePos" + i + ";");
59668
59748
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -59674,7 +59754,7 @@ class TrianglesBatchingPickNormalsFlatRenderer extends VBOSceneModelTriangleBatc
59674
59754
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
59675
59755
  src.push(" if (clippable) {");
59676
59756
  src.push(" float dist = 0.0;");
59677
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
59757
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
59678
59758
  src.push(" if (sectionPlaneActive" + i + ") {");
59679
59759
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
59680
59760
  src.push(" }");
@@ -59711,7 +59791,7 @@ class TrianglesBatchingColorTextureRenderer extends VBOSceneModelTriangleBatchin
59711
59791
 
59712
59792
  const scene = this._scene;
59713
59793
  const sectionPlanesState = scene._sectionPlanesState;
59714
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
59794
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
59715
59795
  const src = [];
59716
59796
  src.push("#version 300 es");
59717
59797
  src.push("// Triangles batching color texture vertex shader");
@@ -59788,7 +59868,7 @@ class TrianglesBatchingColorTextureRenderer extends VBOSceneModelTriangleBatchin
59788
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.
59789
59869
  const lightsState = scene._lightsState;
59790
59870
  const sectionPlanesState = scene._sectionPlanesState;
59791
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
59871
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
59792
59872
  const src = [];
59793
59873
  src.push("#version 300 es");
59794
59874
  src.push("// Triangles batching color texture fragment shader");
@@ -59838,7 +59918,7 @@ class TrianglesBatchingColorTextureRenderer extends VBOSceneModelTriangleBatchin
59838
59918
  if (clipping) {
59839
59919
  src.push("in vec4 vWorldPosition;");
59840
59920
  src.push("in float vFlags;");
59841
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
59921
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
59842
59922
  src.push("uniform bool sectionPlaneActive" + i + ";");
59843
59923
  src.push("uniform vec3 sectionPlanePos" + i + ";");
59844
59924
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -59875,7 +59955,7 @@ class TrianglesBatchingColorTextureRenderer extends VBOSceneModelTriangleBatchin
59875
59955
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
59876
59956
  src.push(" if (clippable) {");
59877
59957
  src.push(" float dist = 0.0;");
59878
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
59958
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
59879
59959
  src.push("if (sectionPlaneActive" + i + ") {");
59880
59960
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
59881
59961
  src.push("}");
@@ -60465,7 +60545,7 @@ function octDecodeVec2(oct) { // Decode an oct-encoded normal
60465
60545
  const tempVec3a$r = math.vec3();
60466
60546
  const tempVec3b$n = math.vec3();
60467
60547
  const tempVec3c$k = math.vec3();
60468
- const tempVec3d$g = math.vec3();
60548
+ const tempVec3d$8 = math.vec3();
60469
60549
  const tempMat4a$g = math.mat4();
60470
60550
 
60471
60551
  /**
@@ -60531,7 +60611,7 @@ class SnapBatchingDepthBufInitRenderer extends VBOSceneModelRenderer {
60531
60611
  rtcOrigin[1] += position[1];
60532
60612
  rtcOrigin[2] += position[2];
60533
60613
  rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a$g);
60534
- rtcCameraEye = tempVec3d$g;
60614
+ rtcCameraEye = tempVec3d$8;
60535
60615
  rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];
60536
60616
  rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];
60537
60617
  rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];
@@ -60606,7 +60686,7 @@ class SnapBatchingDepthBufInitRenderer extends VBOSceneModelRenderer {
60606
60686
 
60607
60687
  _buildVertexShader() {
60608
60688
  const scene = this._scene;
60609
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
60689
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
60610
60690
  const src = [];
60611
60691
  src.push ('#version 300 es');
60612
60692
  src.push("// VBO SnapBatchingDepthBufInitRenderer vertex shader");
@@ -60693,7 +60773,7 @@ class SnapBatchingDepthBufInitRenderer extends VBOSceneModelRenderer {
60693
60773
  _buildFragmentShader() {
60694
60774
  const scene = this._scene;
60695
60775
  const sectionPlanesState = scene._sectionPlanesState;
60696
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
60776
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
60697
60777
  const src = [];
60698
60778
  src.push ('#version 300 es');
60699
60779
  src.push("// VBO SnapBatchingDepthBufInitRenderer fragment shader");
@@ -60715,7 +60795,7 @@ class SnapBatchingDepthBufInitRenderer extends VBOSceneModelRenderer {
60715
60795
  src.push("flat in vec4 vPickColor;");
60716
60796
  if (clipping) {
60717
60797
  src.push("in float vFlags;");
60718
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
60798
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
60719
60799
  src.push("uniform bool sectionPlaneActive" + i + ";");
60720
60800
  src.push("uniform vec3 sectionPlanePos" + i + ";");
60721
60801
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -60730,7 +60810,7 @@ class SnapBatchingDepthBufInitRenderer extends VBOSceneModelRenderer {
60730
60810
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
60731
60811
  src.push(" if (clippable) {");
60732
60812
  src.push(" float dist = 0.0;");
60733
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
60813
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
60734
60814
  src.push(" if (sectionPlaneActive" + i + ") {");
60735
60815
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
60736
60816
  src.push(" }");
@@ -60770,7 +60850,7 @@ class SnapBatchingDepthBufInitRenderer extends VBOSceneModelRenderer {
60770
60850
  const tempVec3a$q = math.vec3();
60771
60851
  const tempVec3b$m = math.vec3();
60772
60852
  const tempVec3c$j = math.vec3();
60773
- const tempVec3d$f = math.vec3();
60853
+ const tempVec3d$7 = math.vec3();
60774
60854
  const tempMat4a$f = math.mat4();
60775
60855
 
60776
60856
  /**
@@ -60840,7 +60920,7 @@ class SnapBatchingDepthRenderer extends VBOSceneModelRenderer{
60840
60920
  rtcOrigin[1] += position[1];
60841
60921
  rtcOrigin[2] += position[2];
60842
60922
  rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a$f);
60843
- rtcCameraEye = tempVec3d$f;
60923
+ rtcCameraEye = tempVec3d$7;
60844
60924
  rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];
60845
60925
  rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];
60846
60926
  rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];
@@ -60921,7 +61001,7 @@ class SnapBatchingDepthRenderer extends VBOSceneModelRenderer{
60921
61001
 
60922
61002
  _buildVertexShader() {
60923
61003
  const scene = this._scene;
60924
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
61004
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
60925
61005
  scene.pointsMaterial._state;
60926
61006
  const src = [];
60927
61007
  src.push ('#version 300 es');
@@ -61008,7 +61088,7 @@ class SnapBatchingDepthRenderer extends VBOSceneModelRenderer{
61008
61088
  _buildFragmentShader() {
61009
61089
  const scene = this._scene;
61010
61090
  const sectionPlanesState = scene._sectionPlanesState;
61011
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
61091
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
61012
61092
  const src = [];
61013
61093
  src.push ('#version 300 es');
61014
61094
  src.push("// SnapBatchingDepthRenderer fragment shader");
@@ -61029,7 +61109,7 @@ class SnapBatchingDepthRenderer extends VBOSceneModelRenderer{
61029
61109
  if (clipping) {
61030
61110
  src.push("in vec4 vWorldPosition;");
61031
61111
  src.push("in float vFlags;");
61032
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
61112
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
61033
61113
  src.push("uniform bool sectionPlaneActive" + i + ";");
61034
61114
  src.push("uniform vec3 sectionPlanePos" + i + ";");
61035
61115
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -61042,7 +61122,7 @@ class SnapBatchingDepthRenderer extends VBOSceneModelRenderer{
61042
61122
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
61043
61123
  src.push(" if (clippable) {");
61044
61124
  src.push(" float dist = 0.0;");
61045
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
61125
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
61046
61126
  src.push(" if (sectionPlaneActive" + i + ") {");
61047
61127
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
61048
61128
  src.push(" }");
@@ -61163,8 +61243,8 @@ math.OBB3();
61163
61243
  const tempVec3a$p = math.vec3();
61164
61244
  const tempVec3b$l = math.vec3();
61165
61245
  const tempVec3c$i = math.vec3();
61166
- const tempVec3d$e = math.vec3();
61167
- const tempVec3e$3 = math.vec3();
61246
+ const tempVec3d$6 = math.vec3();
61247
+ const tempVec3e$1 = math.vec3();
61168
61248
  const tempVec3f$1 = math.vec3();
61169
61249
  const tempVec3g$1 = math.vec3();
61170
61250
 
@@ -62355,8 +62435,8 @@ class TrianglesBatchingLayer {
62355
62435
 
62356
62436
  math.transformRay(this.model.worldNormalMatrix, rtcRayOrigin, rtcRayDir, rtcRayOrigin, rtcRayDir); // RTC -> local
62357
62437
 
62358
- const a = tempVec3d$e;
62359
- const b = tempVec3e$3;
62438
+ const a = tempVec3d$6;
62439
+ const b = tempVec3e$1;
62360
62440
  const c = tempVec3f$1;
62361
62441
 
62362
62442
  let gotIntersect = false;
@@ -62479,7 +62559,7 @@ class TrianglesInstancingColorRenderer extends VBOSceneModelTriangleInstancingRe
62479
62559
  const scene = this._scene;
62480
62560
  const sectionPlanesState = scene._sectionPlanesState;
62481
62561
  const lightsState = scene._lightsState;
62482
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
62562
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
62483
62563
  let i;
62484
62564
  let len;
62485
62565
  let light;
@@ -62631,7 +62711,7 @@ class TrianglesInstancingColorRenderer extends VBOSceneModelTriangleInstancingRe
62631
62711
  _buildFragmentShader() {
62632
62712
  const scene = this._scene;
62633
62713
  const sectionPlanesState = scene._sectionPlanesState;
62634
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
62714
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
62635
62715
  const src = [];
62636
62716
  src.push("#version 300 es");
62637
62717
  src.push("// Instancing geometry drawing fragment shader");
@@ -62664,7 +62744,7 @@ class TrianglesInstancingColorRenderer extends VBOSceneModelTriangleInstancingRe
62664
62744
  if (clipping) {
62665
62745
  src.push("in vec4 vWorldPosition;");
62666
62746
  src.push("in float vFlags;");
62667
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
62747
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
62668
62748
  src.push("uniform bool sectionPlaneActive" + i + ";");
62669
62749
  src.push("uniform vec3 sectionPlanePos" + i + ";");
62670
62750
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -62678,7 +62758,7 @@ class TrianglesInstancingColorRenderer extends VBOSceneModelTriangleInstancingRe
62678
62758
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
62679
62759
  src.push(" if (clippable) {");
62680
62760
  src.push(" float dist = 0.0;");
62681
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
62761
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
62682
62762
  src.push("if (sectionPlaneActive" + i + ") {");
62683
62763
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
62684
62764
  src.push("}");
@@ -62724,7 +62804,7 @@ class TrianglesInstancingFlatColorRenderer extends VBOSceneModelTriangleInstanci
62724
62804
  _buildVertexShader() {
62725
62805
  const scene = this._scene;
62726
62806
  const sectionPlanesState = scene._sectionPlanesState;
62727
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
62807
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
62728
62808
  const src = [];
62729
62809
  src.push("#version 300 es");
62730
62810
  src.push("// Instancing geometry flat-shading drawing vertex shader");
@@ -62806,7 +62886,7 @@ class TrianglesInstancingFlatColorRenderer extends VBOSceneModelTriangleInstanci
62806
62886
  const lightsState = scene._lightsState;
62807
62887
  let i;
62808
62888
  let len;
62809
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
62889
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
62810
62890
  const src = [];
62811
62891
  src.push("#version 300 es");
62812
62892
  src.push("// Instancing geometry flat-shading drawing fragment shader");
@@ -62839,7 +62919,7 @@ class TrianglesInstancingFlatColorRenderer extends VBOSceneModelTriangleInstanci
62839
62919
  if (clipping) {
62840
62920
  src.push("in vec4 vWorldPosition;");
62841
62921
  src.push("in float vFlags;");
62842
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
62922
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
62843
62923
  src.push("uniform bool sectionPlaneActive" + i + ";");
62844
62924
  src.push("uniform vec3 sectionPlanePos" + i + ";");
62845
62925
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -62878,7 +62958,7 @@ class TrianglesInstancingFlatColorRenderer extends VBOSceneModelTriangleInstanci
62878
62958
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
62879
62959
  src.push(" if (clippable) {");
62880
62960
  src.push(" float dist = 0.0;");
62881
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
62961
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
62882
62962
  src.push("if (sectionPlaneActive" + i + ") {");
62883
62963
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
62884
62964
  src.push("}");
@@ -62966,7 +63046,7 @@ class TrianglesInstancingSilhouetteRenderer extends VBOSceneModelTriangleInstanc
62966
63046
  _buildVertexShader() {
62967
63047
  const scene = this._scene;
62968
63048
  const sectionPlanesState = scene._sectionPlanesState;
62969
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63049
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
62970
63050
  const src = [];
62971
63051
  src.push("#version 300 es");
62972
63052
  src.push("// Instancing silhouette vertex shader");
@@ -63041,7 +63121,7 @@ class TrianglesInstancingSilhouetteRenderer extends VBOSceneModelTriangleInstanc
63041
63121
  _buildFragmentShader() {
63042
63122
  const scene = this._scene;
63043
63123
  const sectionPlanesState = scene._sectionPlanesState;
63044
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63124
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63045
63125
  const src = [];
63046
63126
  src.push("#version 300 es");
63047
63127
  src.push("// Instancing fill fragment shader");
@@ -63061,7 +63141,7 @@ class TrianglesInstancingSilhouetteRenderer extends VBOSceneModelTriangleInstanc
63061
63141
  if (clipping) {
63062
63142
  src.push("in vec4 vWorldPosition;");
63063
63143
  src.push("in float vFlags;");
63064
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
63144
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63065
63145
  src.push("uniform bool sectionPlaneActive" + i + ";");
63066
63146
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63067
63147
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63074,7 +63154,7 @@ class TrianglesInstancingSilhouetteRenderer extends VBOSceneModelTriangleInstanc
63074
63154
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63075
63155
  src.push(" if (clippable) {");
63076
63156
  src.push(" float dist = 0.0;");
63077
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
63157
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63078
63158
  src.push("if (sectionPlaneActive" + i + ") {");
63079
63159
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63080
63160
  src.push("}");
@@ -63103,7 +63183,7 @@ class TrianglesInstancingEdgesRenderer extends VBOSceneModelTriangleInstancingEd
63103
63183
  _buildVertexShader() {
63104
63184
  const scene = this._scene;
63105
63185
  const sectionPlanesState = scene._sectionPlanesState;
63106
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63186
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63107
63187
  const src = [];
63108
63188
  src.push("#version 300 es");
63109
63189
  src.push("// Triangles instancing edges vertex shader");
@@ -63172,7 +63252,7 @@ class TrianglesInstancingEdgesRenderer extends VBOSceneModelTriangleInstancingEd
63172
63252
  _buildFragmentShader() {
63173
63253
  const scene = this._scene;
63174
63254
  const sectionPlanesState = scene._sectionPlanesState;
63175
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63255
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63176
63256
  const src = [];
63177
63257
  src.push("#version 300 es");
63178
63258
  src.push("// Batched geometry edges drawing fragment shader");
@@ -63192,7 +63272,7 @@ class TrianglesInstancingEdgesRenderer extends VBOSceneModelTriangleInstancingEd
63192
63272
  if (clipping) {
63193
63273
  src.push("in vec4 vWorldPosition;");
63194
63274
  src.push("in float vFlags;");
63195
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
63275
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63196
63276
  src.push("uniform bool sectionPlaneActive" + i + ";");
63197
63277
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63198
63278
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63205,7 +63285,7 @@ class TrianglesInstancingEdgesRenderer extends VBOSceneModelTriangleInstancingEd
63205
63285
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63206
63286
  src.push(" if (clippable) {");
63207
63287
  src.push(" float dist = 0.0;");
63208
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
63288
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63209
63289
  src.push("if (sectionPlaneActive" + i + ") {");
63210
63290
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63211
63291
  src.push("}");
@@ -63230,7 +63310,7 @@ class TrianglesInstancingEdgesColorRenderer extends VBOSceneModelTriangleInstanc
63230
63310
  _buildVertexShader() {
63231
63311
  const scene = this._scene;
63232
63312
  const sectionPlanesState = scene._sectionPlanesState;
63233
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63313
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63234
63314
  const src = [];
63235
63315
  src.push("#version 300 es");
63236
63316
  src.push("// Triangles instancing edges vertex shader");
@@ -63300,7 +63380,7 @@ class TrianglesInstancingEdgesColorRenderer extends VBOSceneModelTriangleInstanc
63300
63380
  _buildFragmentShader() {
63301
63381
  const scene = this._scene;
63302
63382
  const sectionPlanesState = scene._sectionPlanesState;
63303
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63383
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63304
63384
  const src = [];
63305
63385
  src.push("#version 300 es");
63306
63386
  src.push("// Batched geometry edges drawing fragment shader");
@@ -63320,7 +63400,7 @@ class TrianglesInstancingEdgesColorRenderer extends VBOSceneModelTriangleInstanc
63320
63400
  if (clipping) {
63321
63401
  src.push("in vec4 vWorldPosition;");
63322
63402
  src.push("in float vFlags;");
63323
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
63403
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63324
63404
  src.push("uniform bool sectionPlaneActive" + i + ";");
63325
63405
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63326
63406
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63333,7 +63413,7 @@ class TrianglesInstancingEdgesColorRenderer extends VBOSceneModelTriangleInstanc
63333
63413
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63334
63414
  src.push(" if (clippable) {");
63335
63415
  src.push(" float dist = 0.0;");
63336
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
63416
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63337
63417
  src.push("if (sectionPlaneActive" + i + ") {");
63338
63418
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63339
63419
  src.push("}");
@@ -63358,7 +63438,7 @@ class TrianglesInstancingPickMeshRenderer extends VBOSceneModelTriangleInstancin
63358
63438
  _buildVertexShader() {
63359
63439
  const scene = this._scene;
63360
63440
  const sectionPlanesState = scene._sectionPlanesState;
63361
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63441
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63362
63442
  const src = [];
63363
63443
  src.push("#version 300 es");
63364
63444
  src.push("// Instancing geometry picking vertex shader");
@@ -63434,7 +63514,7 @@ class TrianglesInstancingPickMeshRenderer extends VBOSceneModelTriangleInstancin
63434
63514
  _buildFragmentShader() {
63435
63515
  const scene = this._scene;
63436
63516
  const sectionPlanesState = scene._sectionPlanesState;
63437
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63517
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63438
63518
  const src = [];
63439
63519
  src.push("#version 300 es");
63440
63520
  src.push("// Batched geometry picking fragment shader");
@@ -63454,7 +63534,7 @@ class TrianglesInstancingPickMeshRenderer extends VBOSceneModelTriangleInstancin
63454
63534
  if (clipping) {
63455
63535
  src.push("in vec4 vWorldPosition;");
63456
63536
  src.push("in float vFlags;");
63457
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63537
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63458
63538
  src.push("uniform bool sectionPlaneActive" + i + ";");
63459
63539
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63460
63540
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63467,7 +63547,7 @@ class TrianglesInstancingPickMeshRenderer extends VBOSceneModelTriangleInstancin
63467
63547
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63468
63548
  src.push(" if (clippable) {");
63469
63549
  src.push(" float dist = 0.0;");
63470
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63550
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63471
63551
  src.push("if (sectionPlaneActive" + i + ") {");
63472
63552
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63473
63553
  src.push("}");
@@ -63492,7 +63572,7 @@ class TrianglesInstancingPickDepthRenderer extends VBOSceneModelTriangleInstanci
63492
63572
  _buildVertexShader() {
63493
63573
  const scene = this._scene;
63494
63574
  const sectionPlanesState = scene._sectionPlanesState;
63495
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63575
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63496
63576
  const src = [];
63497
63577
  src.push("#version 300 es");
63498
63578
  src.push("// Instancing geometry depth vertex shader");
@@ -63568,7 +63648,7 @@ class TrianglesInstancingPickDepthRenderer extends VBOSceneModelTriangleInstanci
63568
63648
  _buildFragmentShader() {
63569
63649
  const scene = this._scene;
63570
63650
  const sectionPlanesState = scene._sectionPlanesState;
63571
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63651
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63572
63652
  const src = [];
63573
63653
  src.push("#version 300 es");
63574
63654
  src.push("// Batched geometry depth fragment shader");
@@ -63594,7 +63674,7 @@ class TrianglesInstancingPickDepthRenderer extends VBOSceneModelTriangleInstanci
63594
63674
  if (clipping) {
63595
63675
  src.push("in vec4 vWorldPosition;");
63596
63676
  src.push("in float vFlags;");
63597
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63677
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63598
63678
  src.push("uniform bool sectionPlaneActive" + i + ";");
63599
63679
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63600
63680
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63614,7 +63694,7 @@ class TrianglesInstancingPickDepthRenderer extends VBOSceneModelTriangleInstanci
63614
63694
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63615
63695
  src.push(" if (clippable) {");
63616
63696
  src.push(" float dist = 0.0;");
63617
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63697
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63618
63698
  src.push("if (sectionPlaneActive" + i + ") {");
63619
63699
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63620
63700
  src.push("}");
@@ -63640,7 +63720,7 @@ class TrianglesInstancingPickNormalsRenderer extends VBOSceneModelTriangleInstan
63640
63720
  _buildVertexShader() {
63641
63721
  const scene = this._scene;
63642
63722
  const sectionPlanesState = scene._sectionPlanesState;
63643
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63723
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63644
63724
  const src = [];
63645
63725
  src.push("#version 300 es");
63646
63726
  src.push("// Instancing geometry normals vertex shader");
@@ -63721,7 +63801,7 @@ class TrianglesInstancingPickNormalsRenderer extends VBOSceneModelTriangleInstan
63721
63801
  _buildFragmentShader() {
63722
63802
  const scene = this._scene;
63723
63803
  const sectionPlanesState = scene._sectionPlanesState;
63724
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63804
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63725
63805
  const src = [];
63726
63806
  src.push("#version 300 es");
63727
63807
  src.push("// Batched geometry normals fragment shader");
@@ -63745,7 +63825,7 @@ class TrianglesInstancingPickNormalsRenderer extends VBOSceneModelTriangleInstan
63745
63825
  if (clipping) {
63746
63826
  src.push("in vec4 vWorldPosition;");
63747
63827
  src.push("in float vFlags;");
63748
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63828
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63749
63829
  src.push("uniform bool sectionPlaneActive" + i + ";");
63750
63830
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63751
63831
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63758,7 +63838,7 @@ class TrianglesInstancingPickNormalsRenderer extends VBOSceneModelTriangleInstan
63758
63838
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63759
63839
  src.push(" if (clippable) {");
63760
63840
  src.push(" float dist = 0.0;");
63761
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63841
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63762
63842
  src.push("if (sectionPlaneActive" + i + ") {");
63763
63843
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63764
63844
  src.push("}");
@@ -63783,7 +63863,7 @@ class TrianglesInstancingOcclusionRenderer extends VBOSceneModelTriangleInstanci
63783
63863
  _buildVertexShader() {
63784
63864
  const scene = this._scene;
63785
63865
  const sectionPlanesState = scene._sectionPlanesState;
63786
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63866
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63787
63867
  const src = [];
63788
63868
  src.push("#version 300 es");
63789
63869
  src.push("// TrianglesInstancingOcclusionRenderer vertex shader");
@@ -63834,7 +63914,7 @@ class TrianglesInstancingOcclusionRenderer extends VBOSceneModelTriangleInstanci
63834
63914
  _buildFragmentShader() {
63835
63915
  const scene = this._scene;
63836
63916
  const sectionPlanesState = scene._sectionPlanesState;
63837
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63917
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63838
63918
  const src = [];
63839
63919
  src.push("#version 300 es");
63840
63920
  src.push("// TrianglesInstancingOcclusionRenderer fragment shader");
@@ -63849,7 +63929,7 @@ class TrianglesInstancingOcclusionRenderer extends VBOSceneModelTriangleInstanci
63849
63929
  if (clipping) {
63850
63930
  src.push("in vec4 vWorldPosition;");
63851
63931
  src.push("in float vFlags;");
63852
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63932
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63853
63933
  src.push("uniform bool sectionPlaneActive" + i + ";");
63854
63934
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63855
63935
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63861,7 +63941,7 @@ class TrianglesInstancingOcclusionRenderer extends VBOSceneModelTriangleInstanci
63861
63941
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63862
63942
  src.push(" if (clippable) {");
63863
63943
  src.push(" float dist = 0.0;");
63864
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
63944
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
63865
63945
  src.push("if (sectionPlaneActive" + i + ") {");
63866
63946
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63867
63947
  src.push("}");
@@ -63883,7 +63963,7 @@ class TrianglesInstancingDepthRenderer extends VBOSceneModelTriangleInstancingRe
63883
63963
  _buildVertexShader() {
63884
63964
  const scene = this._scene;
63885
63965
  const sectionPlanesState = scene._sectionPlanesState;
63886
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
63966
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63887
63967
  const src = [];
63888
63968
  src.push("#version 300 es");
63889
63969
  src.push("// Instancing geometry depth drawing vertex shader");
@@ -63951,7 +64031,7 @@ class TrianglesInstancingDepthRenderer extends VBOSceneModelTriangleInstancingRe
63951
64031
  const sectionPlanesState = scene._sectionPlanesState;
63952
64032
  let i;
63953
64033
  let len;
63954
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64034
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
63955
64035
  const src = [];
63956
64036
  src.push("#version 300 es");
63957
64037
  src.push("// Instancing geometry depth drawing fragment shader");
@@ -63966,7 +64046,7 @@ class TrianglesInstancingDepthRenderer extends VBOSceneModelTriangleInstancingRe
63966
64046
  if (clipping) {
63967
64047
  src.push("in vec4 vWorldPosition;");
63968
64048
  src.push("in float vFlags;");
63969
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64049
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63970
64050
  src.push("uniform bool sectionPlaneActive" + i + ";");
63971
64051
  src.push("uniform vec3 sectionPlanePos" + i + ";");
63972
64052
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -63979,7 +64059,7 @@ class TrianglesInstancingDepthRenderer extends VBOSceneModelTriangleInstancingRe
63979
64059
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
63980
64060
  src.push(" if (clippable) {");
63981
64061
  src.push(" float dist = 0.0;");
63982
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64062
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
63983
64063
  src.push("if (sectionPlaneActive" + i + ") {");
63984
64064
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
63985
64065
  src.push("}");
@@ -64005,7 +64085,7 @@ class TrianglesInstancingNormalsRenderer extends VBOSceneModelTriangleInstancing
64005
64085
  _buildVertexShader() {
64006
64086
  const scene = this._scene;
64007
64087
  const sectionPlanesState = scene._sectionPlanesState;
64008
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64088
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64009
64089
  const src = [];
64010
64090
  src.push("#version 300 es");
64011
64091
  src.push("// Instancing geometry normals drawing vertex shader");
@@ -64081,7 +64161,7 @@ class TrianglesInstancingNormalsRenderer extends VBOSceneModelTriangleInstancing
64081
64161
  _buildFragmentShader() {
64082
64162
  const scene = this._scene;
64083
64163
  const sectionPlanesState = scene._sectionPlanesState;
64084
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64164
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64085
64165
  const src = [];
64086
64166
  src.push("#version 300 es");
64087
64167
  src.push("// Instancing geometry depth drawing fragment shader");
@@ -64101,7 +64181,7 @@ class TrianglesInstancingNormalsRenderer extends VBOSceneModelTriangleInstancing
64101
64181
  if (clipping) {
64102
64182
  src.push("in vec4 vWorldPosition;");
64103
64183
  src.push("in float vFlags;");
64104
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64184
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
64105
64185
  src.push("uniform bool sectionPlaneActive" + i + ";");
64106
64186
  src.push("uniform vec3 sectionPlanePos" + i + ";");
64107
64187
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -64117,7 +64197,7 @@ class TrianglesInstancingNormalsRenderer extends VBOSceneModelTriangleInstancing
64117
64197
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
64118
64198
  src.push(" if (clippable) {");
64119
64199
  src.push(" float dist = 0.0;");
64120
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64200
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
64121
64201
  src.push("if (sectionPlaneActive" + i + ") {");
64122
64202
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
64123
64203
  src.push("}");
@@ -64144,7 +64224,7 @@ class TrianglesInstancingShadowRenderer extends VBOSceneModelTriangleInstancingR
64144
64224
  _buildVertexShader() {
64145
64225
  const scene = this._scene;
64146
64226
  const sectionPlanesState = scene._sectionPlanesState;
64147
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64227
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64148
64228
  const src = [];
64149
64229
  src.push("#version 300 es");
64150
64230
  src.push("// Instancing geometry shadow drawing vertex shader");
@@ -64193,7 +64273,7 @@ class TrianglesInstancingShadowRenderer extends VBOSceneModelTriangleInstancingR
64193
64273
  _buildFragmentShader() {
64194
64274
  const scene = this._scene;
64195
64275
  const sectionPlanesState = scene._sectionPlanesState;
64196
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64276
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64197
64277
  const src = [];
64198
64278
  src.push("#version 300 es");
64199
64279
  src.push("// Instancing geometry depth drawing fragment shader");
@@ -64212,7 +64292,7 @@ class TrianglesInstancingShadowRenderer extends VBOSceneModelTriangleInstancingR
64212
64292
  if (clipping) {
64213
64293
  src.push("in vec4 vWorldPosition;");
64214
64294
  src.push("in float vFlags;");
64215
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64295
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
64216
64296
  src.push("uniform bool sectionPlaneActive" + i + ";");
64217
64297
  src.push("uniform vec3 sectionPlanePos" + i + ";");
64218
64298
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -64228,7 +64308,7 @@ class TrianglesInstancingShadowRenderer extends VBOSceneModelTriangleInstancingR
64228
64308
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
64229
64309
  src.push(" if (clippable) {");
64230
64310
  src.push(" float dist = 0.0;");
64231
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64311
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
64232
64312
  src.push("if (sectionPlaneActive" + i + ") {");
64233
64313
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
64234
64314
  src.push("}");
@@ -64267,7 +64347,7 @@ class TrianglesInstancingPBRRenderer extends VBOSceneModelTriangleInstancingRend
64267
64347
  const scene = this._scene;
64268
64348
  const sectionPlanesState = scene._sectionPlanesState;
64269
64349
  const lightsState = scene._lightsState;
64270
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64350
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64271
64351
  const clippingCaps = sectionPlanesState.clippingCaps;
64272
64352
  const src = [];
64273
64353
  src.push("#version 300 es");
@@ -64393,7 +64473,7 @@ class TrianglesInstancingPBRRenderer extends VBOSceneModelTriangleInstancingRend
64393
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.
64394
64474
  const sectionPlanesState = scene._sectionPlanesState;
64395
64475
  const lightsState = scene._lightsState;
64396
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64476
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64397
64477
  const clippingCaps = sectionPlanesState.clippingCaps;
64398
64478
  const src = [];
64399
64479
  src.push("#version 300 es");
@@ -64483,7 +64563,7 @@ class TrianglesInstancingPBRRenderer extends VBOSceneModelTriangleInstancingRend
64483
64563
  if (clippingCaps) {
64484
64564
  src.push("in vec4 vClipPosition;");
64485
64565
  }
64486
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64566
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
64487
64567
  src.push("uniform bool sectionPlaneActive" + i + ";");
64488
64568
  src.push("uniform vec3 sectionPlanePos" + i + ";");
64489
64569
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -64672,7 +64752,7 @@ class TrianglesInstancingPBRRenderer extends VBOSceneModelTriangleInstancingRend
64672
64752
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
64673
64753
  src.push(" if (clippable) {");
64674
64754
  src.push(" float dist = 0.0;");
64675
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
64755
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
64676
64756
  src.push("if (sectionPlaneActive" + i + ") {");
64677
64757
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
64678
64758
  src.push("}");
@@ -64812,7 +64892,7 @@ class TrianglesInstancingPickNormalsFlatRenderer extends VBOSceneModelTriangleIn
64812
64892
  _buildVertexShader() {
64813
64893
  const scene = this._scene;
64814
64894
  const sectionPlanesState = scene._sectionPlanesState;
64815
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64895
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64816
64896
  const src = [];
64817
64897
  src.push("#version 300 es");
64818
64898
  src.push("// Instancing geometry normals vertex shader");
@@ -64879,7 +64959,7 @@ class TrianglesInstancingPickNormalsFlatRenderer extends VBOSceneModelTriangleIn
64879
64959
  _buildFragmentShader() {
64880
64960
  const scene = this._scene;
64881
64961
  const sectionPlanesState = scene._sectionPlanesState;
64882
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
64962
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64883
64963
  const src = [];
64884
64964
  src.push("#version 300 es");
64885
64965
  src.push("// Batched geometry normals fragment shader");
@@ -64900,7 +64980,7 @@ class TrianglesInstancingPickNormalsFlatRenderer extends VBOSceneModelTriangleIn
64900
64980
  src.push("in vec4 vWorldPosition;");
64901
64981
  if (clipping) {
64902
64982
  src.push("in float vFlags;");
64903
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
64983
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
64904
64984
  src.push("uniform bool sectionPlaneActive" + i + ";");
64905
64985
  src.push("uniform vec3 sectionPlanePos" + i + ";");
64906
64986
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -64912,7 +64992,7 @@ class TrianglesInstancingPickNormalsFlatRenderer extends VBOSceneModelTriangleIn
64912
64992
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
64913
64993
  src.push(" if (clippable) {");
64914
64994
  src.push(" float dist = 0.0;");
64915
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
64995
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
64916
64996
  src.push("if (sectionPlaneActive" + i + ") {");
64917
64997
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
64918
64998
  src.push("}");
@@ -64948,7 +65028,7 @@ class TrianglesInstancingColorTextureRenderer extends VBOSceneModelTriangleInsta
64948
65028
  _buildVertexShader() {
64949
65029
  const scene = this._scene;
64950
65030
  const sectionPlanesState = scene._sectionPlanesState;
64951
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
65031
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
64952
65032
  const src = [];
64953
65033
  src.push("#version 300 es");
64954
65034
  src.push("// Instancing geometry drawing vertex shader");
@@ -65035,7 +65115,7 @@ class TrianglesInstancingColorTextureRenderer extends VBOSceneModelTriangleInsta
65035
65115
  const lightsState = scene._lightsState;
65036
65116
  let i;
65037
65117
  let len;
65038
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
65118
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
65039
65119
  const src = [];
65040
65120
  src.push("#version 300 es");
65041
65121
  src.push("// Instancing geometry drawing fragment shader");
@@ -65084,7 +65164,7 @@ class TrianglesInstancingColorTextureRenderer extends VBOSceneModelTriangleInsta
65084
65164
  if (clipping) {
65085
65165
  src.push("in vec4 vWorldPosition;");
65086
65166
  src.push("in float vFlags;");
65087
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
65167
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
65088
65168
  src.push("uniform bool sectionPlaneActive" + i + ";");
65089
65169
  src.push("uniform vec3 sectionPlanePos" + i + ";");
65090
65170
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -65122,7 +65202,7 @@ class TrianglesInstancingColorTextureRenderer extends VBOSceneModelTriangleInsta
65122
65202
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
65123
65203
  src.push(" if (clippable) {");
65124
65204
  src.push(" float dist = 0.0;");
65125
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
65205
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
65126
65206
  src.push("if (sectionPlaneActive" + i + ") {");
65127
65207
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
65128
65208
  src.push("}");
@@ -65534,7 +65614,7 @@ function getInstancingRenderers$1(scene) {
65534
65614
  const tempVec3a$o = math.vec3();
65535
65615
  const tempVec3b$k = math.vec3();
65536
65616
  const tempVec3c$h = math.vec3();
65537
- const tempVec3d$d = math.vec3();
65617
+ const tempVec3d$5 = math.vec3();
65538
65618
  const tempMat4a$e = math.mat4();
65539
65619
 
65540
65620
  /**
@@ -65603,7 +65683,7 @@ class SnapInstancingDepthBufInitRenderer extends VBOSceneModelRenderer {
65603
65683
  rtcOrigin[1] += position[1];
65604
65684
  rtcOrigin[2] += position[2];
65605
65685
  rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a$e);
65606
- rtcCameraEye = tempVec3d$d;
65686
+ rtcCameraEye = tempVec3d$5;
65607
65687
  rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];
65608
65688
  rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];
65609
65689
  rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];
@@ -65703,7 +65783,7 @@ class SnapInstancingDepthBufInitRenderer extends VBOSceneModelRenderer {
65703
65783
  _buildVertexShader() {
65704
65784
  const scene = this._scene;
65705
65785
  const sectionPlanesState = scene._sectionPlanesState;
65706
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
65786
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
65707
65787
  const src = [];
65708
65788
  src.push ('#version 300 es');
65709
65789
  src.push("// SnapInstancingDepthBufInitRenderer vertex shader");
@@ -65793,7 +65873,7 @@ class SnapInstancingDepthBufInitRenderer extends VBOSceneModelRenderer {
65793
65873
  _buildFragmentShader() {
65794
65874
  const scene = this._scene;
65795
65875
  const sectionPlanesState = scene._sectionPlanesState;
65796
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
65876
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
65797
65877
  const src = [];
65798
65878
  src.push ('#version 300 es');
65799
65879
  src.push("// Points instancing pick depth fragment shader");
@@ -65815,7 +65895,7 @@ class SnapInstancingDepthBufInitRenderer extends VBOSceneModelRenderer {
65815
65895
  src.push("flat in vec4 vPickColor;");
65816
65896
  if (clipping) {
65817
65897
  src.push("in float vFlags;");
65818
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
65898
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
65819
65899
  src.push("uniform bool sectionPlaneActive" + i + ";");
65820
65900
  src.push("uniform vec3 sectionPlanePos" + i + ";");
65821
65901
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -65830,7 +65910,7 @@ class SnapInstancingDepthBufInitRenderer extends VBOSceneModelRenderer {
65830
65910
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
65831
65911
  src.push(" if (clippable) {");
65832
65912
  src.push(" float dist = 0.0;");
65833
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
65913
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
65834
65914
  src.push("if (sectionPlaneActive" + i + ") {");
65835
65915
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
65836
65916
  src.push("}");
@@ -65870,7 +65950,7 @@ class SnapInstancingDepthBufInitRenderer extends VBOSceneModelRenderer {
65870
65950
  const tempVec3a$n = math.vec3();
65871
65951
  const tempVec3b$j = math.vec3();
65872
65952
  const tempVec3c$g = math.vec3();
65873
- const tempVec3d$c = math.vec3();
65953
+ const tempVec3d$4 = math.vec3();
65874
65954
  const tempMat4a$d = math.mat4();
65875
65955
 
65876
65956
  /**
@@ -65940,7 +66020,7 @@ class SnapInstancingDepthRenderer extends VBOSceneModelRenderer {
65940
66020
  rtcOrigin[1] += position[1];
65941
66021
  rtcOrigin[2] += position[2];
65942
66022
  rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a$d);
65943
- rtcCameraEye = tempVec3d$c;
66023
+ rtcCameraEye = tempVec3d$4;
65944
66024
  rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];
65945
66025
  rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];
65946
66026
  rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];
@@ -66037,7 +66117,7 @@ class SnapInstancingDepthRenderer extends VBOSceneModelRenderer {
66037
66117
  _buildVertexShader() {
66038
66118
  const scene = this._scene;
66039
66119
  const sectionPlanesState = scene._sectionPlanesState;
66040
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
66120
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
66041
66121
  const src = [];
66042
66122
  src.push ('#version 300 es');
66043
66123
  src.push("// SnapInstancingDepthRenderer vertex shader");
@@ -66125,7 +66205,7 @@ class SnapInstancingDepthRenderer extends VBOSceneModelRenderer {
66125
66205
  _buildFragmentShader() {
66126
66206
  const scene = this._scene;
66127
66207
  const sectionPlanesState = scene._sectionPlanesState;
66128
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
66208
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
66129
66209
  const src = [];
66130
66210
  src.push ('#version 300 es');
66131
66211
  src.push("// SnapInstancingDepthRenderer fragment shader");
@@ -66146,7 +66226,7 @@ class SnapInstancingDepthRenderer extends VBOSceneModelRenderer {
66146
66226
  if (clipping) {
66147
66227
  src.push("in vec4 vWorldPosition;");
66148
66228
  src.push("in float vFlags;");
66149
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
66229
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
66150
66230
  src.push("uniform bool sectionPlaneActive" + i + ";");
66151
66231
  src.push("uniform vec3 sectionPlanePos" + i + ";");
66152
66232
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -66159,7 +66239,7 @@ class SnapInstancingDepthRenderer extends VBOSceneModelRenderer {
66159
66239
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
66160
66240
  src.push(" if (clippable) {");
66161
66241
  src.push(" float dist = 0.0;");
66162
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
66242
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
66163
66243
  src.push("if (sectionPlaneActive" + i + ") {");
66164
66244
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
66165
66245
  src.push("}");
@@ -66280,8 +66360,8 @@ const tempVec3fa$2 = new Float32Array(3);
66280
66360
  const tempVec3a$m = math.vec3();
66281
66361
  const tempVec3b$i = math.vec3();
66282
66362
  const tempVec3c$f = math.vec3();
66283
- const tempVec3d$b = math.vec3();
66284
- const tempVec3e$2 = math.vec3();
66363
+ const tempVec3d$3 = math.vec3();
66364
+ const tempVec3e = math.vec3();
66285
66365
  const tempVec3f = math.vec3();
66286
66366
  const tempVec3g = math.vec3();
66287
66367
 
@@ -67357,8 +67437,8 @@ class TrianglesInstancingLayer {
67357
67437
 
67358
67438
  math.transformRay(portion.inverseMatrix, rtcRayOrigin, rtcRayDir, rtcRayOrigin, rtcRayDir);
67359
67439
 
67360
- const a = tempVec3d$b;
67361
- const b = tempVec3e$2;
67440
+ const a = tempVec3d$3;
67441
+ const b = tempVec3e;
67362
67442
  const c = tempVec3f;
67363
67443
 
67364
67444
  let gotIntersect = false;
@@ -67488,7 +67568,7 @@ class LinesBatchingColorRenderer extends VBOSceneModelLineBatchingRenderer {
67488
67568
  _buildVertexShader() {
67489
67569
  const scene = this._scene;
67490
67570
  const sectionPlanesState = scene._sectionPlanesState;
67491
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
67571
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
67492
67572
  const src = [];
67493
67573
  src.push('#version 300 es');
67494
67574
  src.push("// Lines batching color vertex shader");
@@ -67541,7 +67621,7 @@ class LinesBatchingColorRenderer extends VBOSceneModelLineBatchingRenderer {
67541
67621
  _buildFragmentShader() {
67542
67622
  const scene = this._scene;
67543
67623
  const sectionPlanesState = scene._sectionPlanesState;
67544
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
67624
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
67545
67625
  const src = [];
67546
67626
  src.push('#version 300 es');
67547
67627
  src.push("// Lines batching color fragment shader");
@@ -67559,7 +67639,7 @@ class LinesBatchingColorRenderer extends VBOSceneModelLineBatchingRenderer {
67559
67639
  if (clipping) {
67560
67640
  src.push("in vec4 vWorldPosition;");
67561
67641
  src.push("in float vFlags;");
67562
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
67642
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
67563
67643
  src.push("uniform bool sectionPlaneActive" + i + ";");
67564
67644
  src.push("uniform vec3 sectionPlanePos" + i + ";");
67565
67645
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -67572,7 +67652,7 @@ class LinesBatchingColorRenderer extends VBOSceneModelLineBatchingRenderer {
67572
67652
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
67573
67653
  src.push(" if (clippable) {");
67574
67654
  src.push(" float dist = 0.0;");
67575
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
67655
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
67576
67656
  src.push("if (sectionPlaneActive" + i + ") {");
67577
67657
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
67578
67658
  src.push("}");
@@ -67602,7 +67682,7 @@ class LinesBatchingSilhouetteRenderer extends VBOSceneModelLineBatchingRenderer
67602
67682
 
67603
67683
  const scene = this._scene;
67604
67684
  const sectionPlanesState = scene._sectionPlanesState;
67605
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
67685
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
67606
67686
 
67607
67687
  const src = [];
67608
67688
  src.push('#version 300 es');
@@ -67663,7 +67743,7 @@ class LinesBatchingSilhouetteRenderer extends VBOSceneModelLineBatchingRenderer
67663
67743
 
67664
67744
  const scene = this._scene;
67665
67745
  const sectionPlanesState = scene._sectionPlanesState;
67666
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
67746
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
67667
67747
  const src = [];
67668
67748
  src.push('#version 300 es');
67669
67749
  src.push("// Lines batching silhouette fragment shader");
@@ -67682,7 +67762,7 @@ class LinesBatchingSilhouetteRenderer extends VBOSceneModelLineBatchingRenderer
67682
67762
  if (clipping) {
67683
67763
  src.push("in vec4 vWorldPosition;");
67684
67764
  src.push("in float vFlags;");
67685
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
67765
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
67686
67766
  src.push("uniform bool sectionPlaneActive" + i + ";");
67687
67767
  src.push("uniform vec3 sectionPlanePos" + i + ";");
67688
67768
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -67695,7 +67775,7 @@ class LinesBatchingSilhouetteRenderer extends VBOSceneModelLineBatchingRenderer
67695
67775
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
67696
67776
  src.push(" if (clippable) {");
67697
67777
  src.push(" float dist = 0.0;");
67698
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
67778
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
67699
67779
  src.push("if (sectionPlaneActive" + i + ") {");
67700
67780
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
67701
67781
  src.push("}");
@@ -68543,7 +68623,7 @@ class LinesInstancingColorRenderer extends VBOSceneModelLineInstancingRenderer {
68543
68623
  _buildVertexShader() {
68544
68624
  const scene = this._scene;
68545
68625
  const sectionPlanesState = scene._sectionPlanesState;
68546
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
68626
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
68547
68627
  const src = [];
68548
68628
  src.push('#version 300 es');
68549
68629
  src.push("// Lines instancing color vertex shader");
@@ -68616,7 +68696,7 @@ class LinesInstancingColorRenderer extends VBOSceneModelLineInstancingRenderer {
68616
68696
  const sectionPlanesState = scene._sectionPlanesState;
68617
68697
  let i;
68618
68698
  let len;
68619
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
68699
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
68620
68700
  const src = [];
68621
68701
  src.push('#version 300 es');
68622
68702
  src.push("// Lines instancing color fragment shader");
@@ -68634,7 +68714,7 @@ class LinesInstancingColorRenderer extends VBOSceneModelLineInstancingRenderer {
68634
68714
  if (clipping) {
68635
68715
  src.push("in vec4 vWorldPosition;");
68636
68716
  src.push("in float vFlags;");
68637
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
68717
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
68638
68718
  src.push("uniform bool sectionPlaneActive" + i + ";");
68639
68719
  src.push("uniform vec3 sectionPlanePos" + i + ";");
68640
68720
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -68647,7 +68727,7 @@ class LinesInstancingColorRenderer extends VBOSceneModelLineInstancingRenderer {
68647
68727
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
68648
68728
  src.push(" if (clippable) {");
68649
68729
  src.push(" float dist = 0.0;");
68650
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
68730
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
68651
68731
  src.push("if (sectionPlaneActive" + i + ") {");
68652
68732
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
68653
68733
  src.push("}");
@@ -68690,7 +68770,7 @@ class LinesInstancingSilhouetteRenderer extends VBOSceneModelLineInstancingRende
68690
68770
  _buildVertexShader() {
68691
68771
  const scene = this._scene;
68692
68772
  const sectionPlanesState = scene._sectionPlanesState;
68693
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
68773
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
68694
68774
  const src = [];
68695
68775
  src.push('#version 300 es');
68696
68776
  src.push("// Lines instancing silhouette vertex shader");
@@ -68755,7 +68835,7 @@ class LinesInstancingSilhouetteRenderer extends VBOSceneModelLineInstancingRende
68755
68835
  _buildFragmentShader() {
68756
68836
  const scene = this._scene;
68757
68837
  const sectionPlanesState = scene._sectionPlanesState;
68758
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
68838
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
68759
68839
  const src = [];
68760
68840
  src.push('#version 300 es');
68761
68841
  src.push("// Lines instancing silhouette fragment shader");
@@ -68773,7 +68853,7 @@ class LinesInstancingSilhouetteRenderer extends VBOSceneModelLineInstancingRende
68773
68853
  if (clipping) {
68774
68854
  src.push("in vec4 vWorldPosition;");
68775
68855
  src.push("in float vFlags;");
68776
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
68856
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
68777
68857
  src.push("uniform bool sectionPlaneActive" + i + ";");
68778
68858
  src.push("uniform vec3 sectionPlanePos" + i + ";");
68779
68859
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -68786,7 +68866,7 @@ class LinesInstancingSilhouetteRenderer extends VBOSceneModelLineInstancingRende
68786
68866
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
68787
68867
  src.push(" if (clippable) {");
68788
68868
  src.push(" float dist = 0.0;");
68789
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
68869
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
68790
68870
  src.push("if (sectionPlaneActive" + i + ") {");
68791
68871
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
68792
68872
  src.push("}");
@@ -69565,7 +69645,7 @@ class PointsBatchingColorRenderer extends VBOSceneModelPointBatchingRenderer {
69565
69645
 
69566
69646
  const scene = this._scene;
69567
69647
  const sectionPlanesState = scene._sectionPlanesState;
69568
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
69648
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
69569
69649
  const pointsMaterial = scene.pointsMaterial;
69570
69650
  const src = [];
69571
69651
  src.push('#version 300 es');
@@ -69658,7 +69738,7 @@ class PointsBatchingColorRenderer extends VBOSceneModelPointBatchingRenderer {
69658
69738
 
69659
69739
  const scene = this._scene;
69660
69740
  const sectionPlanesState = scene._sectionPlanesState;
69661
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
69741
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
69662
69742
  const src = [];
69663
69743
  src.push('#version 300 es');
69664
69744
  src.push("// Points batching color fragment shader");
@@ -69677,7 +69757,7 @@ class PointsBatchingColorRenderer extends VBOSceneModelPointBatchingRenderer {
69677
69757
  if (clipping) {
69678
69758
  src.push("in vec4 vWorldPosition;");
69679
69759
  src.push("in float vFlags;");
69680
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
69760
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
69681
69761
  src.push("uniform bool sectionPlaneActive" + i + ";");
69682
69762
  src.push("uniform vec3 sectionPlanePos" + i + ";");
69683
69763
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -69697,7 +69777,7 @@ class PointsBatchingColorRenderer extends VBOSceneModelPointBatchingRenderer {
69697
69777
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
69698
69778
  src.push(" if (clippable) {");
69699
69779
  src.push(" float dist = 0.0;");
69700
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
69780
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
69701
69781
  src.push("if (sectionPlaneActive" + i + ") {");
69702
69782
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
69703
69783
  src.push("}");
@@ -69730,7 +69810,7 @@ class PointsBatchingSilhouetteRenderer extends VBOSceneModelPointBatchingRendere
69730
69810
 
69731
69811
  const scene = this._scene;
69732
69812
  const sectionPlanesState = scene._sectionPlanesState;
69733
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
69813
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
69734
69814
  const pointsMaterial = scene.pointsMaterial._state;
69735
69815
  const src = [];
69736
69816
  src.push ('#version 300 es');
@@ -69803,7 +69883,7 @@ class PointsBatchingSilhouetteRenderer extends VBOSceneModelPointBatchingRendere
69803
69883
  const sectionPlanesState = scene._sectionPlanesState;
69804
69884
  let i;
69805
69885
  let len;
69806
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
69886
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
69807
69887
  const src = [];
69808
69888
  src.push ('#version 300 es');
69809
69889
  src.push("// Points batching silhouette vertex shader");
@@ -69821,7 +69901,7 @@ class PointsBatchingSilhouetteRenderer extends VBOSceneModelPointBatchingRendere
69821
69901
  if (clipping) {
69822
69902
  src.push("in vec4 vWorldPosition;");
69823
69903
  src.push("in float vFlags;");
69824
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
69904
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
69825
69905
  src.push("uniform bool sectionPlaneActive" + i + ";");
69826
69906
  src.push("uniform vec3 sectionPlanePos" + i + ";");
69827
69907
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -69841,7 +69921,7 @@ class PointsBatchingSilhouetteRenderer extends VBOSceneModelPointBatchingRendere
69841
69921
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
69842
69922
  src.push(" if (clippable) {");
69843
69923
  src.push(" float dist = 0.0;");
69844
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
69924
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
69845
69925
  src.push("if (sectionPlaneActive" + i + ") {");
69846
69926
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
69847
69927
  src.push("}");
@@ -69869,7 +69949,7 @@ class PointsBatchingPickMeshRenderer extends VBOSceneModelPointBatchingRenderer
69869
69949
  _buildVertexShader() {
69870
69950
 
69871
69951
  const scene = this._scene;
69872
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
69952
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
69873
69953
  const pointsMaterial = scene.pointsMaterial._state;
69874
69954
  const src = [];
69875
69955
  src.push ('#version 300 es');
@@ -69948,7 +70028,7 @@ class PointsBatchingPickMeshRenderer extends VBOSceneModelPointBatchingRenderer
69948
70028
  _buildFragmentShader() {
69949
70029
  const scene = this._scene;
69950
70030
  const sectionPlanesState = scene._sectionPlanesState;
69951
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
70031
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
69952
70032
  const src = [];
69953
70033
  src.push ('#version 300 es');
69954
70034
  src.push("// Points batching pick mesh vertex shader");
@@ -69966,7 +70046,7 @@ class PointsBatchingPickMeshRenderer extends VBOSceneModelPointBatchingRenderer
69966
70046
  if (clipping) {
69967
70047
  src.push("in vec4 vWorldPosition;");
69968
70048
  src.push("in float vFlags;");
69969
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
70049
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
69970
70050
  src.push("uniform bool sectionPlaneActive" + i + ";");
69971
70051
  src.push("uniform vec3 sectionPlanePos" + i + ";");
69972
70052
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -69986,7 +70066,7 @@ class PointsBatchingPickMeshRenderer extends VBOSceneModelPointBatchingRenderer
69986
70066
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
69987
70067
  src.push(" if (clippable) {");
69988
70068
  src.push(" float dist = 0.0;");
69989
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
70069
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
69990
70070
  src.push(" if (sectionPlaneActive" + i + ") {");
69991
70071
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
69992
70072
  src.push(" }");
@@ -70013,7 +70093,7 @@ class PointsBatchingPickDepthRenderer extends VBOSceneModelPointBatchingRenderer
70013
70093
 
70014
70094
  _buildVertexShader() {
70015
70095
  const scene = this._scene;
70016
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
70096
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
70017
70097
  const pointsMaterial = scene.pointsMaterial._state;
70018
70098
  const src = [];
70019
70099
  src.push ('#version 300 es');
@@ -70087,7 +70167,7 @@ class PointsBatchingPickDepthRenderer extends VBOSceneModelPointBatchingRenderer
70087
70167
  _buildFragmentShader() {
70088
70168
  const scene = this._scene;
70089
70169
  const sectionPlanesState = scene._sectionPlanesState;
70090
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
70170
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
70091
70171
  const src = [];
70092
70172
  src.push ('#version 300 es');
70093
70173
  src.push("// Points batched pick depth fragment shader");
@@ -70111,7 +70191,7 @@ class PointsBatchingPickDepthRenderer extends VBOSceneModelPointBatchingRenderer
70111
70191
  if (clipping) {
70112
70192
  src.push("in vec4 vWorldPosition;");
70113
70193
  src.push("in float vFlags;");
70114
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
70194
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
70115
70195
  src.push("uniform bool sectionPlaneActive" + i + ";");
70116
70196
  src.push("uniform vec3 sectionPlanePos" + i + ";");
70117
70197
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -70138,7 +70218,7 @@ class PointsBatchingPickDepthRenderer extends VBOSceneModelPointBatchingRenderer
70138
70218
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
70139
70219
  src.push(" if (clippable) {");
70140
70220
  src.push(" float dist = 0.0;");
70141
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
70221
+ for (var i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
70142
70222
  src.push(" if (sectionPlaneActive" + i + ") {");
70143
70223
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
70144
70224
  src.push(" }");
@@ -70166,7 +70246,7 @@ class PointsBatchingOcclusionRenderer extends VBOSceneModelPointBatchingRenderer
70166
70246
 
70167
70247
  _buildVertexShader() {
70168
70248
  const scene = this._scene;
70169
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
70249
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
70170
70250
  const pointsMaterial = scene.pointsMaterial._state;
70171
70251
  const src = [];
70172
70252
  src.push ('#version 300 es');
@@ -70234,7 +70314,7 @@ class PointsBatchingOcclusionRenderer extends VBOSceneModelPointBatchingRenderer
70234
70314
  _buildFragmentShader() {
70235
70315
  const scene = this._scene;
70236
70316
  const sectionPlanesState = scene._sectionPlanesState;
70237
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
70317
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
70238
70318
  const src = [];
70239
70319
  src.push ('#version 300 es');
70240
70320
  src.push("// Points batching occlusion fragment shader");
@@ -70252,7 +70332,7 @@ class PointsBatchingOcclusionRenderer extends VBOSceneModelPointBatchingRenderer
70252
70332
  if (clipping) {
70253
70333
  src.push("in vec4 vWorldPosition;");
70254
70334
  src.push("in float vFlags;");
70255
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
70335
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
70256
70336
  src.push("uniform bool sectionPlaneActive" + i + ";");
70257
70337
  src.push("uniform vec3 sectionPlanePos" + i + ";");
70258
70338
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -70271,7 +70351,7 @@ class PointsBatchingOcclusionRenderer extends VBOSceneModelPointBatchingRenderer
70271
70351
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
70272
70352
  src.push(" if (clippable) {");
70273
70353
  src.push(" float dist = 0.0;");
70274
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
70354
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
70275
70355
  src.push(" if (sectionPlaneActive" + i + ") {");
70276
70356
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
70277
70357
  src.push(" }");
@@ -71174,7 +71254,7 @@ class PointsInstancingColorRenderer extends VBOSceneModelPointInstancingRenderer
71174
71254
  _buildVertexShader() {
71175
71255
  const scene = this._scene;
71176
71256
  const sectionPlanesState = scene._sectionPlanesState;
71177
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71257
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71178
71258
  const pointsMaterial = scene.pointsMaterial._state;
71179
71259
  const src = [];
71180
71260
  src.push('#version 300 es');
@@ -71274,7 +71354,7 @@ class PointsInstancingColorRenderer extends VBOSceneModelPointInstancingRenderer
71274
71354
  _buildFragmentShader() {
71275
71355
  const scene = this._scene;
71276
71356
  const sectionPlanesState = scene._sectionPlanesState;
71277
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71357
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71278
71358
  const src = [];
71279
71359
  src.push('#version 300 es');
71280
71360
  src.push("// Points instancing color fragment shader");
@@ -71293,7 +71373,7 @@ class PointsInstancingColorRenderer extends VBOSceneModelPointInstancingRenderer
71293
71373
  if (clipping) {
71294
71374
  src.push("in vec4 vWorldPosition;");
71295
71375
  src.push("in float vFlags;");
71296
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
71376
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
71297
71377
  src.push("uniform bool sectionPlaneActive" + i + ";");
71298
71378
  src.push("uniform vec3 sectionPlanePos" + i + ";");
71299
71379
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -71313,7 +71393,7 @@ class PointsInstancingColorRenderer extends VBOSceneModelPointInstancingRenderer
71313
71393
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
71314
71394
  src.push(" if (clippable) {");
71315
71395
  src.push(" float dist = 0.0;");
71316
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
71396
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
71317
71397
  src.push("if (sectionPlaneActive" + i + ") {");
71318
71398
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
71319
71399
  src.push("}");
@@ -71346,7 +71426,7 @@ class PointsInstancingSilhouetteRenderer extends VBOSceneModelPointInstancingRen
71346
71426
 
71347
71427
  const scene = this._scene;
71348
71428
  const sectionPlanesState = scene._sectionPlanesState;
71349
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71429
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71350
71430
  const pointsMaterial = scene.pointsMaterial._state;
71351
71431
  const src = [];
71352
71432
  src.push ('#version 300 es');
@@ -71428,7 +71508,7 @@ class PointsInstancingSilhouetteRenderer extends VBOSceneModelPointInstancingRen
71428
71508
  _buildFragmentShader() {
71429
71509
  const scene = this._scene;
71430
71510
  const sectionPlanesState = scene._sectionPlanesState;
71431
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71511
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71432
71512
  const src = [];
71433
71513
  src.push ('#version 300 es');
71434
71514
  src.push("// Points instancing silhouette fragment shader");
@@ -71446,7 +71526,7 @@ class PointsInstancingSilhouetteRenderer extends VBOSceneModelPointInstancingRen
71446
71526
  if (clipping) {
71447
71527
  src.push("in vec4 vWorldPosition;");
71448
71528
  src.push("in float vFlags;");
71449
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
71529
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
71450
71530
  src.push("uniform bool sectionPlaneActive" + i + ";");
71451
71531
  src.push("uniform vec3 sectionPlanePos" + i + ";");
71452
71532
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -71466,7 +71546,7 @@ class PointsInstancingSilhouetteRenderer extends VBOSceneModelPointInstancingRen
71466
71546
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
71467
71547
  src.push(" if (clippable) {");
71468
71548
  src.push(" float dist = 0.0;");
71469
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
71549
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
71470
71550
  src.push("if (sectionPlaneActive" + i + ") {");
71471
71551
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
71472
71552
  src.push("}");
@@ -71494,7 +71574,7 @@ class PointsInstancingPickMeshRenderer extends VBOSceneModelPointInstancingRende
71494
71574
  _buildVertexShader() {
71495
71575
  const scene = this._scene;
71496
71576
  const sectionPlanesState = scene._sectionPlanesState;
71497
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71577
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71498
71578
  const pointsMaterial = scene.pointsMaterial._state;
71499
71579
  const src = [];
71500
71580
  src.push ('#version 300 es');
@@ -71577,7 +71657,7 @@ class PointsInstancingPickMeshRenderer extends VBOSceneModelPointInstancingRende
71577
71657
  _buildFragmentShader() {
71578
71658
  const scene = this._scene;
71579
71659
  const sectionPlanesState = scene._sectionPlanesState;
71580
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71660
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71581
71661
  const src = [];
71582
71662
  src.push ('#version 300 es');
71583
71663
  src.push("// Points instancing pick mesh fragment shader");
@@ -71595,7 +71675,7 @@ class PointsInstancingPickMeshRenderer extends VBOSceneModelPointInstancingRende
71595
71675
  if (clipping) {
71596
71676
  src.push("in vec4 vWorldPosition;");
71597
71677
  src.push("in float vFlags;");
71598
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
71678
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
71599
71679
  src.push("uniform bool sectionPlaneActive" + i + ";");
71600
71680
  src.push("uniform vec3 sectionPlanePos" + i + ";");
71601
71681
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -71617,7 +71697,7 @@ class PointsInstancingPickMeshRenderer extends VBOSceneModelPointInstancingRende
71617
71697
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
71618
71698
  src.push(" if (clippable) {");
71619
71699
  src.push(" float dist = 0.0;");
71620
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
71700
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
71621
71701
  src.push("if (sectionPlaneActive" + i + ") {");
71622
71702
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
71623
71703
  src.push("}");
@@ -71645,7 +71725,7 @@ class PointsInstancingPickDepthRenderer extends VBOSceneModelPointInstancingRend
71645
71725
  _buildVertexShader() {
71646
71726
  const scene = this._scene;
71647
71727
  const sectionPlanesState = scene._sectionPlanesState;
71648
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71728
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71649
71729
  const pointsMaterial = scene.pointsMaterial._state;
71650
71730
  const src = [];
71651
71731
 
@@ -71730,7 +71810,7 @@ class PointsInstancingPickDepthRenderer extends VBOSceneModelPointInstancingRend
71730
71810
  _buildFragmentShader() {
71731
71811
  const scene = this._scene;
71732
71812
  const sectionPlanesState = scene._sectionPlanesState;
71733
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71813
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71734
71814
  const src = [];
71735
71815
  src.push ('#version 300 es');
71736
71816
  src.push("// Points instancing pick depth fragment shader");
@@ -71754,7 +71834,7 @@ class PointsInstancingPickDepthRenderer extends VBOSceneModelPointInstancingRend
71754
71834
  if (clipping) {
71755
71835
  src.push("in vec4 vWorldPosition;");
71756
71836
  src.push("in float vFlags;");
71757
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
71837
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
71758
71838
  src.push("uniform bool sectionPlaneActive" + i + ";");
71759
71839
  src.push("uniform vec3 sectionPlanePos" + i + ";");
71760
71840
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -71783,7 +71863,7 @@ class PointsInstancingPickDepthRenderer extends VBOSceneModelPointInstancingRend
71783
71863
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
71784
71864
  src.push(" if (clippable) {");
71785
71865
  src.push(" float dist = 0.0;");
71786
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
71866
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
71787
71867
  src.push("if (sectionPlaneActive" + i + ") {");
71788
71868
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
71789
71869
  src.push("}");
@@ -71813,7 +71893,7 @@ class PointsInstancingOcclusionRenderer extends VBOSceneModelPointInstancingRend
71813
71893
 
71814
71894
  const scene = this._scene;
71815
71895
  const sectionPlanesState = scene._sectionPlanesState;
71816
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71896
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71817
71897
  const pointsMaterial = scene.pointsMaterial._state;
71818
71898
  const src = [];
71819
71899
 
@@ -71895,7 +71975,7 @@ class PointsInstancingOcclusionRenderer extends VBOSceneModelPointInstancingRend
71895
71975
  _buildFragmentShader() {
71896
71976
  const scene = this._scene;
71897
71977
  const sectionPlanesState = scene._sectionPlanesState;
71898
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
71978
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71899
71979
  const src = [];
71900
71980
  src.push ('#version 300 es');
71901
71981
  src.push("// Points instancing occlusion vertex shader");
@@ -71913,7 +71993,7 @@ class PointsInstancingOcclusionRenderer extends VBOSceneModelPointInstancingRend
71913
71993
  if (clipping) {
71914
71994
  src.push("in vec4 vWorldPosition;");
71915
71995
  src.push("in float vFlags;");
71916
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
71996
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
71917
71997
  src.push("uniform bool sectionPlaneActive" + i + ";");
71918
71998
  src.push("uniform vec3 sectionPlanePos" + i + ";");
71919
71999
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -71932,7 +72012,7 @@ class PointsInstancingOcclusionRenderer extends VBOSceneModelPointInstancingRend
71932
72012
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
71933
72013
  src.push(" if (clippable) {");
71934
72014
  src.push(" float dist = 0.0;");
71935
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
72015
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
71936
72016
  src.push("if (sectionPlaneActive" + i + ") {");
71937
72017
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
71938
72018
  src.push("}");
@@ -71960,7 +72040,7 @@ class PointsInstancingDepthRenderer extends VBOSceneModelPointInstancingRenderer
71960
72040
  _buildVertexShader() {
71961
72041
  const scene = this._scene;
71962
72042
  const sectionPlanesState = scene._sectionPlanesState;
71963
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
72043
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
71964
72044
  const pointsMaterial = scene.pointsMaterial._state;
71965
72045
  const src = [];
71966
72046
  src.push('#version 300 es');
@@ -72033,7 +72113,7 @@ class PointsInstancingDepthRenderer extends VBOSceneModelPointInstancingRenderer
72033
72113
  const sectionPlanesState = scene._sectionPlanesState;
72034
72114
  let i;
72035
72115
  let len;
72036
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
72116
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
72037
72117
  const src = [];
72038
72118
  src.push('#version 300 es');
72039
72119
  src.push("// Points instancing depth vertex shader");
@@ -72051,7 +72131,7 @@ class PointsInstancingDepthRenderer extends VBOSceneModelPointInstancingRenderer
72051
72131
  if (clipping) {
72052
72132
  src.push("in vec4 vWorldPosition;");
72053
72133
  src.push("in float vFlags;");
72054
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
72134
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
72055
72135
  src.push("uniform bool sectionPlaneActive" + i + ";");
72056
72136
  src.push("uniform vec3 sectionPlanePos" + i + ";");
72057
72137
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -72085,7 +72165,7 @@ class PointsInstancingDepthRenderer extends VBOSceneModelPointInstancingRenderer
72085
72165
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
72086
72166
  src.push(" if (clippable) {");
72087
72167
  src.push(" float dist = 0.0;");
72088
- for (i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
72168
+ for (i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
72089
72169
  src.push("if (sectionPlaneActive" + i + ") {");
72090
72170
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
72091
72171
  src.push("}");
@@ -72112,7 +72192,7 @@ class PointsInstancingShadowRenderer extends VBOSceneModelPointInstancingRendere
72112
72192
  _buildVertexShader() {
72113
72193
  const scene = this._scene;
72114
72194
  const sectionPlanesState = scene._sectionPlanesState;
72115
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
72195
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
72116
72196
  const src = [];
72117
72197
  src.push ('#version 300 es');
72118
72198
  src.push("// Instancing geometry shadow drawing vertex shader");
@@ -72163,7 +72243,7 @@ class PointsInstancingShadowRenderer extends VBOSceneModelPointInstancingRendere
72163
72243
  _buildFragmentShader() {
72164
72244
  const scene = this._scene;
72165
72245
  const sectionPlanesState = scene._sectionPlanesState;
72166
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
72246
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
72167
72247
  const src = [];
72168
72248
  src.push ('#version 300 es');
72169
72249
  src.push("// Instancing geometry depth drawing fragment shader");
@@ -72182,7 +72262,7 @@ class PointsInstancingShadowRenderer extends VBOSceneModelPointInstancingRendere
72182
72262
  if (clipping) {
72183
72263
  src.push("in vec4 vWorldPosition;");
72184
72264
  src.push("in float vFlags;");
72185
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
72265
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
72186
72266
  src.push("uniform bool sectionPlaneActive" + i + ";");
72187
72267
  src.push("uniform vec3 sectionPlanePos" + i + ";");
72188
72268
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -72203,7 +72283,7 @@ class PointsInstancingShadowRenderer extends VBOSceneModelPointInstancingRendere
72203
72283
  src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");
72204
72284
  src.push(" if (clippable) {");
72205
72285
  src.push(" float dist = 0.0;");
72206
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
72286
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
72207
72287
  src.push("if (sectionPlaneActive" + i + ") {");
72208
72288
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
72209
72289
  src.push("}");
@@ -74660,7 +74740,7 @@ function doCheckResult(buckets, mesh) {
74660
74740
  const tempVec3a$k = math.vec3();
74661
74741
  const tempVec3b$g = math.vec3();
74662
74742
  const tempVec3c$e = math.vec3();
74663
- const tempVec3d$a = math.vec3();
74743
+ math.vec3();
74664
74744
 
74665
74745
  const tempVec4a$6 = math.vec4();
74666
74746
 
@@ -74759,25 +74839,30 @@ class TrianglesDataTextureColorRenderer {
74759
74839
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
74760
74840
  }
74761
74841
 
74842
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
74762
74843
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
74763
- if (numSectionPlanes > 0) {
74844
+ if (numAllocatedSectionPlanes > 0) {
74764
74845
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
74765
74846
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
74766
74847
  const renderFlags = model.renderFlags;
74767
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
74848
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
74768
74849
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
74769
74850
  if (sectionPlaneUniforms) {
74770
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
74771
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
74772
- if (active) {
74773
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
74774
- if (origin) {
74775
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3d$a);
74776
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
74777
- } else {
74778
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
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);
74779
74863
  }
74780
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
74864
+ } else {
74865
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
74781
74866
  }
74782
74867
  }
74783
74868
  }
@@ -74872,7 +74957,7 @@ class TrianglesDataTextureColorRenderer {
74872
74957
 
74873
74958
  this._uSectionPlanes = [];
74874
74959
 
74875
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
74960
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
74876
74961
  this._uSectionPlanes.push({
74877
74962
  active: program.getLocation("sectionPlaneActive" + i),
74878
74963
  pos: program.getLocation("sectionPlanePos" + i),
@@ -74962,7 +75047,7 @@ class TrianglesDataTextureColorRenderer {
74962
75047
  const scene = this._scene;
74963
75048
  const sectionPlanesState = scene._sectionPlanesState;
74964
75049
  const lightsState = scene._lightsState;
74965
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
75050
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
74966
75051
  let light;
74967
75052
  const src = [];
74968
75053
  src.push("#version 300 es");
@@ -75173,7 +75258,7 @@ class TrianglesDataTextureColorRenderer {
75173
75258
  _buildFragmentShader() {
75174
75259
  const scene = this._scene;
75175
75260
  const sectionPlanesState = scene._sectionPlanesState;
75176
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
75261
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
75177
75262
  const src = [];
75178
75263
  src.push('#version 300 es');
75179
75264
  src.push("// TrianglesDataTextureColorRenderer fragment shader");
@@ -75207,7 +75292,7 @@ class TrianglesDataTextureColorRenderer {
75207
75292
  if (clipping) {
75208
75293
  src.push("in vec4 vWorldPosition;");
75209
75294
  src.push("flat in uint vFlags2;");
75210
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
75295
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
75211
75296
  src.push("uniform bool sectionPlaneActive" + i + ";");
75212
75297
  src.push("uniform vec3 sectionPlanePos" + i + ";");
75213
75298
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -75221,7 +75306,7 @@ class TrianglesDataTextureColorRenderer {
75221
75306
  src.push(" bool clippable = vFlags2 > 0u;");
75222
75307
  src.push(" if (clippable) {");
75223
75308
  src.push(" float dist = 0.0;");
75224
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
75309
+ for (let i = 0, len = sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
75225
75310
  src.push("if (sectionPlaneActive" + i + ") {");
75226
75311
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
75227
75312
  src.push("}");
@@ -75272,7 +75357,7 @@ const defaultColor$1 = new Float32Array([1, 1, 1]);
75272
75357
  const tempVec3a$j = math.vec3();
75273
75358
  const tempVec3b$f = math.vec3();
75274
75359
  const tempVec3c$d = math.vec3();
75275
- const tempVec3d$9 = math.vec3();
75360
+ math.vec3();
75276
75361
  const tempMat4a$b = math.mat4();
75277
75362
 
75278
75363
  /**
@@ -75387,25 +75472,30 @@ class TrianglesDataTextureSilhouetteRenderer {
75387
75472
  const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2);
75388
75473
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
75389
75474
  }
75475
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
75390
75476
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
75391
- if (numSectionPlanes > 0) {
75477
+ if (numAllocatedSectionPlanes > 0) {
75392
75478
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
75393
75479
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
75394
75480
  const renderFlags = model.renderFlags;
75395
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
75481
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
75396
75482
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
75397
75483
  if (sectionPlaneUniforms) {
75398
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
75399
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
75400
- if (active) {
75401
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
75402
- if (origin) {
75403
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3d$9);
75404
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
75405
- } else {
75406
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
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);
75407
75496
  }
75408
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
75497
+ } else {
75498
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
75409
75499
  }
75410
75500
  }
75411
75501
  }
@@ -75507,8 +75597,7 @@ class TrianglesDataTextureSilhouetteRenderer {
75507
75597
  _buildVertexShader() {
75508
75598
 
75509
75599
  const scene = this._scene;
75510
- const sectionPlanesState = scene._sectionPlanesState;
75511
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
75600
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
75512
75601
 
75513
75602
  const src = [];
75514
75603
  src.push("#version 300 es");
@@ -75662,8 +75751,7 @@ class TrianglesDataTextureSilhouetteRenderer {
75662
75751
 
75663
75752
  _buildFragmentShader() {
75664
75753
  const scene = this._scene;
75665
- const sectionPlanesState = scene._sectionPlanesState;
75666
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
75754
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
75667
75755
  const src = [];
75668
75756
  src.push('#version 300 es');
75669
75757
  src.push("// Triangles dataTexture draw fragment shader");
@@ -75682,7 +75770,7 @@ class TrianglesDataTextureSilhouetteRenderer {
75682
75770
  if (clipping) {
75683
75771
  src.push("in vec4 vWorldPosition;");
75684
75772
  src.push("flat in uint vFlags2;");
75685
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
75773
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
75686
75774
  src.push("uniform bool sectionPlaneActive" + i + ";");
75687
75775
  src.push("uniform vec3 sectionPlanePos" + i + ";");
75688
75776
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -75695,7 +75783,7 @@ class TrianglesDataTextureSilhouetteRenderer {
75695
75783
  src.push(" bool clippable = vFlags2 > 0u;");
75696
75784
  src.push(" if (clippable) {");
75697
75785
  src.push(" float dist = 0.0;");
75698
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
75786
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
75699
75787
  src.push("if (sectionPlaneActive" + i + ") {");
75700
75788
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
75701
75789
  src.push("}");
@@ -75729,7 +75817,7 @@ const defaultColor = new Float32Array([0, 0, 0, 1]);
75729
75817
 
75730
75818
  const tempVec3a$i = math.vec3();
75731
75819
  const tempVec3b$e = math.vec3();
75732
- const tempVec3d$8 = math.vec3();
75820
+ math.vec3();
75733
75821
  const tempMat4a$a = math.mat4();
75734
75822
 
75735
75823
  /**
@@ -75834,25 +75922,30 @@ class TrianglesDataTextureEdgesRenderer {
75834
75922
  gl.uniform4fv(this._uColor, defaultColor);
75835
75923
  }
75836
75924
 
75925
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
75837
75926
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
75838
- if (numSectionPlanes > 0) {
75927
+ if (numAllocatedSectionPlanes > 0) {
75839
75928
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
75840
75929
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
75841
75930
  const renderFlags = model.renderFlags;
75842
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
75931
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
75843
75932
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
75844
75933
  if (sectionPlaneUniforms) {
75845
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
75846
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
75847
- if (active) {
75848
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
75849
- if (origin) {
75850
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3d$8);
75851
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
75852
- } else {
75853
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
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);
75854
75946
  }
75855
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
75947
+ } else {
75948
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
75856
75949
  }
75857
75950
  }
75858
75951
  }
@@ -75949,8 +76042,7 @@ class TrianglesDataTextureEdgesRenderer {
75949
76042
 
75950
76043
  _buildVertexShader() {
75951
76044
  const scene = this._scene;
75952
- const sectionPlanesState = scene._sectionPlanesState;
75953
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
76045
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
75954
76046
  const src = [];
75955
76047
  src.push("#version 300 es");
75956
76048
  src.push("// Batched geometry edges drawing vertex shader");
@@ -76077,8 +76169,7 @@ class TrianglesDataTextureEdgesRenderer {
76077
76169
 
76078
76170
  _buildFragmentShader() {
76079
76171
  const scene = this._scene;
76080
- const sectionPlanesState = scene._sectionPlanesState;
76081
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
76172
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
76082
76173
  const src = [];
76083
76174
  src.push('#version 300 es');
76084
76175
  src.push("// Batched geometry edges drawing fragment shader");
@@ -76100,7 +76191,7 @@ class TrianglesDataTextureEdgesRenderer {
76100
76191
  if (clipping) {
76101
76192
  src.push("in vec4 vWorldPosition;");
76102
76193
  src.push("flat in uint vFlags2;");
76103
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
76194
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
76104
76195
  src.push("uniform bool sectionPlaneActive" + i + ";");
76105
76196
  src.push("uniform vec3 sectionPlanePos" + i + ";");
76106
76197
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -76113,7 +76204,7 @@ class TrianglesDataTextureEdgesRenderer {
76113
76204
  src.push(" bool clippable = vFlags2 > 0u;");
76114
76205
  src.push(" if (clippable) {");
76115
76206
  src.push(" float dist = 0.0;");
76116
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
76207
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
76117
76208
  src.push("if (sectionPlaneActive" + i + ") {");
76118
76209
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
76119
76210
  src.push("}");
@@ -76305,7 +76396,7 @@ class TrianglesDataTextureEdgesColorRenderer {
76305
76396
  this._uProjMatrix = program.getLocation("projMatrix");
76306
76397
  this._uSectionPlanes = [];
76307
76398
 
76308
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
76399
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
76309
76400
  this._uSectionPlanes.push({
76310
76401
  active: program.getLocation("sectionPlaneActive" + i),
76311
76402
  pos: program.getLocation("sectionPlanePos" + i),
@@ -76351,8 +76442,7 @@ class TrianglesDataTextureEdgesColorRenderer {
76351
76442
 
76352
76443
  _buildVertexShader() {
76353
76444
  const scene = this._scene;
76354
- const sectionPlanesState = scene._sectionPlanesState;
76355
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
76445
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
76356
76446
  const src = [];
76357
76447
  src.push("#version 300 es");
76358
76448
  src.push("// TrianglesDataTextureEdgesColorRenderer");
@@ -76487,8 +76577,7 @@ class TrianglesDataTextureEdgesColorRenderer {
76487
76577
 
76488
76578
  _buildFragmentShader() {
76489
76579
  const scene = this._scene;
76490
- const sectionPlanesState = scene._sectionPlanesState;
76491
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
76580
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
76492
76581
  const src = [];
76493
76582
  src.push('#version 300 es');
76494
76583
  src.push("// TrianglesDataTextureEdgesColorRenderer");
@@ -76507,7 +76596,7 @@ class TrianglesDataTextureEdgesColorRenderer {
76507
76596
  if (clipping) {
76508
76597
  src.push("in vec4 vWorldPosition;");
76509
76598
  src.push("flat in uint vFlags2;");
76510
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
76599
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
76511
76600
  src.push("uniform bool sectionPlaneActive" + i + ";");
76512
76601
  src.push("uniform vec3 sectionPlanePos" + i + ";");
76513
76602
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -76520,7 +76609,7 @@ class TrianglesDataTextureEdgesColorRenderer {
76520
76609
  src.push(" bool clippable = vFlags2 > 0u;");
76521
76610
  src.push(" if (clippable) {");
76522
76611
  src.push(" float dist = 0.0;");
76523
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
76612
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
76524
76613
  src.push("if (sectionPlaneActive" + i + ") {");
76525
76614
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
76526
76615
  src.push("}");
@@ -76529,8 +76618,7 @@ class TrianglesDataTextureEdgesColorRenderer {
76529
76618
  src.push("}");
76530
76619
  }
76531
76620
  if (scene.logarithmicDepthBufferEnabled) {
76532
- // src.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;");
76533
- src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");
76621
+ src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");
76534
76622
  }
76535
76623
  src.push(" outColor = vColor;");
76536
76624
  src.push("}");
@@ -76638,25 +76726,30 @@ class TrianglesDataTexturePickMeshRenderer {
76638
76726
  const logDepthBufFC = 2.0 / (Math.log(camera.project.far + 1.0) / Math.LN2); // TODO: Far from pick project matrix?
76639
76727
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
76640
76728
  }
76729
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
76641
76730
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
76642
- if (numSectionPlanes > 0) {
76731
+ if (numAllocatedSectionPlanes > 0) {
76643
76732
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
76644
76733
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
76645
76734
  const renderFlags = model.renderFlags;
76646
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
76735
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
76647
76736
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
76648
76737
  if (sectionPlaneUniforms) {
76649
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
76650
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
76651
- if (active) {
76652
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
76653
- if (origin) {
76654
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$g);
76655
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
76656
- } else {
76657
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
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);
76658
76750
  }
76659
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
76751
+ } else {
76752
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
76660
76753
  }
76661
76754
  }
76662
76755
  }
@@ -76664,8 +76757,8 @@ class TrianglesDataTexturePickMeshRenderer {
76664
76757
  if (state.numIndices8Bits > 0) {
76665
76758
  textureState.bindTriangleIndicesTextures(
76666
76759
  this._program,
76667
- this._uTexturePerPolygonIdPortionIds,
76668
- this._uTexturePerPolygonIdIndices,
76760
+ this._uTexturePerPolygonIdPortionIds,
76761
+ this._uTexturePerPolygonIdIndices,
76669
76762
  8 // 8 bits indices
76670
76763
  );
76671
76764
  gl.drawArrays(gl.TRIANGLES, 0, state.numIndices8Bits);
@@ -76673,8 +76766,8 @@ class TrianglesDataTexturePickMeshRenderer {
76673
76766
  if (state.numIndices16Bits > 0) {
76674
76767
  textureState.bindTriangleIndicesTextures(
76675
76768
  this._program,
76676
- this._uTexturePerPolygonIdPortionIds,
76677
- this._uTexturePerPolygonIdIndices,
76769
+ this._uTexturePerPolygonIdPortionIds,
76770
+ this._uTexturePerPolygonIdIndices,
76678
76771
  16 // 16 bits indices
76679
76772
  );
76680
76773
  gl.drawArrays(gl.TRIANGLES, 0, state.numIndices16Bits);
@@ -76682,8 +76775,8 @@ class TrianglesDataTexturePickMeshRenderer {
76682
76775
  if (state.numIndices32Bits > 0) {
76683
76776
  textureState.bindTriangleIndicesTextures(
76684
76777
  this._program,
76685
- this._uTexturePerPolygonIdPortionIds,
76686
- this._uTexturePerPolygonIdIndices,
76778
+ this._uTexturePerPolygonIdPortionIds,
76779
+ this._uTexturePerPolygonIdIndices,
76687
76780
  32 // 32 bits indices
76688
76781
  );
76689
76782
  gl.drawArrays(gl.TRIANGLES, 0, state.numIndices32Bits);
@@ -76718,14 +76811,14 @@ class TrianglesDataTexturePickMeshRenderer {
76718
76811
  if (scene.logarithmicDepthBufferEnabled) {
76719
76812
  this._uLogDepthBufFC = program.getLocation("logDepthBufFC");
76720
76813
  }
76721
- this.uTexturePerObjectPositionsDecodeMatrix = "uObjectPerObjectPositionsDecodeMatrix";
76722
- this.uTexturePerObjectColorsAndFlags = "uObjectPerObjectColorsAndFlags";
76723
- this._uTexturePerVertexIdCoordinates = "uTexturePerVertexIdCoordinates";
76724
- this._uTexturePerPolygonIdNormals = "uTexturePerPolygonIdNormals";
76725
- this._uTexturePerPolygonIdIndices = "uTexturePerPolygonIdIndices";
76814
+ this.uTexturePerObjectPositionsDecodeMatrix = "uObjectPerObjectPositionsDecodeMatrix";
76815
+ this.uTexturePerObjectColorsAndFlags = "uObjectPerObjectColorsAndFlags";
76816
+ this._uTexturePerVertexIdCoordinates = "uTexturePerVertexIdCoordinates";
76817
+ this._uTexturePerPolygonIdNormals = "uTexturePerPolygonIdNormals";
76818
+ this._uTexturePerPolygonIdIndices = "uTexturePerPolygonIdIndices";
76726
76819
  this._uTexturePerPolygonIdPortionIds = "uTexturePerPolygonIdPortionIds";
76727
- this._uTexturePerObjectMatrix= "uTexturePerObjectMatrix";
76728
- this._uCameraEyeRtc = program.getLocation("uCameraEyeRtc");
76820
+ this._uTexturePerObjectMatrix = "uTexturePerObjectMatrix";
76821
+ this._uCameraEyeRtc = program.getLocation("uCameraEyeRtc");
76729
76822
  }
76730
76823
 
76731
76824
  _bindProgram(frameCtx) {
@@ -76744,7 +76837,7 @@ class TrianglesDataTexturePickMeshRenderer {
76744
76837
 
76745
76838
  _buildVertexShader() {
76746
76839
  const scene = this._scene;
76747
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
76840
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
76748
76841
  const src = [];
76749
76842
  src.push("#version 300 es");
76750
76843
  src.push("// Batched geometry picking vertex shader");
@@ -76779,10 +76872,10 @@ class TrianglesDataTexturePickMeshRenderer {
76779
76872
  src.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;");
76780
76873
  src.push("uniform highp sampler2D uTexturePerObjectMatrix;");
76781
76874
  src.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;");
76782
- src.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;");
76783
- src.push("uniform highp usampler2D uTexturePerPolygonIdIndices;");
76875
+ src.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;");
76876
+ src.push("uniform highp usampler2D uTexturePerPolygonIdIndices;");
76784
76877
  src.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;");
76785
- src.push("uniform vec3 uCameraEyeRtc;");
76878
+ src.push("uniform vec3 uCameraEyeRtc;");
76786
76879
 
76787
76880
  src.push("vec3 positions[3];");
76788
76881
 
@@ -76825,9 +76918,9 @@ class TrianglesDataTexturePickMeshRenderer {
76825
76918
  src.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);");
76826
76919
 
76827
76920
  // get flags & flags2
76828
- src.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);");
76829
- src.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);");
76830
-
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
+
76831
76924
  // flags.w = NOT_RENDERED | PICK
76832
76925
  // renderPass = PICK
76833
76926
 
@@ -76837,9 +76930,9 @@ class TrianglesDataTexturePickMeshRenderer {
76837
76930
  src.push("} else {");
76838
76931
 
76839
76932
  // get vertex base
76840
- 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));");
76841
76934
 
76842
- 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));");
76843
76936
 
76844
76937
  src.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;");
76845
76938
 
@@ -76848,7 +76941,7 @@ class TrianglesDataTexturePickMeshRenderer {
76848
76941
 
76849
76942
  src.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));");
76850
76943
  src.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;");
76851
-
76944
+
76852
76945
  src.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;");
76853
76946
  src.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;");
76854
76947
 
@@ -76856,7 +76949,7 @@ class TrianglesDataTexturePickMeshRenderer {
76856
76949
 
76857
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));");
76858
76951
 
76859
- 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;");
76860
76953
 
76861
76954
  // get position
76862
76955
  src.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));");
@@ -76864,7 +76957,7 @@ class TrianglesDataTexturePickMeshRenderer {
76864
76957
  src.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));");
76865
76958
 
76866
76959
  // get color
76867
- 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);");
76868
76961
 
76869
76962
  src.push(`if (color.a == 0u) {`);
76870
76963
  src.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"); // Cull vertex
@@ -76882,17 +76975,17 @@ class TrianglesDataTexturePickMeshRenderer {
76882
76975
 
76883
76976
  // when the geometry is not solid, if needed, flip the triangle winding
76884
76977
  src.push("if (solid != 1u) {");
76885
- src.push("if (isPerspectiveMatrix(projMatrix)) {");
76886
- src.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;");
76887
- src.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {");
76888
- src.push("position = positions[2 - (gl_VertexID % 3)];");
76889
- src.push("}");
76890
- src.push("} else {");
76891
- src.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);");
76892
- src.push("if (viewNormal.z < 0.0) {");
76893
- src.push("position = positions[2 - (gl_VertexID % 3)];");
76894
- src.push("}");
76895
- src.push("}");
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("}");
76896
76989
  src.push("}");
76897
76990
 
76898
76991
  src.push("vec4 worldPosition = sceneModelMatrix * (objectDecodeAndInstanceMatrix * vec4(position, 1.0)); ");
@@ -76916,10 +77009,9 @@ class TrianglesDataTexturePickMeshRenderer {
76916
77009
 
76917
77010
  _buildFragmentShader() {
76918
77011
  const scene = this._scene;
76919
- const sectionPlanesState = scene._sectionPlanesState;
76920
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
77012
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
76921
77013
  const src = [];
76922
- src.push ('#version 300 es');
77014
+ src.push('#version 300 es');
76923
77015
  src.push("// Batched geometry picking fragment shader");
76924
77016
  src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");
76925
77017
  src.push("precision highp float;");
@@ -76936,7 +77028,7 @@ class TrianglesDataTexturePickMeshRenderer {
76936
77028
  if (clipping) {
76937
77029
  src.push("in vec4 vWorldPosition;");
76938
77030
  src.push("flat in uvec4 vFlags2;");
76939
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
77031
+ for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
76940
77032
  src.push("uniform bool sectionPlaneActive" + i + ";");
76941
77033
  src.push("uniform vec3 sectionPlanePos" + i + ";");
76942
77034
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -76949,7 +77041,7 @@ class TrianglesDataTexturePickMeshRenderer {
76949
77041
  src.push(" bool clippable = (float(vFlags2.x) > 0.0);");
76950
77042
  src.push(" if (clippable) {");
76951
77043
  src.push(" float dist = 0.0;");
76952
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
77044
+ for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
76953
77045
  src.push(" if (sectionPlaneActive" + i + ") {");
76954
77046
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
76955
77047
  src.push(" }");
@@ -76958,7 +77050,7 @@ class TrianglesDataTexturePickMeshRenderer {
76958
77050
  src.push(" }");
76959
77051
  }
76960
77052
  if (scene.logarithmicDepthBufferEnabled) {
76961
- 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;");
76962
77054
  //src.push(" gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;");
76963
77055
  }
76964
77056
  src.push(" outPickColor = vPickColor; ");
@@ -76981,7 +77073,7 @@ class TrianglesDataTexturePickMeshRenderer {
76981
77073
  const tempVec3a$f = math.vec3();
76982
77074
  const tempVec3b$b = math.vec3();
76983
77075
  const tempVec3c$a = math.vec3();
76984
- const tempVec3d$7 = math.vec3();
77076
+ math.vec3();
76985
77077
  const tempMat4a$7 = math.mat4();
76986
77078
 
76987
77079
  /**
@@ -77082,25 +77174,30 @@ class TrianglesDataTexturePickDepthRenderer {
77082
77174
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
77083
77175
  }
77084
77176
 
77177
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
77085
77178
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
77086
- if (numSectionPlanes > 0) {
77179
+ if (numAllocatedSectionPlanes > 0) {
77087
77180
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
77088
77181
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
77089
77182
  const renderFlags = model.renderFlags;
77090
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
77183
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
77091
77184
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
77092
77185
  if (sectionPlaneUniforms) {
77093
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
77094
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
77095
- if (active) {
77096
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
77097
- if (origin) {
77098
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3d$7);
77099
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
77100
- } else {
77101
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
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);
77102
77198
  }
77103
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
77199
+ } else {
77200
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
77104
77201
  }
77105
77202
  }
77106
77203
  }
@@ -77152,7 +77249,7 @@ class TrianglesDataTexturePickDepthRenderer {
77152
77249
  this._uViewMatrix = program.getLocation("viewMatrix");
77153
77250
  this._uProjMatrix = program.getLocation("projMatrix");
77154
77251
  this._uSectionPlanes = [];
77155
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
77252
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
77156
77253
  this._uSectionPlanes.push({
77157
77254
  active: program.getLocation("sectionPlaneActive" + i),
77158
77255
  pos: program.getLocation("sectionPlanePos" + i),
@@ -77188,7 +77285,7 @@ class TrianglesDataTexturePickDepthRenderer {
77188
77285
  _buildVertexShader() {
77189
77286
 
77190
77287
  const scene = this._scene;
77191
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
77288
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
77192
77289
  const src = [];
77193
77290
  src.push("#version 300 es");
77194
77291
  src.push("// Triangles dataTexture pick depth vertex shader");
@@ -77356,8 +77453,7 @@ class TrianglesDataTexturePickDepthRenderer {
77356
77453
  _buildFragmentShader() {
77357
77454
 
77358
77455
  const scene = this._scene;
77359
- const sectionPlanesState = scene._sectionPlanesState;
77360
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
77456
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
77361
77457
  const src = [];
77362
77458
  src.push('#version 300 es');
77363
77459
  src.push("// Triangles dataTexture pick depth fragment shader");
@@ -77382,7 +77478,7 @@ class TrianglesDataTexturePickDepthRenderer {
77382
77478
  if (clipping) {
77383
77479
  src.push("in vec4 vWorldPosition;");
77384
77480
  src.push("flat in uint vFlags2;");
77385
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
77481
+ for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
77386
77482
  src.push("uniform bool sectionPlaneActive" + i + ";");
77387
77483
  src.push("uniform vec3 sectionPlanePos" + i + ";");
77388
77484
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -77403,7 +77499,7 @@ class TrianglesDataTexturePickDepthRenderer {
77403
77499
  src.push(" bool clippable = vFlags2 > 0u;");
77404
77500
  src.push(" if (clippable) {");
77405
77501
  src.push(" float dist = 0.0;");
77406
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
77502
+ for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
77407
77503
  src.push(" if (sectionPlaneActive" + i + ") {");
77408
77504
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
77409
77505
  src.push(" }");
@@ -77435,8 +77531,8 @@ class TrianglesDataTexturePickDepthRenderer {
77435
77531
  const tempVec3a$e = math.vec3();
77436
77532
  const tempVec3b$a = math.vec3();
77437
77533
  const tempVec3c$9 = math.vec3();
77438
- const tempVec3d$6 = math.vec3();
77439
- const tempVec3e$1 = math.vec3();
77534
+ const tempVec3d$2 = math.vec3();
77535
+ math.vec3();
77440
77536
  const tempMat4a$6 = math.mat4();
77441
77537
 
77442
77538
  /**
@@ -77521,7 +77617,7 @@ class TrianglesDataTextureSnapDepthRenderer {
77521
77617
  rtcOrigin[1] += position[1];
77522
77618
  rtcOrigin[2] += position[2];
77523
77619
  rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a$6);
77524
- rtcCameraEye = tempVec3d$6;
77620
+ rtcCameraEye = tempVec3d$2;
77525
77621
  rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];
77526
77622
  rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];
77527
77623
  rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];
@@ -77550,25 +77646,30 @@ class TrianglesDataTextureSnapDepthRenderer {
77550
77646
  const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2);
77551
77647
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
77552
77648
  }
77649
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
77553
77650
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
77554
- if (numSectionPlanes > 0) {
77651
+ if (numAllocatedSectionPlanes > 0) {
77555
77652
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
77556
77653
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
77557
77654
  const renderFlags = model.renderFlags;
77558
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
77655
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
77559
77656
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
77560
77657
  if (sectionPlaneUniforms) {
77561
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
77562
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
77563
- if (active) {
77564
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
77565
- if (origin) {
77566
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3e$1);
77567
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
77568
- } else {
77569
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
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);
77570
77670
  }
77571
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
77671
+ } else {
77672
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
77572
77673
  }
77573
77674
  }
77574
77675
  }
@@ -77656,8 +77757,7 @@ class TrianglesDataTextureSnapDepthRenderer {
77656
77757
 
77657
77758
  _buildVertexShader() {
77658
77759
  const scene = this._scene;
77659
- const sectionPlanesState = scene._sectionPlanesState;
77660
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
77760
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
77661
77761
  const src = [];
77662
77762
  src.push("#version 300 es");
77663
77763
  src.push("// Batched geometry edges drawing vertex shader");
@@ -77788,8 +77888,7 @@ class TrianglesDataTextureSnapDepthRenderer {
77788
77888
  _buildFragmentShader() {
77789
77889
 
77790
77890
  const scene = this._scene;
77791
- const sectionPlanesState = scene._sectionPlanesState;
77792
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
77891
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
77793
77892
  const src = [];
77794
77893
  src.push('#version 300 es');
77795
77894
  src.push("// Triangles dataTexture pick depth fragment shader");
@@ -77810,7 +77909,7 @@ class TrianglesDataTextureSnapDepthRenderer {
77810
77909
  if (clipping) {
77811
77910
  src.push("in vec4 vWorldPosition;");
77812
77911
  src.push("flat in uint vFlags2;");
77813
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
77912
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
77814
77913
  src.push("uniform bool sectionPlaneActive" + i + ";");
77815
77914
  src.push("uniform vec3 sectionPlanePos" + i + ";");
77816
77915
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -77823,7 +77922,7 @@ class TrianglesDataTextureSnapDepthRenderer {
77823
77922
  src.push(" bool clippable = vFlags2 > 0u;");
77824
77923
  src.push(" if (clippable) {");
77825
77924
  src.push(" float dist = 0.0;");
77826
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
77925
+ for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
77827
77926
  src.push(" if (sectionPlaneActive" + i + ") {");
77828
77927
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
77829
77928
  src.push(" }");
@@ -77854,8 +77953,8 @@ class TrianglesDataTextureSnapDepthRenderer {
77854
77953
  const tempVec3a$d = math.vec3();
77855
77954
  const tempVec3b$9 = math.vec3();
77856
77955
  const tempVec3c$8 = math.vec3();
77857
- const tempVec3d$5 = math.vec3();
77858
- const tempVec3e = math.vec3();
77956
+ const tempVec3d$1 = math.vec3();
77957
+ math.vec3();
77859
77958
  const tempMat4a$5 = math.mat4();
77860
77959
  /**
77861
77960
  * @private
@@ -77935,7 +78034,7 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
77935
78034
  rtcOrigin[1] += position[1];
77936
78035
  rtcOrigin[2] += position[2];
77937
78036
  rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a$5);
77938
- rtcCameraEye = tempVec3d$5;
78037
+ rtcCameraEye = tempVec3d$1;
77939
78038
  rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];
77940
78039
  rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];
77941
78040
  rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];
@@ -77964,25 +78063,30 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
77964
78063
  const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2);
77965
78064
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
77966
78065
  }
78066
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
77967
78067
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
77968
- if (numSectionPlanes > 0) {
78068
+ if (numAllocatedSectionPlanes > 0) {
77969
78069
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
77970
78070
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
77971
78071
  const renderFlags = model.renderFlags;
77972
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
78072
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
77973
78073
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
77974
78074
  if (sectionPlaneUniforms) {
77975
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
77976
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
77977
- if (active) {
77978
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
77979
- if (origin) {
77980
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3e);
77981
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
77982
- } else {
77983
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
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);
77984
78087
  }
77985
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
78088
+ } else {
78089
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
77986
78090
  }
77987
78091
  }
77988
78092
  }
@@ -78068,8 +78172,7 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
78068
78172
 
78069
78173
  _buildVertexShader() {
78070
78174
  const scene = this._scene;
78071
- const sectionPlanesState = scene._sectionPlanesState;
78072
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
78175
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
78073
78176
  const src = [];
78074
78177
  src.push("#version 300 es");
78075
78178
  src.push("// TrianglesDataTextureSnapDepthBufInitRenderer vertex shader");
@@ -78231,8 +78334,7 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
78231
78334
 
78232
78335
  _buildFragmentShader() {
78233
78336
  const scene = this._scene;
78234
- const sectionPlanesState = scene._sectionPlanesState;
78235
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
78337
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
78236
78338
  const src = [];
78237
78339
  src.push('#version 300 es');
78238
78340
  src.push("// TrianglesDataTextureSnapDepthBufInitRenderer fragment shader");
@@ -78254,7 +78356,7 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
78254
78356
  src.push("flat in vec4 vPickColor;");
78255
78357
  if (clipping) {
78256
78358
  src.push("flat in uint vFlags2;");
78257
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
78359
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
78258
78360
  src.push("uniform bool sectionPlaneActive" + i + ";");
78259
78361
  src.push("uniform vec3 sectionPlanePos" + i + ";");
78260
78362
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -78269,7 +78371,7 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
78269
78371
  src.push(" bool clippable = vFlags2 > 0u;");
78270
78372
  src.push(" if (clippable) {");
78271
78373
  src.push(" float dist = 0.0;");
78272
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
78374
+ for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
78273
78375
  src.push(" if (sectionPlaneActive" + i + ") {");
78274
78376
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
78275
78377
  src.push(" }");
@@ -78309,7 +78411,7 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
78309
78411
  const tempVec3a$c = math.vec3();
78310
78412
  const tempVec3b$8 = math.vec3();
78311
78413
  const tempVec3c$7 = math.vec3();
78312
- const tempVec3d$4 = math.vec3();
78414
+ math.vec3();
78313
78415
  const tempMat4a$4 = math.mat4();
78314
78416
 
78315
78417
  /**
@@ -78399,25 +78501,30 @@ class TrianglesDataTextureOcclusionRenderer {
78399
78501
 
78400
78502
  gl.uniformMatrix4fv(this._uProjMatrix, false, camera.projMatrix);
78401
78503
 
78504
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
78402
78505
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
78403
- if (numSectionPlanes > 0) {
78506
+ if (numAllocatedSectionPlanes > 0) {
78404
78507
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
78405
78508
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
78406
78509
  const renderFlags = model.renderFlags;
78407
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
78510
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
78408
78511
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
78409
78512
  if (sectionPlaneUniforms) {
78410
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
78411
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
78412
- if (active) {
78413
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
78414
- if (origin) {
78415
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3d$4);
78416
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
78417
- } else {
78418
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
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);
78419
78525
  }
78420
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
78526
+ } else {
78527
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
78421
78528
  }
78422
78529
  }
78423
78530
  }
@@ -78468,7 +78575,7 @@ class TrianglesDataTextureOcclusionRenderer {
78468
78575
  this._uViewMatrix = program.getLocation("viewMatrix");
78469
78576
  this._uProjMatrix = program.getLocation("projMatrix");
78470
78577
  this._uSectionPlanes = [];
78471
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
78578
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
78472
78579
  this._uSectionPlanes.push({
78473
78580
  active: program.getLocation("sectionPlaneActive" + i),
78474
78581
  pos: program.getLocation("sectionPlanePos" + i),
@@ -78508,7 +78615,7 @@ class TrianglesDataTextureOcclusionRenderer {
78508
78615
 
78509
78616
  _buildVertexShader() {
78510
78617
  const scene = this._scene;
78511
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
78618
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
78512
78619
  const src = [];
78513
78620
  src.push("#version 300 es");
78514
78621
  src.push("// TrianglesDataTextureOcclusionRenderer vertex shader");
@@ -78649,7 +78756,7 @@ class TrianglesDataTextureOcclusionRenderer {
78649
78756
  _buildFragmentShader() {
78650
78757
  const scene = this._scene;
78651
78758
  const sectionPlanesState = scene._sectionPlanesState;
78652
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
78759
+ const clipping = sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
78653
78760
  const src = [];
78654
78761
  src.push('#version 300 es');
78655
78762
  src.push("// TrianglesDataTextureColorRenderer fragment shader");
@@ -78663,7 +78770,7 @@ class TrianglesDataTextureOcclusionRenderer {
78663
78770
  if (clipping) {
78664
78771
  src.push("in vec4 vWorldPosition;");
78665
78772
  src.push("flat in uint vFlags2;");
78666
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
78773
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
78667
78774
  src.push("uniform bool sectionPlaneActive" + i + ";");
78668
78775
  src.push("uniform vec3 sectionPlanePos" + i + ";");
78669
78776
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -78675,7 +78782,7 @@ class TrianglesDataTextureOcclusionRenderer {
78675
78782
  src.push(" bool clippable = (float(vFlags2) > 0.0);");
78676
78783
  src.push(" if (clippable) {");
78677
78784
  src.push(" float dist = 0.0;");
78678
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
78785
+ for (let i = 0; i < sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
78679
78786
  src.push(" if (sectionPlaneActive" + i + ") {");
78680
78787
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
78681
78788
  src.push(" }");
@@ -78703,7 +78810,7 @@ class TrianglesDataTextureOcclusionRenderer {
78703
78810
  const tempVec3a$b = math.vec3();
78704
78811
  const tempVec3b$7 = math.vec3();
78705
78812
  const tempVec3c$6 = math.vec3();
78706
- const tempVec3d$3 = math.vec3();
78813
+ math.vec3();
78707
78814
  const tempMat4a$3 = math.mat4();
78708
78815
 
78709
78816
  /**
@@ -78797,25 +78904,30 @@ class TrianglesDataTextureDepthRenderer {
78797
78904
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
78798
78905
  }
78799
78906
 
78907
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
78800
78908
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
78801
- if (numSectionPlanes > 0) {
78909
+ if (numAllocatedSectionPlanes > 0) {
78802
78910
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
78803
78911
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
78804
78912
  const renderFlags = model.renderFlags;
78805
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
78913
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
78806
78914
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
78807
78915
  if (sectionPlaneUniforms) {
78808
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
78809
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
78810
- if (active) {
78811
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
78812
- if (origin) {
78813
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3d$3);
78814
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
78815
- } else {
78816
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
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);
78817
78928
  }
78818
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
78929
+ } else {
78930
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
78819
78931
  }
78820
78932
  }
78821
78933
  }
@@ -78926,9 +79038,7 @@ class TrianglesDataTextureDepthRenderer {
78926
79038
 
78927
79039
  _buildVertexShader() {
78928
79040
  const scene = this._scene;
78929
- const sectionPlanesState = scene._sectionPlanesState;
78930
- scene._lightsState;
78931
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
79041
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
78932
79042
  const src = [];
78933
79043
  src.push("#version 300 es");
78934
79044
  src.push("// Triangles dataTexture draw vertex shader");
@@ -79089,8 +79199,7 @@ class TrianglesDataTextureDepthRenderer {
79089
79199
 
79090
79200
  _buildFragmentShader() {
79091
79201
  const scene = this._scene;
79092
- const sectionPlanesState = scene._sectionPlanesState;
79093
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
79202
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
79094
79203
  const src = [];
79095
79204
  src.push('#version 300 es');
79096
79205
  src.push("// Triangles dataTexture draw fragment shader");
@@ -79113,7 +79222,7 @@ class TrianglesDataTextureDepthRenderer {
79113
79222
  if (clipping) {
79114
79223
  src.push("in vec4 vWorldPosition;");
79115
79224
  src.push("flat in uint vFlags2;");
79116
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
79225
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
79117
79226
  src.push("uniform bool sectionPlaneActive" + i + ";");
79118
79227
  src.push("uniform vec3 sectionPlanePos" + i + ";");
79119
79228
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -79125,7 +79234,7 @@ class TrianglesDataTextureDepthRenderer {
79125
79234
  src.push(" bool clippable = vFlags2 > 0u;");
79126
79235
  src.push(" if (clippable) {");
79127
79236
  src.push(" float dist = 0.0;");
79128
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
79237
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
79129
79238
  src.push("if (sectionPlaneActive" + i + ") {");
79130
79239
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
79131
79240
  src.push("}");
@@ -79161,7 +79270,7 @@ class TrianglesDataTextureDepthRenderer {
79161
79270
  const tempVec3a$a = math.vec3();
79162
79271
  const tempVec3b$6 = math.vec3();
79163
79272
  const tempVec3c$5 = math.vec3();
79164
- const tempVec3d$2 = math.vec3();
79273
+ math.vec3();
79165
79274
  const tempMat4a$2 = math.mat4();
79166
79275
 
79167
79276
  /**
@@ -79246,25 +79355,30 @@ class TrianglesDataTextureNormalsRenderer {
79246
79355
  gl.uniformMatrix4fv(this._uViewNormalMatrix, false, camera.viewNormalMatrix);
79247
79356
  gl.uniformMatrix4fv(this._uWorldNormalMatrix, false, model.worldNormalMatrix);
79248
79357
 
79358
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
79249
79359
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
79250
- if (numSectionPlanes > 0) {
79360
+ if (numAllocatedSectionPlanes > 0) {
79251
79361
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
79252
79362
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
79253
79363
  const renderFlags = model.renderFlags;
79254
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
79364
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
79255
79365
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
79256
79366
  if (sectionPlaneUniforms) {
79257
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
79258
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
79259
- if (active) {
79260
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
79261
- if (origin) {
79262
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3d$2);
79263
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
79264
- } else {
79265
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
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);
79266
79379
  }
79267
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
79380
+ } else {
79381
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
79268
79382
  }
79269
79383
  }
79270
79384
  }
@@ -79302,7 +79416,7 @@ class TrianglesDataTextureNormalsRenderer {
79302
79416
  this._uViewNormalMatrix = program.getLocation("viewNormalMatrix");
79303
79417
  this._uProjMatrix = program.getLocation("projMatrix");
79304
79418
  this._uSectionPlanes = [];
79305
- for (let i = 0, len = scene._sectionPlanesState.sectionPlanes.length; i < len; i++) {
79419
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
79306
79420
  this._uSectionPlanes.push({
79307
79421
  active: program.getLocation("sectionPlaneActive" + i),
79308
79422
  pos: program.getLocation("sectionPlanePos" + i),
@@ -79343,7 +79457,7 @@ class TrianglesDataTextureNormalsRenderer {
79343
79457
 
79344
79458
  _buildVertexShader() {
79345
79459
  const scene = this._scene;
79346
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
79460
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
79347
79461
  const src = [];
79348
79462
  src.push("// Batched geometry normals vertex shader");
79349
79463
  if (scene.logarithmicDepthBufferEnabled && WEBGL_INFO.SUPPORTED_EXTENSIONS["EXT_frag_depth"]) {
@@ -79425,8 +79539,7 @@ class TrianglesDataTextureNormalsRenderer {
79425
79539
 
79426
79540
  _buildFragmentShader() {
79427
79541
  const scene = this._scene;
79428
- const sectionPlanesState = scene._sectionPlanesState;
79429
- const clipping = (sectionPlanesState.sectionPlanes.length > 0);
79542
+ const clipping = (scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0);
79430
79543
  const src = [];
79431
79544
  src.push("#version 300 es");
79432
79545
  src.push("// Batched geometry normals fragment shader");
@@ -79452,7 +79565,7 @@ class TrianglesDataTextureNormalsRenderer {
79452
79565
  if (clipping) {
79453
79566
  src.push("in vec4 vWorldPosition;");
79454
79567
  src.push("in vec4 vFlags2;");
79455
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
79568
+ for (let i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
79456
79569
  src.push("uniform bool sectionPlaneActive" + i + ";");
79457
79570
  src.push("uniform vec3 sectionPlanePos" + i + ";");
79458
79571
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -79467,7 +79580,7 @@ class TrianglesDataTextureNormalsRenderer {
79467
79580
  src.push(" bool clippable = (float(vFlags2.x) > 0.0);");
79468
79581
  src.push(" if (clippable) {");
79469
79582
  src.push(" float dist = 0.0;");
79470
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
79583
+ for (var i = 0; i < scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i++) {
79471
79584
  src.push(" if (sectionPlaneActive" + i + ") {");
79472
79585
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
79473
79586
  src.push(" }");
@@ -79498,7 +79611,7 @@ class TrianglesDataTextureNormalsRenderer {
79498
79611
  const tempVec3a$9 = math.vec3();
79499
79612
  const tempVec3b$5 = math.vec3();
79500
79613
  const tempVec3c$4 = math.vec3();
79501
- const tempVec3d$1 = math.vec3();
79614
+ math.vec3();
79502
79615
 
79503
79616
  math.vec4();
79504
79617
 
@@ -79596,25 +79709,30 @@ class TrianglesDataTexturePickNormalsFlatRenderer {
79596
79709
  const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2);
79597
79710
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
79598
79711
  }
79712
+ const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
79599
79713
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
79600
- if (numSectionPlanes > 0) {
79714
+ if (numAllocatedSectionPlanes > 0) {
79601
79715
  const sectionPlanes = scene._sectionPlanesState.sectionPlanes;
79602
79716
  const baseIndex = dataTextureLayer.layerIndex * numSectionPlanes;
79603
79717
  const renderFlags = model.renderFlags;
79604
- for (let sectionPlaneIndex = 0; sectionPlaneIndex < numSectionPlanes; sectionPlaneIndex++) {
79718
+ for (let sectionPlaneIndex = 0; sectionPlaneIndex < numAllocatedSectionPlanes; sectionPlaneIndex++) {
79605
79719
  const sectionPlaneUniforms = this._uSectionPlanes[sectionPlaneIndex];
79606
79720
  if (sectionPlaneUniforms) {
79607
- const active = renderFlags.sectionPlanesActivePerLayer[baseIndex + sectionPlaneIndex];
79608
- gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
79609
- if (active) {
79610
- const sectionPlane = sectionPlanes[sectionPlaneIndex];
79611
- if (origin) {
79612
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3d$1);
79613
- gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
79614
- } else {
79615
- gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
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);
79616
79733
  }
79617
- gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
79734
+ } else {
79735
+ gl.uniform1i(sectionPlaneUniforms.active, 0);
79618
79736
  }
79619
79737
  }
79620
79738
  }
@@ -79711,9 +79829,7 @@ class TrianglesDataTexturePickNormalsFlatRenderer {
79711
79829
 
79712
79830
  _buildVertexShader() {
79713
79831
  const scene = this._scene;
79714
- const sectionPlanesState = scene._sectionPlanesState;
79715
- scene._lightsState;
79716
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
79832
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
79717
79833
  const src = [];
79718
79834
  src.push("#version 300 es");
79719
79835
  src.push("// trianglesDatatextureNormalsRenderer vertex shader");
@@ -79879,8 +79995,7 @@ class TrianglesDataTexturePickNormalsFlatRenderer {
79879
79995
 
79880
79996
  _buildFragmentShader() {
79881
79997
  const scene = this._scene;
79882
- const sectionPlanesState = scene._sectionPlanesState;
79883
- const clipping = sectionPlanesState.sectionPlanes.length > 0;
79998
+ const clipping = scene._sectionPlanesState.getNumAllocatedSectionPlanes() > 0;
79884
79999
  const src = [];
79885
80000
  src.push('#version 300 es');
79886
80001
  src.push("// TrianglesDataTexturePickNormalsRenderer fragment shader");
@@ -79899,7 +80014,7 @@ class TrianglesDataTexturePickNormalsFlatRenderer {
79899
80014
  src.push("in vec4 vWorldPosition;");
79900
80015
  if (clipping) {
79901
80016
  src.push("flat in uint vFlags2;");
79902
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
80017
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
79903
80018
  src.push("uniform bool sectionPlaneActive" + i + ";");
79904
80019
  src.push("uniform vec3 sectionPlanePos" + i + ";");
79905
80020
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
@@ -79911,7 +80026,7 @@ class TrianglesDataTexturePickNormalsFlatRenderer {
79911
80026
  src.push(" bool clippable = vFlags2 > 0u;");
79912
80027
  src.push(" if (clippable) {");
79913
80028
  src.push(" float dist = 0.0;");
79914
- for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
80029
+ for (let i = 0, len = scene._sectionPlanesState.getNumAllocatedSectionPlanes(); i < len; i++) {
79915
80030
  src.push("if (sectionPlaneActive" + i + ") {");
79916
80031
  src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
79917
80032
  src.push("}");
@@ -100254,6 +100369,11 @@ class Viewer {
100254
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
100255
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)
100256
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.
100257
100377
  */
100258
100378
  constructor(cfg) {
100259
100379
 
@@ -100311,7 +100431,8 @@ class Viewer {
100311
100431
  logarithmicDepthBufferEnabled: (!!cfg.logarithmicDepthBufferEnabled),
100312
100432
  pbrEnabled: (!!cfg.pbrEnabled),
100313
100433
  colorTextureEnabled: (cfg.colorTextureEnabled !== false),
100314
- dtxEnabled: (!!cfg.dtxEnabled)
100434
+ dtxEnabled: (!!cfg.dtxEnabled),
100435
+ numPreallocatedSectionPlanes: cfg.numPreallocatedSectionPlanes
100315
100436
  });
100316
100437
 
100317
100438
  /**