@cesium/engine 16.0.0 → 18.0.0

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 (160) hide show
  1. package/Build/ThirdParty/Workers/z-worker-pako.js +1 -1
  2. package/Build/Workers/{chunk-OWLBD6BL.js → chunk-2AXPWBJG.js} +1 -1
  3. package/Build/Workers/{chunk-PB6SE3SZ.js → chunk-2CAYUY2B.js} +8 -8
  4. package/Build/Workers/{chunk-SCUQTTCN.js → chunk-2NKHPWDY.js} +12 -12
  5. package/Build/Workers/{chunk-YA4XALD5.js → chunk-2QNKQVUT.js} +5 -5
  6. package/Build/Workers/{chunk-WGIOUM2S.js → chunk-3RKVDGRF.js} +8 -8
  7. package/Build/Workers/{chunk-RWAFHSX3.js → chunk-4DSTDGY3.js} +2 -2
  8. package/Build/Workers/{chunk-YL26OJCG.js → chunk-4MIY63FM.js} +13 -13
  9. package/Build/Workers/{chunk-34EWMUFG.js → chunk-5OL6XFNS.js} +1 -1
  10. package/Build/Workers/{chunk-B75OO2DU.js → chunk-5WVF4BK7.js} +5 -5
  11. package/Build/Workers/{chunk-EAWYQ44R.js → chunk-AEGAQ6FD.js} +12 -12
  12. package/Build/Workers/{chunk-4LHK6E47.js → chunk-CES6DHHV.js} +1 -1
  13. package/Build/Workers/{chunk-S3IQBSIB.js → chunk-DINSLSJD.js} +6 -6
  14. package/Build/Workers/{chunk-KV6TEHXY.js → chunk-EHB2OCQX.js} +4 -4
  15. package/Build/Workers/{chunk-NREPBWCX.js → chunk-EXEZHW3P.js} +4 -4
  16. package/Build/Workers/{chunk-ICU72UPR.js → chunk-F4ZAKN4V.js} +2 -2
  17. package/Build/Workers/{chunk-S2NKKWYE.js → chunk-FPYBD2P5.js} +1 -1
  18. package/Build/Workers/{chunk-KKV6XBF5.js → chunk-GAUF4F5A.js} +16 -16
  19. package/Build/Workers/{chunk-ERKJ7IWJ.js → chunk-GM55YFOB.js} +14 -14
  20. package/Build/Workers/{chunk-NB6D74SQ.js → chunk-GS55WTRX.js} +6 -6
  21. package/Build/Workers/{chunk-5TN3LG2T.js → chunk-HQE7KSR4.js} +2 -2
  22. package/Build/Workers/{chunk-EO44CO62.js → chunk-HS76VTVY.js} +2 -2
  23. package/Build/Workers/{chunk-TL5YKZJF.js → chunk-I3BAKR4S.js} +16 -16
  24. package/Build/Workers/{chunk-OMFZ4IN6.js → chunk-IWGMVQGG.js} +9 -9
  25. package/Build/Workers/{chunk-VVTAI2TN.js → chunk-IWZK2AIH.js} +5 -5
  26. package/Build/Workers/{chunk-GQVSADCI.js → chunk-J4MAVE6J.js} +6 -6
  27. package/Build/Workers/{chunk-XF6EBVKV.js → chunk-JF4IYQYC.js} +7 -7
  28. package/Build/Workers/{chunk-CUJH7PS5.js → chunk-KGXTCGX3.js} +12 -12
  29. package/Build/Workers/{chunk-TBSA4MNF.js → chunk-KNA65INJ.js} +4 -4
  30. package/Build/Workers/{chunk-EOIUWEAK.js → chunk-LIPZUYNR.js} +11 -11
  31. package/Build/Workers/{chunk-TEUGW455.js → chunk-LWJWWCZ4.js} +6 -6
  32. package/Build/Workers/{chunk-ORIMMEHO.js → chunk-LZFUG3GO.js} +10 -10
  33. package/Build/Workers/{chunk-COOLDICB.js → chunk-MFGVMUN3.js} +5 -5
  34. package/Build/Workers/{chunk-FW2OX42E.js → chunk-NR7KSD56.js} +3 -3
  35. package/Build/Workers/{chunk-2TQ64T4I.js → chunk-NVJ5JRIM.js} +2 -2
  36. package/Build/Workers/{chunk-OMZGZVHI.js → chunk-NWSAYFZG.js} +6 -6
  37. package/Build/Workers/{chunk-PT6U7UNY.js → chunk-OATG6PKE.js} +12 -12
  38. package/Build/Workers/{chunk-M5J3S3HY.js → chunk-OIHAAHBK.js} +10 -10
  39. package/Build/Workers/{chunk-LCSH4ZOB.js → chunk-QN7JEOQV.js} +5 -5
  40. package/Build/Workers/{chunk-XMKE4XB2.js → chunk-QUSP3NWA.js} +5 -5
  41. package/Build/Workers/{chunk-ZLJDDRGB.js → chunk-RWFYLWSF.js} +9 -9
  42. package/Build/Workers/{chunk-OD4Q7HE5.js → chunk-SIOVJ4L5.js} +4 -4
  43. package/Build/Workers/{chunk-EJJDBH5W.js → chunk-T6B6H3GR.js} +7 -7
  44. package/Build/Workers/{chunk-YFXXUW6U.js → chunk-UK33ZN4K.js} +4 -4
  45. package/Build/Workers/{chunk-V4Y7C25O.js → chunk-VGJSKEIB.js} +4 -4
  46. package/Build/Workers/{chunk-VXAAIRJ7.js → chunk-W6CPO62M.js} +6 -6
  47. package/Build/Workers/{chunk-ILVAXLMC.js → chunk-WGHUCZMX.js} +7 -7
  48. package/Build/Workers/{chunk-GH6I7PBY.js → chunk-WTFZHPUW.js} +5 -5
  49. package/Build/Workers/{chunk-VNDECE6N.js → chunk-WYCR5DWQ.js} +2 -2
  50. package/Build/Workers/{chunk-6B7KGA5P.js → chunk-YV37YFUM.js} +9 -9
  51. package/Build/Workers/{chunk-CQNYYX3N.js → chunk-ZADJ6FRX.js} +4 -4
  52. package/Build/Workers/{chunk-ESED7XBA.js → chunk-ZIP27IX6.js} +6 -6
  53. package/Build/Workers/combineGeometry.js +21 -21
  54. package/Build/Workers/createBoxGeometry.js +15 -15
  55. package/Build/Workers/createBoxOutlineGeometry.js +13 -13
  56. package/Build/Workers/createCircleGeometry.js +23 -23
  57. package/Build/Workers/createCircleOutlineGeometry.js +16 -16
  58. package/Build/Workers/createCoplanarPolygonGeometry.js +30 -30
  59. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +28 -28
  60. package/Build/Workers/createCorridorGeometry.js +26 -26
  61. package/Build/Workers/createCorridorOutlineGeometry.js +25 -25
  62. package/Build/Workers/createCylinderGeometry.js +17 -17
  63. package/Build/Workers/createCylinderOutlineGeometry.js +15 -15
  64. package/Build/Workers/createEllipseGeometry.js +23 -23
  65. package/Build/Workers/createEllipseOutlineGeometry.js +16 -16
  66. package/Build/Workers/createEllipsoidGeometry.js +16 -16
  67. package/Build/Workers/createEllipsoidOutlineGeometry.js +15 -15
  68. package/Build/Workers/createFrustumGeometry.js +15 -15
  69. package/Build/Workers/createFrustumOutlineGeometry.js +15 -15
  70. package/Build/Workers/createGeometry.js +21 -21
  71. package/Build/Workers/createGroundPolylineGeometry.js +19 -19
  72. package/Build/Workers/createPlaneGeometry.js +13 -13
  73. package/Build/Workers/createPlaneOutlineGeometry.js +12 -12
  74. package/Build/Workers/createPolygonGeometry.js +29 -29
  75. package/Build/Workers/createPolygonOutlineGeometry.js +27 -27
  76. package/Build/Workers/createPolylineGeometry.js +22 -22
  77. package/Build/Workers/createPolylineVolumeGeometry.js +28 -28
  78. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +24 -24
  79. package/Build/Workers/createRectangleGeometry.js +24 -24
  80. package/Build/Workers/createRectangleOutlineGeometry.js +17 -17
  81. package/Build/Workers/createSimplePolylineGeometry.js +20 -20
  82. package/Build/Workers/createSphereGeometry.js +16 -16
  83. package/Build/Workers/createSphereOutlineGeometry.js +15 -15
  84. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  85. package/Build/Workers/createVectorTileClampedPolylines.js +12 -12
  86. package/Build/Workers/createVectorTileGeometries.js +21 -21
  87. package/Build/Workers/createVectorTilePoints.js +11 -11
  88. package/Build/Workers/createVectorTilePolygons.js +19 -19
  89. package/Build/Workers/createVectorTilePolylines.js +12 -12
  90. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +19 -19
  91. package/Build/Workers/createVerticesFromHeightmap.js +19 -19
  92. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +16 -16
  93. package/Build/Workers/createWallGeometry.js +21 -21
  94. package/Build/Workers/createWallOutlineGeometry.js +20 -20
  95. package/Build/Workers/decodeDraco.js +10 -10
  96. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  97. package/Build/Workers/decodeI3S.js +9 -9
  98. package/Build/Workers/transcodeKTX2.js +25 -6
  99. package/Build/Workers/transferTypedArrayTest.js +1 -1
  100. package/Build/Workers/upsampleQuantizedTerrainMesh.js +19 -19
  101. package/Source/Core/Check.d.ts +4 -1
  102. package/Source/Core/ITwinPlatform.js +6 -3
  103. package/Source/Core/Ion.js +1 -1
  104. package/Source/Core/PixelFormat.js +36 -0
  105. package/Source/Core/PolygonGeometry.js +1 -0
  106. package/Source/Core/RectangleOutlineGeometry.js +1 -1
  107. package/Source/Renderer/Texture3D.js +568 -0
  108. package/Source/Renderer/createUniform.js +1 -0
  109. package/Source/Renderer/createUniformArray.js +1 -0
  110. package/Source/Scene/ArcGisMapService.js +1 -1
  111. package/Source/Scene/Cesium3DTilesVoxelProvider.js +18 -23
  112. package/Source/Scene/Cesium3DTileset.js +138 -0
  113. package/Source/Scene/GlobeSurfaceShaderSet.js +4 -5
  114. package/Source/Scene/ImageryLayer.js +21 -6
  115. package/Source/Scene/ImageryLayerCollection.js +3 -2
  116. package/Source/Scene/Model/CartesianRectangle.js +108 -0
  117. package/Source/Scene/Model/ImageryConfiguration.js +25 -0
  118. package/Source/Scene/Model/ImageryCoverage.js +488 -0
  119. package/Source/Scene/Model/ImageryFlags.js +31 -0
  120. package/Source/Scene/Model/ImageryInput.js +60 -0
  121. package/Source/Scene/Model/ImageryPipelineStage.js +1040 -0
  122. package/Source/Scene/Model/MappedPositions.js +84 -0
  123. package/Source/Scene/Model/Model.js +38 -0
  124. package/Source/Scene/Model/ModelImagery.js +403 -0
  125. package/Source/Scene/Model/ModelImageryMapping.js +489 -0
  126. package/Source/Scene/Model/ModelPrimitiveImagery.js +972 -0
  127. package/Source/Scene/Model/ModelReader.js +810 -0
  128. package/Source/Scene/Model/ModelRenderResources.js +13 -0
  129. package/Source/Scene/Model/ModelRuntimePrimitive.js +19 -0
  130. package/Source/Scene/Model/ModelSceneGraph.js +133 -27
  131. package/Source/Scene/Model/NodeRenderResources.js +10 -0
  132. package/Source/Scene/ModelComponents.js +10 -0
  133. package/Source/Scene/QuadtreePrimitive.js +5 -1
  134. package/Source/Scene/VoxelBoxShape.js +38 -81
  135. package/Source/Scene/VoxelCylinderShape.js +128 -262
  136. package/Source/Scene/VoxelPrimitive.js +24 -39
  137. package/Source/Scene/VoxelRenderResources.js +1 -1
  138. package/Source/Scene/processVoxelProperties.js +41 -100
  139. package/Source/Shaders/Builtin/Functions/windowToEyeCoordinates.glsl +0 -1
  140. package/Source/Shaders/Builtin/Functions/windowToEyeCoordinates.js +0 -1
  141. package/Source/Shaders/GlobeFS.glsl +22 -0
  142. package/Source/Shaders/GlobeFS.js +22 -0
  143. package/Source/Shaders/Model/MaterialStageFS.glsl +4 -0
  144. package/Source/Shaders/Model/MaterialStageFS.js +4 -0
  145. package/Source/Shaders/Model/ModelVS.glsl +4 -0
  146. package/Source/Shaders/Model/ModelVS.js +4 -0
  147. package/Source/Shaders/PolylineCommon.glsl +1 -1
  148. package/Source/Shaders/PolylineCommon.js +1 -1
  149. package/Source/Shaders/Voxels/IntersectDepth.glsl +10 -3
  150. package/Source/Shaders/Voxels/IntersectDepth.js +10 -3
  151. package/Source/Shaders/Voxels/Intersection.glsl +1 -3
  152. package/Source/Shaders/Voxels/Intersection.js +1 -3
  153. package/Source/Shaders/Voxels/IntersectionUtils.glsl +1 -0
  154. package/Source/Shaders/Voxels/IntersectionUtils.js +1 -0
  155. package/Source/Shaders/Voxels/VoxelFS.glsl +37 -24
  156. package/Source/Shaders/Voxels/VoxelFS.js +37 -24
  157. package/Source/ThirdParty/Workers/z-worker-pako.js +1 -1
  158. package/index.d.ts +59 -7
  159. package/index.js +74 -62
  160. package/package.json +3 -3
@@ -1,12 +1,12 @@
1
1
  import BoundingSphere from "../Core/BoundingSphere.js";
2
2
  import Cartesian2 from "../Core/Cartesian2.js";
3
3
  import Cartesian3 from "../Core/Cartesian3.js";
4
- import Check from "../Core/Check.js";
4
+ import Cartesian4 from "../Core/Cartesian4.js";
5
5
  import CesiumMath from "../Core/Math.js";
6
+ import Check from "../Core/Check.js";
6
7
  import Matrix3 from "../Core/Matrix3.js";
7
8
  import Matrix4 from "../Core/Matrix4.js";
8
9
  import OrientedBoundingBox from "../Core/OrientedBoundingBox.js";
9
- import Cartesian4 from "../Core/Cartesian4.js";
10
10
 
11
11
  /**
12
12
  * A cylinder {@link VoxelShape}.
@@ -59,40 +59,18 @@ function VoxelCylinderShape() {
59
59
  this.shapeTransform = new Matrix4();
60
60
 
61
61
  /**
62
- * @type {number}
63
- * @private
64
- */
65
- this._minimumRadius = VoxelCylinderShape.DefaultMinBounds.x;
66
-
67
- /**
68
- * @type {number}
69
- * @private
70
- */
71
- this._maximumRadius = VoxelCylinderShape.DefaultMaxBounds.x;
72
-
73
- /**
74
- * @type {number}
75
- * @private
76
- */
77
- this._minimumAngle = VoxelCylinderShape.DefaultMinBounds.y;
78
-
79
- /**
80
- * @type {number}
81
- * @private
82
- */
83
- this._maximumAngle = VoxelCylinderShape.DefaultMaxBounds.y;
84
-
85
- /**
86
- * @type {number}
62
+ * The minimum bounds of the shape, corresponding to minimum radius, angle, and height.
63
+ * @type {Cartesian3}
87
64
  * @private
88
65
  */
89
- this._minimumHeight = VoxelCylinderShape.DefaultMinBounds.z;
66
+ this._minBounds = VoxelCylinderShape.DefaultMinBounds.clone();
90
67
 
91
68
  /**
92
- * @type {number}
69
+ * The maximum bounds of the shape, corresponding to maximum radius, angle, and height.
70
+ * @type {Cartesian3}
93
71
  * @private
94
72
  */
95
- this._maximumHeight = VoxelCylinderShape.DefaultMaxBounds.z;
73
+ this._maxBounds = VoxelCylinderShape.DefaultMaxBounds.clone();
96
74
 
97
75
  /**
98
76
  * @private
@@ -145,6 +123,10 @@ function VoxelCylinderShape() {
145
123
  }
146
124
 
147
125
  const scratchScale = new Cartesian3();
126
+ const scratchClipMinBounds = new Cartesian3();
127
+ const scratchClipMaxBounds = new Cartesian3();
128
+ const scratchRenderMinBounds = new Cartesian3();
129
+ const scratchRenderMaxBounds = new Cartesian3();
148
130
 
149
131
  /**
150
132
  * Update the shape's state.
@@ -152,8 +134,8 @@ const scratchScale = new Cartesian3();
152
134
  * @param {Matrix4} modelMatrix The model matrix.
153
135
  * @param {Cartesian3} minBounds The minimum bounds.
154
136
  * @param {Cartesian3} maxBounds The maximum bounds.
155
- * @param {Cartesian3} [clipMinBounds=VoxelCylinderShape.DefaultMinBounds] The minimum clip bounds.
156
- * @param {Cartesian3} [clipMaxBounds=VoxelCylinderShape.DefaultMaxBounds] The maximum clip bounds.
137
+ * @param {Cartesian3} [clipMinBounds] The minimum clip bounds.
138
+ * @param {Cartesian3} [clipMaxBounds] The maximum clip bounds.
157
139
  * @returns {boolean} Whether the shape is visible.
158
140
  */
159
141
  VoxelCylinderShape.prototype.update = function (
@@ -163,84 +145,45 @@ VoxelCylinderShape.prototype.update = function (
163
145
  clipMinBounds,
164
146
  clipMaxBounds,
165
147
  ) {
166
- clipMinBounds = clipMinBounds ?? VoxelCylinderShape.DefaultMinBounds;
167
- clipMaxBounds = clipMaxBounds ?? VoxelCylinderShape.DefaultMaxBounds;
168
148
  //>>includeStart('debug', pragmas.debug);
169
149
  Check.typeOf.object("modelMatrix", modelMatrix);
170
150
  Check.typeOf.object("minBounds", minBounds);
171
151
  Check.typeOf.object("maxBounds", maxBounds);
172
152
  //>>includeEnd('debug');
173
153
 
174
- const defaultMinRadius = VoxelCylinderShape.DefaultMinBounds.x;
175
- const defaultMaxRadius = VoxelCylinderShape.DefaultMaxBounds.x;
176
- const defaultMinAngle = VoxelCylinderShape.DefaultMinBounds.y;
177
- const defaultMaxAngle = VoxelCylinderShape.DefaultMaxBounds.y;
178
- const defaultMinHeight = VoxelCylinderShape.DefaultMinBounds.z;
179
- const defaultMaxHeight = VoxelCylinderShape.DefaultMaxBounds.z;
180
- const defaultAngleRange = defaultMaxAngle - defaultMinAngle;
154
+ clipMinBounds = clipMinBounds ?? minBounds.clone(scratchClipMinBounds);
155
+ clipMaxBounds = clipMaxBounds ?? maxBounds.clone(scratchClipMaxBounds);
156
+
157
+ minBounds = Cartesian3.clone(minBounds, this._minBounds);
158
+ maxBounds = Cartesian3.clone(maxBounds, this._maxBounds);
159
+
160
+ const { DefaultMinBounds, DefaultMaxBounds } = VoxelCylinderShape;
161
+ const defaultAngleRange = DefaultMaxBounds.y - DefaultMinBounds.y;
181
162
  const defaultAngleRangeHalf = 0.5 * defaultAngleRange;
182
163
 
183
164
  const epsilonZeroScale = CesiumMath.EPSILON10;
184
165
  const epsilonAngleDiscontinuity = CesiumMath.EPSILON3; // 0.001 radians = 0.05729578 degrees
185
166
  const epsilonAngle = CesiumMath.EPSILON10;
186
167
 
187
- // Clamp the radii to the valid range
188
- const shapeMinRadius = CesiumMath.clamp(
189
- minBounds.x,
190
- defaultMinRadius,
191
- defaultMaxRadius,
192
- );
193
- const shapeMaxRadius = CesiumMath.clamp(
194
- maxBounds.x,
195
- defaultMinRadius,
196
- defaultMaxRadius,
197
- );
198
- const clipMinRadius = CesiumMath.clamp(
199
- clipMinBounds.x,
200
- defaultMinRadius,
201
- defaultMaxRadius,
202
- );
203
- const clipMaxRadius = CesiumMath.clamp(
204
- clipMaxBounds.x,
205
- defaultMinRadius,
206
- defaultMaxRadius,
207
- );
208
- const renderMinRadius = Math.max(shapeMinRadius, clipMinRadius);
209
- const renderMaxRadius = Math.min(shapeMaxRadius, clipMaxRadius);
210
-
211
- // Clamp the angles to the valid range
212
- const shapeMinAngle = CesiumMath.negativePiToPi(minBounds.y);
213
- const shapeMaxAngle = CesiumMath.negativePiToPi(maxBounds.y);
214
- const clipMinAngle = CesiumMath.negativePiToPi(clipMinBounds.y);
215
- const clipMaxAngle = CesiumMath.negativePiToPi(clipMaxBounds.y);
216
- const renderMinAngle = Math.max(shapeMinAngle, clipMinAngle);
217
- const renderMaxAngle = Math.min(shapeMaxAngle, clipMaxAngle);
218
-
219
- // Clamp the heights to the valid range
220
- const shapeMinHeight = CesiumMath.clamp(
221
- minBounds.z,
222
- defaultMinHeight,
223
- defaultMaxHeight,
224
- );
225
- const shapeMaxHeight = CesiumMath.clamp(
226
- maxBounds.z,
227
- defaultMinHeight,
228
- defaultMaxHeight,
229
- );
230
- const clipMinHeight = CesiumMath.clamp(
231
- clipMinBounds.z,
232
- defaultMinHeight,
233
- defaultMaxHeight,
168
+ // Clamp the bounds to the valid range
169
+ minBounds.x = Math.max(0.0, minBounds.x);
170
+ maxBounds.x = Math.max(0.0, maxBounds.x);
171
+ minBounds.y = CesiumMath.negativePiToPi(minBounds.y);
172
+ maxBounds.y = CesiumMath.negativePiToPi(maxBounds.y);
173
+
174
+ clipMinBounds.y = CesiumMath.negativePiToPi(clipMinBounds.y);
175
+ clipMaxBounds.y = CesiumMath.negativePiToPi(clipMaxBounds.y);
176
+
177
+ const renderMinBounds = Cartesian3.maximumByComponent(
178
+ minBounds,
179
+ clipMinBounds,
180
+ scratchRenderMinBounds,
234
181
  );
235
- const clipMaxHeight = CesiumMath.clamp(
236
- clipMaxBounds.z,
237
- defaultMinHeight,
238
- defaultMaxHeight,
182
+ const renderMaxBounds = Cartesian3.minimumByComponent(
183
+ maxBounds,
184
+ clipMaxBounds,
185
+ scratchRenderMaxBounds,
239
186
  );
240
- const renderMinHeight = Math.max(shapeMinHeight, clipMinHeight);
241
- const renderMaxHeight = Math.min(shapeMaxHeight, clipMaxHeight);
242
-
243
- const scale = Matrix4.getScale(modelMatrix, scratchScale);
244
187
 
245
188
  // Exit early if the shape is not visible.
246
189
  // Note that minAngle may be greater than maxAngle when crossing the 180th meridian.
@@ -250,10 +193,11 @@ VoxelCylinderShape.prototype.update = function (
250
193
  // - minRadius is greater than maxRadius
251
194
  // - minHeight is greater than maxHeight
252
195
  // - scale is 0 for any component (too annoying to reconstruct rotation matrix)
196
+ const scale = Matrix4.getScale(modelMatrix, scratchScale);
253
197
  if (
254
- renderMaxRadius === 0.0 ||
255
- renderMinRadius > renderMaxRadius ||
256
- renderMinHeight > renderMaxHeight ||
198
+ renderMaxBounds.x === 0.0 ||
199
+ renderMinBounds.x > renderMaxBounds.x ||
200
+ renderMinBounds.z > renderMaxBounds.z ||
257
201
  CesiumMath.equalsEpsilon(scale.x, 0.0, undefined, epsilonZeroScale) ||
258
202
  CesiumMath.equalsEpsilon(scale.y, 0.0, undefined, epsilonZeroScale) ||
259
203
  CesiumMath.equalsEpsilon(scale.z, 0.0, undefined, epsilonZeroScale)
@@ -261,22 +205,11 @@ VoxelCylinderShape.prototype.update = function (
261
205
  return false;
262
206
  }
263
207
 
264
- this._minimumRadius = shapeMinRadius; // [0,1]
265
- this._maximumRadius = shapeMaxRadius; // [0,1]
266
- this._minimumAngle = shapeMinAngle; // [-pi,+pi]
267
- this._maximumAngle = shapeMaxAngle; // [-pi,+pi]
268
- this._minimumHeight = shapeMinHeight; // [-1,+1]
269
- this._maximumHeight = shapeMaxHeight; // [-1,+1]
270
-
271
208
  this.shapeTransform = Matrix4.clone(modelMatrix, this.shapeTransform);
272
209
 
273
210
  this.orientedBoundingBox = getCylinderChunkObb(
274
- renderMinRadius,
275
- renderMaxRadius,
276
- renderMinAngle,
277
- renderMaxAngle,
278
- renderMinHeight,
279
- renderMaxHeight,
211
+ renderMinBounds,
212
+ renderMaxBounds,
280
213
  this.shapeTransform,
281
214
  this.orientedBoundingBox,
282
215
  );
@@ -292,13 +225,11 @@ VoxelCylinderShape.prototype.update = function (
292
225
  this.boundingSphere,
293
226
  );
294
227
 
295
- const shapeIsDefaultMaxRadius = shapeMaxRadius === defaultMaxRadius;
296
- const shapeIsDefaultMinRadius = shapeMinRadius === defaultMinRadius;
297
228
  const shapeIsDefaultRadius =
298
- shapeIsDefaultMinRadius && shapeIsDefaultMaxRadius;
299
- const shapeIsAngleReversed = shapeMaxAngle < shapeMinAngle;
229
+ minBounds.x === DefaultMinBounds.x && maxBounds.x === DefaultMaxBounds.x;
230
+ const shapeIsAngleReversed = maxBounds.y < minBounds.y;
300
231
  const shapeAngleRange =
301
- shapeMaxAngle - shapeMinAngle + shapeIsAngleReversed * defaultAngleRange;
232
+ maxBounds.y - minBounds.y + shapeIsAngleReversed * defaultAngleRange;
302
233
  const shapeIsAngleRegular =
303
234
  shapeAngleRange > defaultAngleRangeHalf + epsilonAngle &&
304
235
  shapeAngleRange < defaultAngleRange - epsilonAngle;
@@ -310,24 +241,26 @@ VoxelCylinderShape.prototype.update = function (
310
241
  const shapeHasAngle =
311
242
  shapeIsAngleRegular || shapeIsAngleFlipped || shapeIsAngleRangeHalf;
312
243
  const shapeIsMinAngleDiscontinuity = CesiumMath.equalsEpsilon(
313
- shapeMinAngle,
314
- defaultMinAngle,
244
+ minBounds.y,
245
+ DefaultMinBounds.y,
315
246
  undefined,
316
247
  epsilonAngleDiscontinuity,
317
248
  );
318
249
  const shapeIsMaxAngleDiscontinuity = CesiumMath.equalsEpsilon(
319
- shapeMaxAngle,
320
- defaultMaxAngle,
250
+ maxBounds.y,
251
+ DefaultMaxBounds.y,
321
252
  undefined,
322
253
  epsilonAngleDiscontinuity,
323
254
  );
324
255
  const shapeIsDefaultHeight =
325
- shapeMinHeight === defaultMinHeight && shapeMaxHeight === defaultMaxHeight;
256
+ minBounds.z === DefaultMinBounds.z && maxBounds.z === DefaultMaxBounds.z;
326
257
 
327
- const renderIsDefaultMinRadius = renderMinRadius === defaultMinRadius;
328
- const renderIsAngleReversed = renderMaxAngle < renderMinAngle;
258
+ const renderIsDefaultMinRadius = renderMinBounds.x === DefaultMinBounds.x;
259
+ const renderIsAngleReversed = renderMaxBounds.y < renderMinBounds.y;
329
260
  const renderAngleRange =
330
- renderMaxAngle - renderMinAngle + renderIsAngleReversed * defaultAngleRange;
261
+ renderMaxBounds.y -
262
+ renderMinBounds.y +
263
+ renderIsAngleReversed * defaultAngleRange;
331
264
  const renderIsAngleRegular =
332
265
  renderAngleRange >= defaultAngleRangeHalf - epsilonAngle &&
333
266
  renderAngleRange < defaultAngleRange - epsilonAngle;
@@ -359,12 +292,12 @@ VoxelCylinderShape.prototype.update = function (
359
292
  intersectionCount += 1;
360
293
  }
361
294
  shaderUniforms.cylinderRenderRadiusMinMax = Cartesian2.fromElements(
362
- renderMinRadius,
363
- renderMaxRadius,
295
+ renderMinBounds.x,
296
+ renderMaxBounds.x,
364
297
  shaderUniforms.cylinderRenderRadiusMinMax,
365
298
  );
366
299
 
367
- if (renderMinRadius === renderMaxRadius) {
300
+ if (renderMinBounds.x === renderMaxBounds.x) {
368
301
  shaderDefines["CYLINDER_HAS_RENDER_BOUNDS_RADIUS_FLAT"] = true;
369
302
  }
370
303
  if (!shapeIsDefaultRadius) {
@@ -376,12 +309,12 @@ VoxelCylinderShape.prototype.update = function (
376
309
  // scale = 1.0 / (maxRadius - minRadius)
377
310
  // offset = -minRadius / (maxRadius - minRadius)
378
311
  // offset = minRadius / (minRadius - maxRadius)
379
- const radiusRange = shapeMaxRadius - shapeMinRadius;
312
+ const radiusRange = maxBounds.x - minBounds.x;
380
313
  let scale = 0.0;
381
314
  let offset = 1.0;
382
315
  if (radiusRange !== 0.0) {
383
316
  scale = 1.0 / radiusRange;
384
- offset = -shapeMinRadius / radiusRange;
317
+ offset = -minBounds.x / radiusRange;
385
318
  }
386
319
  shaderUniforms.cylinderUvToShapeUvRadius = Cartesian2.fromElements(
387
320
  scale,
@@ -404,12 +337,12 @@ VoxelCylinderShape.prototype.update = function (
404
337
  // offset = -2.0 * (minHeight * 0.5 + 0.5) / (maxHeight - minHeight)
405
338
  // offset = -(minHeight + 1.0) / (maxHeight - minHeight)
406
339
  // offset = (minHeight + 1.0) / (minHeight - maxHeight)
407
- const heightRange = shapeMaxHeight - shapeMinHeight;
340
+ const heightRange = maxBounds.z - minBounds.z;
408
341
  let scale = 0.0;
409
342
  let offset = 1.0;
410
343
  if (heightRange !== 0.0) {
411
344
  scale = 2.0 / heightRange;
412
- offset = -(shapeMinHeight + 1.0) / heightRange;
345
+ offset = -(minBounds.z + 1.0) / heightRange;
413
346
  }
414
347
  shaderUniforms.cylinderUvToShapeUvHeight = Cartesian2.fromElements(
415
348
  scale,
@@ -418,8 +351,8 @@ VoxelCylinderShape.prototype.update = function (
418
351
  );
419
352
  }
420
353
  shaderUniforms.cylinderRenderHeightMinMax = Cartesian2.fromElements(
421
- renderMinHeight,
422
- renderMaxHeight,
354
+ renderMinBounds.z,
355
+ renderMaxBounds.z,
423
356
  shaderUniforms.cylinderRenderHeightMinMax,
424
357
  );
425
358
 
@@ -443,8 +376,8 @@ VoxelCylinderShape.prototype.update = function (
443
376
  }
444
377
 
445
378
  shaderUniforms.cylinderRenderAngleMinMax = Cartesian2.fromElements(
446
- renderMinAngle,
447
- renderMaxAngle,
379
+ renderMinBounds.y,
380
+ renderMaxBounds.y,
448
381
  shaderUniforms.cylinderRenderAngleMinMax,
449
382
  );
450
383
  }
@@ -458,8 +391,8 @@ VoxelCylinderShape.prototype.update = function (
458
391
  shaderDefines["CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MAX_DISCONTINUITY"] = true;
459
392
  }
460
393
 
461
- const uvMinAngle = (shapeMinAngle - defaultMinAngle) / defaultAngleRange;
462
- const uvMaxAngle = (shapeMaxAngle - defaultMinAngle) / defaultAngleRange;
394
+ const uvMinAngle = (minBounds.y - DefaultMinBounds.y) / defaultAngleRange;
395
+ const uvMaxAngle = (maxBounds.y - DefaultMinBounds.y) / defaultAngleRange;
463
396
  const uvAngleRangeZero = 1.0 - shapeAngleRange / defaultAngleRange;
464
397
 
465
398
  shaderUniforms.cylinderShapeUvAngleMinMax = Cartesian2.fromElements(
@@ -487,7 +420,7 @@ VoxelCylinderShape.prototype.update = function (
487
420
  );
488
421
  } else {
489
422
  const scale = defaultAngleRange / shapeAngleRange;
490
- const offset = -(shapeMinAngle - defaultMinAngle) / shapeAngleRange;
423
+ const offset = -(minBounds.y - DefaultMinBounds.y) / shapeAngleRange;
491
424
  shaderUniforms.cylinderUvToShapeUvAngle = Cartesian2.fromElements(
492
425
  scale,
493
426
  offset,
@@ -501,6 +434,9 @@ VoxelCylinderShape.prototype.update = function (
501
434
  return true;
502
435
  };
503
436
 
437
+ const scratchMinBounds = new Cartesian3();
438
+ const scratchMaxBounds = new Cartesian3();
439
+
504
440
  /**
505
441
  * Computes an oriented bounding box for a specified tile.
506
442
  * The update function must be called before calling this function.
@@ -527,61 +463,33 @@ VoxelCylinderShape.prototype.computeOrientedBoundingBoxForTile = function (
527
463
  Check.typeOf.object("result", result);
528
464
  //>>includeEnd('debug');
529
465
 
530
- const minimumRadius = this._minimumRadius;
531
- const maximumRadius = this._maximumRadius;
532
- const minimumAngle = this._minimumAngle;
533
- const maximumAngle = this._maximumAngle;
534
- const minimumHeight = this._minimumHeight;
535
- const maximumHeight = this._maximumHeight;
466
+ const minBounds = this._minBounds;
467
+ const maxBounds = this._maxBounds;
536
468
 
537
469
  const sizeAtLevel = 1.0 / Math.pow(2.0, tileLevel);
538
470
 
539
- const radiusStart = CesiumMath.lerp(
540
- minimumRadius,
541
- maximumRadius,
542
- tileX * sizeAtLevel,
543
- );
544
- const radiusEnd = CesiumMath.lerp(
545
- minimumRadius,
546
- maximumRadius,
547
- (tileX + 1) * sizeAtLevel,
471
+ const tileMinBounds = Cartesian3.fromElements(
472
+ CesiumMath.lerp(minBounds.x, maxBounds.x, tileX * sizeAtLevel),
473
+ CesiumMath.lerp(minBounds.y, maxBounds.y, tileY * sizeAtLevel),
474
+ CesiumMath.lerp(minBounds.z, maxBounds.z, tileZ * sizeAtLevel),
475
+ scratchMinBounds,
548
476
  );
549
- const angleStart = CesiumMath.lerp(
550
- minimumAngle,
551
- maximumAngle,
552
- tileY * sizeAtLevel,
553
- );
554
- const angleEnd = CesiumMath.lerp(
555
- minimumAngle,
556
- maximumAngle,
557
- (tileY + 1) * sizeAtLevel,
558
- );
559
- const heightStart = CesiumMath.lerp(
560
- minimumHeight,
561
- maximumHeight,
562
- tileZ * sizeAtLevel,
563
- );
564
- const heightEnd = CesiumMath.lerp(
565
- minimumHeight,
566
- maximumHeight,
567
- (tileZ + 1) * sizeAtLevel,
477
+ const tileMaxBounds = Cartesian3.fromElements(
478
+ CesiumMath.lerp(minBounds.x, maxBounds.x, (tileX + 1) * sizeAtLevel),
479
+ CesiumMath.lerp(minBounds.y, maxBounds.y, (tileY + 1) * sizeAtLevel),
480
+ CesiumMath.lerp(minBounds.z, maxBounds.z, (tileZ + 1) * sizeAtLevel),
481
+ scratchMaxBounds,
568
482
  );
569
483
 
570
484
  return getCylinderChunkObb(
571
- radiusStart,
572
- radiusEnd,
573
- angleStart,
574
- angleEnd,
575
- heightStart,
576
- heightEnd,
485
+ tileMinBounds,
486
+ tileMaxBounds,
577
487
  this.shapeTransform,
578
488
  result,
579
489
  );
580
490
  };
581
491
 
582
492
  const sampleSizeScratch = new Cartesian3();
583
- const scratchTileMinBounds = new Cartesian3();
584
- const scratchTileMaxBounds = new Cartesian3();
585
493
 
586
494
  /**
587
495
  * Computes an oriented bounding box for a specified sample within a specified tile.
@@ -623,38 +531,32 @@ VoxelCylinderShape.prototype.computeOrientedBoundingBoxForSample = function (
623
531
  spatialNode.x + tileUv.x,
624
532
  spatialNode.y + tileUv.y,
625
533
  spatialNode.z + tileUv.z,
626
- scratchTileMinBounds,
534
+ scratchMinBounds,
627
535
  ),
628
536
  tileSizeAtLevel,
629
- scratchTileMinBounds,
630
- );
631
- const maxLerp = Cartesian3.add(
632
- minLerp,
633
- sampleSizeAtLevel,
634
- scratchTileMaxBounds,
537
+ scratchMinBounds,
635
538
  );
539
+ const maxLerp = Cartesian3.add(minLerp, sampleSizeAtLevel, scratchMaxBounds);
636
540
 
637
- const minimumRadius = this._minimumRadius;
638
- const maximumRadius = this._maximumRadius;
639
- const minimumHeight = this._minimumHeight;
640
- const maximumHeight = this._maximumHeight;
641
- const minimumAngle = this._minimumAngle;
642
- const maximumAngle = this._maximumAngle;
541
+ const minBounds = this._minBounds;
542
+ const maxBounds = this._maxBounds;
643
543
 
644
- const radiusStart = CesiumMath.lerp(minimumRadius, maximumRadius, minLerp.x);
645
- const radiusEnd = CesiumMath.lerp(minimumRadius, maximumRadius, maxLerp.x);
646
- const heightStart = CesiumMath.lerp(minimumHeight, maximumHeight, minLerp.y);
647
- const heightEnd = CesiumMath.lerp(minimumHeight, maximumHeight, maxLerp.y);
648
- const angleStart = CesiumMath.lerp(minimumAngle, maximumAngle, minLerp.z);
649
- const angleEnd = CesiumMath.lerp(minimumAngle, maximumAngle, maxLerp.z);
544
+ const sampleMinBounds = Cartesian3.fromElements(
545
+ CesiumMath.lerp(minBounds.x, maxBounds.x, minLerp.x),
546
+ CesiumMath.lerp(minBounds.y, maxBounds.y, minLerp.y),
547
+ CesiumMath.lerp(minBounds.z, maxBounds.z, minLerp.z),
548
+ scratchMinBounds,
549
+ );
550
+ const sampleMaxBounds = Cartesian3.fromElements(
551
+ CesiumMath.lerp(minBounds.x, maxBounds.x, maxLerp.x),
552
+ CesiumMath.lerp(minBounds.y, maxBounds.y, maxLerp.y),
553
+ CesiumMath.lerp(minBounds.z, maxBounds.z, maxLerp.z),
554
+ scratchMaxBounds,
555
+ );
650
556
 
651
557
  return getCylinderChunkObb(
652
- radiusStart,
653
- radiusEnd,
654
- angleStart,
655
- angleEnd,
656
- heightStart,
657
- heightEnd,
558
+ sampleMinBounds,
559
+ sampleMaxBounds,
658
560
  this.shapeTransform,
659
561
  result,
660
562
  );
@@ -742,56 +644,24 @@ function computeLooseOrientedBoundingBox(matrix, result) {
742
644
  *
743
645
  * @function
744
646
  *
745
- * @param {number} radiusStart The radiusStart.
746
- * @param {number} radiusEnd The radiusEnd.
747
- * @param {number} angleStart The angleStart.
748
- * @param {number} angleEnd The angleEnd.
749
- * @param {number} heightStart The heightStart.
750
- * @param {number} heightEnd The heightEnd.
647
+ * @param {Cartesian3} chunkMinBounds The minimum bounds of the subregion.
648
+ * @param {Cartesian3} chunkMaxBounds The maximum bounds of the subregion.
751
649
  * @param {Matrix4} matrix The matrix to transform the points.
752
650
  * @param {OrientedBoundingBox} result The object onto which to store the result.
753
651
  * @returns {OrientedBoundingBox} The oriented bounding box that contains this subregion.
754
652
  *
755
653
  * @private
756
654
  */
757
- function getCylinderChunkObb(
758
- radiusStart,
759
- radiusEnd,
760
- angleStart,
761
- angleEnd,
762
- heightStart,
763
- heightEnd,
764
- matrix,
765
- result,
766
- ) {
767
- const defaultMinBounds = VoxelCylinderShape.DefaultMinBounds;
768
- const defaultMaxBounds = VoxelCylinderShape.DefaultMaxBounds;
769
- const defaultMinRadius = defaultMinBounds.x; // 0
770
- const defaultMaxRadius = defaultMaxBounds.x; // 1
771
- const defaultMinAngle = defaultMinBounds.y; // -pi
772
- const defaultMaxAngle = defaultMaxBounds.y; // +pi
773
- const defaultMinHeight = defaultMinBounds.z; // -1
774
- const defaultMaxHeight = defaultMaxBounds.z; // +1
775
-
776
- // Return early if using the default bounds
777
- if (
778
- radiusStart === defaultMinRadius &&
779
- radiusEnd === defaultMaxRadius &&
780
- heightStart === defaultMinHeight &&
781
- heightEnd === defaultMaxHeight &&
782
- angleStart === defaultMinAngle &&
783
- angleEnd === defaultMaxAngle
784
- ) {
785
- result.center = Matrix4.getTranslation(matrix, result.center);
786
- result.halfAxes = Matrix4.getMatrix3(matrix, result.halfAxes);
787
- return result;
788
- }
789
-
790
- const isAngleReversed = angleEnd < angleStart;
791
-
792
- if (isAngleReversed) {
793
- angleEnd += CesiumMath.TWO_PI;
794
- }
655
+ function getCylinderChunkObb(chunkMinBounds, chunkMaxBounds, matrix, result) {
656
+ const radiusStart = chunkMinBounds.x;
657
+ const radiusEnd = chunkMaxBounds.x;
658
+ const angleStart = chunkMinBounds.y;
659
+ const angleEnd =
660
+ chunkMaxBounds.y < angleStart
661
+ ? chunkMaxBounds.y + CesiumMath.TWO_PI
662
+ : chunkMaxBounds.y;
663
+ const heightStart = chunkMinBounds.z;
664
+ const heightEnd = chunkMaxBounds.z;
795
665
 
796
666
  const angleRange = angleEnd - angleStart;
797
667
  const angleMid = angleStart + angleRange * 0.5;
@@ -809,10 +679,10 @@ function getCylinderChunkObb(
809
679
  }
810
680
 
811
681
  // Find bounding box in shape space relative to angleMid
812
- let minX = 1.0;
813
- let minY = 1.0;
814
- let maxX = -1.0;
815
- let maxY = -1.0;
682
+ let minX = Number.POSITIVE_INFINITY;
683
+ let minY = Number.POSITIVE_INFINITY;
684
+ let maxX = Number.NEGATIVE_INFINITY;
685
+ let maxY = Number.NEGATIVE_INFINITY;
816
686
 
817
687
  for (let i = 0; i < testAngleCount; ++i) {
818
688
  const angle = testAngles[i] - angleMid;
@@ -823,14 +693,10 @@ function getCylinderChunkObb(
823
693
  const x2 = cosAngle * radiusEnd;
824
694
  const y2 = sinAngle * radiusEnd;
825
695
 
826
- minX = Math.min(minX, x1);
827
- minY = Math.min(minY, y1);
828
- minX = Math.min(minX, x2);
829
- minY = Math.min(minY, y2);
830
- maxX = Math.max(maxX, x1);
831
- maxY = Math.max(maxY, y1);
832
- maxX = Math.max(maxX, x2);
833
- maxY = Math.max(maxY, y2);
696
+ minX = Math.min(minX, x1, x2);
697
+ minY = Math.min(minY, y1, y2);
698
+ maxX = Math.max(maxX, x1, x2);
699
+ maxY = Math.max(maxY, y1, y2);
834
700
  }
835
701
 
836
702
  const extentX = maxX - minX;