@cesium/engine 21.0.1 → 22.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 (244) hide show
  1. package/Build/Workers/{chunk-LPKJSIMD.js → chunk-2D3GLFZD.js} +12 -12
  2. package/Build/Workers/chunk-34YXP222.js +352 -0
  3. package/Build/Workers/{chunk-UKA7OISV.js → chunk-3GL53OCU.js} +17 -18
  4. package/Build/Workers/{chunk-WQZL6CA2.js → chunk-5B7VZQZY.js} +6 -6
  5. package/Build/Workers/{chunk-FE565QHX.js → chunk-5T5SY63I.js} +2 -2
  6. package/Build/Workers/{chunk-RR3NCT4R.js → chunk-5ZF53EY6.js} +4 -4
  7. package/Build/Workers/{chunk-PZUZCAX3.js → chunk-6HBKE43B.js} +7 -7
  8. package/Build/Workers/{chunk-5YXA47QD.js → chunk-726NINF5.js} +16 -16
  9. package/Build/Workers/{chunk-3RKX3UFI.js → chunk-75HAJIDT.js} +1 -1
  10. package/Build/Workers/{chunk-CBPNIEGH.js → chunk-7KAXDKRU.js} +10 -10
  11. package/Build/Workers/chunk-7XEJGXX2.js +2759 -0
  12. package/Build/Workers/{chunk-U2GR5FDL.js → chunk-A4DPJIWS.js} +18 -10
  13. package/Build/Workers/{chunk-G3CKZ34K.js → chunk-A6JAFSZT.js} +5 -5
  14. package/Build/Workers/{chunk-2SI7DEW5.js → chunk-AARZSH4V.js} +5 -5
  15. package/Build/Workers/{chunk-W6KMV4F5.js → chunk-AOM3FHBN.js} +6 -6
  16. package/Build/Workers/{chunk-VVALNLSH.js → chunk-BJSNGGBM.js} +4 -4
  17. package/Build/Workers/{chunk-3YNW5K6O.js → chunk-ECHAJNQJ.js} +12 -12
  18. package/Build/Workers/{chunk-KZ7GDSAJ.js → chunk-EJO3NKMS.js} +1 -1
  19. package/Build/Workers/{chunk-UFSYRVC5.js → chunk-EZ7NJXQN.js} +4 -4
  20. package/Build/Workers/{chunk-P2UKEFCK.js → chunk-FA3SCJDX.js} +2 -2
  21. package/Build/Workers/{chunk-MXOGBWMP.js → chunk-GYRDA3XK.js} +14 -14
  22. package/Build/Workers/{chunk-KVB73ECP.js → chunk-H7B7FU2U.js} +7 -7
  23. package/Build/Workers/{chunk-XJVRYJVZ.js → chunk-IGX772ZQ.js} +1 -1
  24. package/Build/Workers/{chunk-MQPDOWGH.js → chunk-JDJAPBZP.js} +1 -1
  25. package/Build/Workers/{chunk-DDXI6UYW.js → chunk-JZFU2LEM.js} +4 -4
  26. package/Build/Workers/{chunk-DAJKOQW6.js → chunk-KGLDJRSO.js} +9 -9
  27. package/Build/Workers/{chunk-CSDYSXBI.js → chunk-KUB64XW6.js} +11 -11
  28. package/Build/Workers/{chunk-X3ZV3XNO.js → chunk-L7U26FFD.js} +16 -16
  29. package/Build/Workers/{chunk-YZ3RCE45.js → chunk-LEFQBK6H.js} +11 -11
  30. package/Build/Workers/{chunk-KEPPNSBL.js → chunk-LWJXCI3F.js} +5 -5
  31. package/Build/Workers/{chunk-YNOVMSUX.js → chunk-M7HRE4QR.js} +8 -8
  32. package/Build/Workers/{chunk-ASVODZNK.js → chunk-MXHRZHDF.js} +6 -6
  33. package/Build/Workers/{chunk-PJAA7QSC.js → chunk-N52ZRKUE.js} +6 -6
  34. package/Build/Workers/{chunk-W6I3LNPF.js → chunk-NE5JTQJP.js} +7 -7
  35. package/Build/Workers/{chunk-XG54SG4O.js → chunk-NGKF5NTR.js} +5 -5
  36. package/Build/Workers/{chunk-42EJCSIV.js → chunk-NHZNMTIR.js} +5 -5
  37. package/Build/Workers/{chunk-LU7DLY2L.js → chunk-OE22564R.js} +3 -3
  38. package/Build/Workers/{chunk-A2SP2EJZ.js → chunk-OUBBMEWX.js} +6 -6
  39. package/Build/Workers/{chunk-J2XQVKVH.js → chunk-P2H75UV5.js} +67 -33
  40. package/Build/Workers/{chunk-J3KPR6DJ.js → chunk-QCMRUVVF.js} +12 -12
  41. package/Build/Workers/{chunk-RVRN4KDB.js → chunk-QSMIHPUM.js} +2 -2
  42. package/Build/Workers/{chunk-EBDZDBJN.js → chunk-RCCYW6E7.js} +12 -12
  43. package/Build/Workers/{chunk-LV3G32QE.js → chunk-RQRODXVN.js} +4 -4
  44. package/Build/Workers/{chunk-OBS5EMZ6.js → chunk-SZN34LQ5.js} +10 -10
  45. package/Build/Workers/{chunk-IKUOV6DO.js → chunk-U4XMLGSR.js} +7 -7
  46. package/Build/Workers/{chunk-NYYQZ3LH.js → chunk-U7CX3HHE.js} +8 -8
  47. package/Build/Workers/{chunk-QNOIRRJK.js → chunk-VCVA7BMD.js} +4 -4
  48. package/Build/Workers/{chunk-TGJQMEL4.js → chunk-VVZ667H6.js} +2 -2
  49. package/Build/Workers/{chunk-DBHL2UVG.js → chunk-W4PIP5PG.js} +2 -2
  50. package/Build/Workers/{chunk-2QPH5QDK.js → chunk-XPVZWY4A.js} +8 -8
  51. package/Build/Workers/{chunk-4CORGH7N.js → chunk-XQ347YWU.js} +13 -13
  52. package/Build/Workers/{chunk-T7HU6E7G.js → chunk-XZO6F23E.js} +1 -1
  53. package/Build/Workers/{chunk-DTKSVIH5.js → chunk-YLILBDWK.js} +2 -2
  54. package/Build/Workers/{chunk-JG3C3LPY.js → chunk-YLXWC7OW.js} +4 -4
  55. package/Build/Workers/combineGeometry.js +21 -21
  56. package/Build/Workers/createBoxGeometry.js +15 -15
  57. package/Build/Workers/createBoxOutlineGeometry.js +13 -13
  58. package/Build/Workers/createCircleGeometry.js +23 -23
  59. package/Build/Workers/createCircleOutlineGeometry.js +16 -16
  60. package/Build/Workers/createCoplanarPolygonGeometry.js +30 -30
  61. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +28 -28
  62. package/Build/Workers/createCorridorGeometry.js +26 -26
  63. package/Build/Workers/createCorridorOutlineGeometry.js +25 -25
  64. package/Build/Workers/createCylinderGeometry.js +17 -17
  65. package/Build/Workers/createCylinderOutlineGeometry.js +15 -15
  66. package/Build/Workers/createEllipseGeometry.js +23 -23
  67. package/Build/Workers/createEllipseOutlineGeometry.js +16 -16
  68. package/Build/Workers/createEllipsoidGeometry.js +16 -16
  69. package/Build/Workers/createEllipsoidOutlineGeometry.js +15 -15
  70. package/Build/Workers/createFrustumGeometry.js +15 -15
  71. package/Build/Workers/createFrustumOutlineGeometry.js +15 -15
  72. package/Build/Workers/createGeometry.js +24 -22
  73. package/Build/Workers/createGroundPolylineGeometry.js +19 -19
  74. package/Build/Workers/createPlaneGeometry.js +13 -13
  75. package/Build/Workers/createPlaneOutlineGeometry.js +12 -12
  76. package/Build/Workers/createPolygonGeometry.js +29 -29
  77. package/Build/Workers/createPolygonOutlineGeometry.js +27 -27
  78. package/Build/Workers/createPolylineGeometry.js +22 -22
  79. package/Build/Workers/createPolylineVolumeGeometry.js +28 -28
  80. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +24 -24
  81. package/Build/Workers/createRectangleGeometry.js +24 -24
  82. package/Build/Workers/createRectangleOutlineGeometry.js +17 -17
  83. package/Build/Workers/createSimplePolylineGeometry.js +20 -20
  84. package/Build/Workers/createSphereGeometry.js +16 -16
  85. package/Build/Workers/createSphereOutlineGeometry.js +15 -15
  86. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  87. package/Build/Workers/createVectorTileClampedPolylines.js +12 -12
  88. package/Build/Workers/createVectorTileGeometries.js +21 -21
  89. package/Build/Workers/createVectorTilePoints.js +11 -11
  90. package/Build/Workers/createVectorTilePolygons.js +19 -19
  91. package/Build/Workers/createVectorTilePolylines.js +12 -12
  92. package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +88 -0
  93. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +21 -21
  94. package/Build/Workers/createVerticesFromHeightmap.js +21 -21
  95. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +19 -277
  96. package/Build/Workers/createWallGeometry.js +21 -21
  97. package/Build/Workers/createWallOutlineGeometry.js +20 -20
  98. package/Build/Workers/decodeDraco.js +10 -10
  99. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  100. package/Build/Workers/decodeI3S.js +9 -9
  101. package/Build/Workers/gaussianSplatSorter.js +4 -4
  102. package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
  103. package/Build/Workers/transcodeKTX2.js +6 -6
  104. package/Build/Workers/transferTypedArrayTest.js +1 -1
  105. package/Build/Workers/upsampleQuantizedTerrainMesh.js +19 -19
  106. package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +92 -0
  107. package/Source/Core/ArcGISTiledElevationTerrainProvider.js +2 -2
  108. package/Source/Core/Cesium3DTilesTerrainData.js +930 -0
  109. package/Source/Core/Cesium3DTilesTerrainGeometryProcessor.js +1866 -0
  110. package/Source/Core/Cesium3DTilesTerrainProvider.js +1052 -0
  111. package/Source/Core/CesiumTerrainProvider.js +2 -2
  112. package/Source/Core/Color.js +23 -6
  113. package/Source/Core/EllipsoidalOccluder.js +2 -2
  114. package/Source/Core/FeatureDetection.js +0 -2
  115. package/Source/Core/GoogleEarthEnterpriseMetadata.js +1 -1
  116. package/Source/Core/GoogleEarthEnterpriseTerrainData.js +1 -1
  117. package/Source/Core/GoogleEarthEnterpriseTerrainProvider.js +1 -1
  118. package/Source/Core/HeightmapTerrainData.js +10 -22
  119. package/Source/Core/HilbertOrder.js +0 -6
  120. package/Source/Core/ITwinPlatform.js +6 -6
  121. package/Source/Core/Ion.js +1 -1
  122. package/Source/Core/IonResource.js +35 -27
  123. package/Source/Core/PixelFormat.js +2 -2
  124. package/Source/Core/QuantizedMeshTerrainData.js +23 -57
  125. package/Source/Core/Resource.js +15 -11
  126. package/Source/Core/S2Cell.js +6 -18
  127. package/Source/Core/TaskProcessor.js +1 -1
  128. package/Source/Core/TerrainData.js +2 -1
  129. package/Source/Core/TerrainEncoding.js +215 -38
  130. package/Source/Core/TerrainMesh.js +8 -8
  131. package/Source/Core/TerrainProvider.js +151 -0
  132. package/Source/Core/VRTheWorldTerrainProvider.js +2 -2
  133. package/Source/Core/binarySearch.js +1 -1
  134. package/Source/Core/createWorldBathymetryAsync.js +2 -2
  135. package/Source/Core/createWorldTerrainAsync.js +3 -3
  136. package/Source/Core/loadImageFromTypedArray.js +9 -3
  137. package/Source/Core/mergeSort.js +1 -1
  138. package/Source/DataSources/PropertyArray.js +2 -2
  139. package/Source/Renderer/AutomaticUniforms.js +61 -0
  140. package/Source/Renderer/Context.js +13 -7
  141. package/Source/Renderer/Pass.js +10 -9
  142. package/Source/Renderer/UniformState.js +12 -0
  143. package/Source/Renderer/VertexArray.js +1 -1
  144. package/Source/Scene/ArcGisMapServerImageryProvider.js +1 -1
  145. package/Source/Scene/ArcGisMapService.js +1 -1
  146. package/Source/Scene/Azure2DImageryProvider.js +7 -5
  147. package/Source/Scene/BatchTable.js +2 -2
  148. package/Source/Scene/BillboardCollection.js +25 -21
  149. package/Source/Scene/BingMapsImageryProvider.js +1 -1
  150. package/Source/Scene/BoundingVolumeSemantics.js +54 -62
  151. package/Source/Scene/Cesium3DTile.js +3 -3
  152. package/Source/Scene/Cesium3DTilesVoxelProvider.js +1 -1
  153. package/Source/Scene/Cesium3DTileset.js +1 -1
  154. package/Source/Scene/EdgeFramebuffer.js +245 -0
  155. package/Source/Scene/FrameState.js +12 -0
  156. package/Source/Scene/GaussianSplat3DTileContent.js +12 -16
  157. package/Source/Scene/GaussianSplatPrimitive.js +12 -8
  158. package/Source/Scene/GaussianSplatSorter.js +2 -2
  159. package/Source/Scene/Globe.js +1 -1
  160. package/Source/Scene/GlobeSurfaceTile.js +10 -4
  161. package/Source/Scene/GltfBufferViewLoader.js +18 -0
  162. package/Source/Scene/GltfLoader.js +46 -8
  163. package/Source/Scene/Google2DImageryProvider.js +39 -27
  164. package/Source/Scene/GoogleEarthEnterpriseMapsProvider.js +1 -1
  165. package/Source/Scene/I3SDataProvider.js +1 -1
  166. package/Source/Scene/I3SDecoder.js +3 -3
  167. package/Source/Scene/ITwinData.js +4 -4
  168. package/Source/Scene/ImageryLayer.js +1 -1
  169. package/Source/Scene/Implicit3DTileContent.js +18 -7
  170. package/Source/Scene/ImplicitSubtree.js +3 -3
  171. package/Source/Scene/ImplicitTileset.js +2 -2
  172. package/Source/Scene/IonImageryProvider.js +15 -84
  173. package/Source/Scene/IonImageryProviderFactory.js +194 -0
  174. package/Source/Scene/LabelCollection.js +54 -36
  175. package/Source/Scene/MetadataComponentType.js +5 -5
  176. package/Source/Scene/MetadataTableProperty.js +3 -9
  177. package/Source/Scene/Model/EdgeDetectionPipelineStage.js +42 -0
  178. package/Source/Scene/Model/EdgeVisibilityPipelineStage.js +800 -0
  179. package/Source/Scene/Model/MetadataPipelineStage.js +7 -7
  180. package/Source/Scene/Model/ModelDrawCommand.js +69 -0
  181. package/Source/Scene/Model/ModelImagery.js +4 -0
  182. package/Source/Scene/Model/ModelRuntimeNode.js +2 -2
  183. package/Source/Scene/Model/ModelRuntimePrimitive.js +13 -2
  184. package/Source/Scene/Model/ModelSceneGraph.js +15 -3
  185. package/Source/Scene/Model/ModelUtility.js +0 -1
  186. package/Source/Scene/Model/NodeRenderResources.js +1 -1
  187. package/Source/Scene/Model/PrimitiveRenderResources.js +1 -1
  188. package/Source/Scene/OIT.js +11 -1
  189. package/Source/Scene/PickFramebuffer.js +13 -17
  190. package/Source/Scene/Picking.js +104 -80
  191. package/Source/Scene/QuadtreePrimitive.js +34 -26
  192. package/Source/Scene/QuadtreeTile.js +66 -46
  193. package/Source/Scene/ResourceLoaderState.js +1 -1
  194. package/Source/Scene/Scene.js +124 -12
  195. package/Source/Scene/ScreenSpaceCameraController.js +1 -1
  196. package/Source/Scene/SensorVolumePortionToDisplay.js +6 -6
  197. package/Source/Scene/SingleTileImageryProvider.js +3 -3
  198. package/Source/Scene/Terrain.js +5 -5
  199. package/Source/Scene/TileMapServiceImageryProvider.js +2 -2
  200. package/Source/Scene/UrlTemplateImageryProvider.js +1 -1
  201. package/Source/Scene/View.js +3 -0
  202. package/Source/Scene/VoxelPrimitive.js +196 -189
  203. package/Source/Scene/VoxelShape.js +2 -0
  204. package/Source/Scene/createWorldImageryAsync.js +1 -1
  205. package/Source/Shaders/BillboardCollectionFS.glsl +102 -62
  206. package/Source/Shaders/BillboardCollectionFS.js +102 -63
  207. package/Source/Shaders/BillboardCollectionVS.glsl +44 -37
  208. package/Source/Shaders/BillboardCollectionVS.js +45 -38
  209. package/Source/Shaders/Builtin/Constants/passCesium3DTile.glsl +1 -1
  210. package/Source/Shaders/Builtin/Constants/passCesium3DTile.js +1 -1
  211. package/Source/Shaders/Builtin/Constants/passCesium3DTileClassification.glsl +1 -1
  212. package/Source/Shaders/Builtin/Constants/passCesium3DTileClassification.js +1 -1
  213. package/Source/Shaders/Builtin/Constants/passCesium3DTileClassificationIgnoreShow.glsl +1 -1
  214. package/Source/Shaders/Builtin/Constants/passCesium3DTileClassificationIgnoreShow.js +1 -1
  215. package/Source/Shaders/Builtin/Constants/passCesium3DTileEdges.glsl +10 -0
  216. package/Source/Shaders/Builtin/Constants/passCesium3DTileEdges.js +12 -0
  217. package/Source/Shaders/Builtin/Constants/passGaussianSplats.glsl +1 -1
  218. package/Source/Shaders/Builtin/Constants/passGaussianSplats.js +1 -1
  219. package/Source/Shaders/Builtin/Constants/passOpaque.glsl +1 -1
  220. package/Source/Shaders/Builtin/Constants/passOpaque.js +1 -1
  221. package/Source/Shaders/Builtin/Constants/passOverlay.glsl +1 -1
  222. package/Source/Shaders/Builtin/Constants/passOverlay.js +1 -1
  223. package/Source/Shaders/Builtin/Constants/passTranslucent.glsl +1 -1
  224. package/Source/Shaders/Builtin/Constants/passTranslucent.js +1 -1
  225. package/Source/Shaders/Builtin/Constants/passVoxels.glsl +1 -1
  226. package/Source/Shaders/Builtin/Constants/passVoxels.js +1 -1
  227. package/Source/Shaders/Builtin/CzmBuiltins.js +2 -0
  228. package/Source/Shaders/GlobeVS.glsl +1 -1
  229. package/Source/Shaders/GlobeVS.js +1 -1
  230. package/Source/Shaders/Model/EdgeDetectionStageFS.glsl +58 -0
  231. package/Source/Shaders/Model/EdgeDetectionStageFS.js +60 -0
  232. package/Source/Shaders/Model/EdgeVisibilityStageFS.glsl +83 -0
  233. package/Source/Shaders/Model/EdgeVisibilityStageFS.js +85 -0
  234. package/Source/Shaders/Model/ModelFS.glsl +5 -0
  235. package/Source/Shaders/Model/ModelFS.js +5 -0
  236. package/Source/Shaders/Model/PrimitiveOutlineStageFS.glsl +0 -1
  237. package/Source/Shaders/Model/PrimitiveOutlineStageFS.js +0 -1
  238. package/Source/Shaders/ShadowVolumeAppearanceFS.glsl +7 -15
  239. package/Source/Shaders/ShadowVolumeAppearanceFS.js +7 -15
  240. package/Source/Workers/createVerticesFromCesium3DTilesTerrain.js +46 -0
  241. package/Source/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +55 -0
  242. package/index.d.ts +281 -27
  243. package/index.js +200 -190
  244. package/package.json +2 -1
@@ -40,7 +40,7 @@ import VoxelMetadataOrder from "./VoxelMetadataOrder.js";
40
40
  * @param {Matrix4} [options.modelMatrix=Matrix4.IDENTITY] The model matrix used to transform the primitive.
41
41
  * @param {CustomShader} [options.customShader] The custom shader used to style the primitive.
42
42
  * @param {Clock} [options.clock] The clock used to control time dynamic behavior.
43
- * @param {Boolean} [options.calculateStatistics] Generate statistics for performance profile.
43
+ * @param {boolean} [options.calculateStatistics] Generate statistics for performance profile.
44
44
  *
45
45
  * @see VoxelProvider
46
46
  * @see Cesium3DTilesVoxelProvider
@@ -173,36 +173,21 @@ function VoxelPrimitive(options) {
173
173
  this._maxBoundsOld = new Cartesian3();
174
174
 
175
175
  /**
176
- * Minimum bounds with vertical exaggeration applied
177
- *
178
- * @type {Cartesian3}
179
- * @private
180
- */
181
- this._exaggeratedMinBounds = new Cartesian3();
182
-
183
- /**
184
- * Used to detect if the shape is dirty.
185
- *
186
- * @type {Cartesian3}
187
- * @private
188
- */
189
- this._exaggeratedMinBoundsOld = new Cartesian3();
190
-
191
- /**
192
- * Maximum bounds with vertical exaggeration applied
176
+ * This member is not known until the provider is ready.
193
177
  *
194
178
  * @type {Cartesian3}
195
179
  * @private
196
180
  */
197
- this._exaggeratedMaxBounds = new Cartesian3();
181
+ this._minClippingBounds = new Cartesian3();
198
182
 
199
183
  /**
200
- * Used to detect if the shape is dirty.
184
+ * Used to detect if the clipping is dirty.
185
+ * This member is not known until the provider is ready.
201
186
  *
202
187
  * @type {Cartesian3}
203
188
  * @private
204
189
  */
205
- this._exaggeratedMaxBoundsOld = new Cartesian3();
190
+ this._minClippingBoundsOld = new Cartesian3();
206
191
 
207
192
  /**
208
193
  * This member is not known until the provider is ready.
@@ -210,7 +195,7 @@ function VoxelPrimitive(options) {
210
195
  * @type {Cartesian3}
211
196
  * @private
212
197
  */
213
- this._minClippingBounds = new Cartesian3();
198
+ this._maxClippingBounds = new Cartesian3();
214
199
 
215
200
  /**
216
201
  * Used to detect if the clipping is dirty.
@@ -219,24 +204,23 @@ function VoxelPrimitive(options) {
219
204
  * @type {Cartesian3}
220
205
  * @private
221
206
  */
222
- this._minClippingBoundsOld = new Cartesian3();
207
+ this._maxClippingBoundsOld = new Cartesian3();
223
208
 
224
209
  /**
225
- * This member is not known until the provider is ready.
210
+ * Vertical exaggeration applied to the voxel shape
226
211
  *
227
- * @type {Cartesian3}
212
+ * @type {number}
228
213
  * @private
229
214
  */
230
- this._maxClippingBounds = new Cartesian3();
215
+ this._verticalExaggeration = 1.0;
231
216
 
232
217
  /**
233
- * Used to detect if the clipping is dirty.
234
- * This member is not known until the provider is ready.
218
+ * The height relative to which the shape is exaggerated.
235
219
  *
236
- * @type {Cartesian3}
220
+ * @type {number}
237
221
  * @private
238
222
  */
239
- this._maxClippingBoundsOld = new Cartesian3();
223
+ this._verticalExaggerationRelativeHeight = 0.0;
240
224
 
241
225
  /**
242
226
  * Clipping planes on the primitive
@@ -271,30 +255,12 @@ function VoxelPrimitive(options) {
271
255
  this._modelMatrix = Matrix4.clone(options.modelMatrix ?? Matrix4.IDENTITY);
272
256
 
273
257
  /**
274
- * Model matrix with vertical exaggeration applied. Only used for BOX shape type.
275
- *
276
- * @type {Matrix4}
277
- * @private
278
- */
279
- this._exaggeratedModelMatrix = Matrix4.clone(this._modelMatrix);
280
-
281
- /**
282
- * The primitive's model matrix multiplied by the provider's model matrix.
283
- * This member is not known until the provider is ready.
284
- *
285
- * @type {Matrix4}
286
- * @private
287
- */
288
- this._compoundModelMatrix = new Matrix4();
289
-
290
- /**
291
- * Used to detect if the shape is dirty.
292
- * This member is not known until the provider is ready.
258
+ * Used to detect if the model matrix is dirty.
293
259
  *
294
260
  * @type {Matrix4}
295
261
  * @private
296
262
  */
297
- this._compoundModelMatrixOld = new Matrix4();
263
+ this._modelMatrixOld = Matrix4.clone(this._modelMatrix);
298
264
 
299
265
  /**
300
266
  * @type {CustomShader}
@@ -622,21 +588,7 @@ function initialize(primitive, provider) {
622
588
  primitive.minClippingBounds = minBounds.clone();
623
589
  primitive.maxClippingBounds = maxBounds.clone();
624
590
 
625
- // Initialize the exaggerated versions of bounds and model matrix
626
- primitive._exaggeratedMinBounds = Cartesian3.clone(
627
- primitive._minBounds,
628
- primitive._exaggeratedMinBounds,
629
- );
630
- primitive._exaggeratedMaxBounds = Cartesian3.clone(
631
- primitive._maxBounds,
632
- primitive._exaggeratedMaxBounds,
633
- );
634
- primitive._exaggeratedModelMatrix = Matrix4.clone(
635
- primitive._modelMatrix,
636
- primitive._exaggeratedModelMatrix,
637
- );
638
-
639
- checkTransformAndBounds(primitive, provider);
591
+ checkTransformAndBounds(primitive);
640
592
 
641
593
  // Create the shape object, and update it so it is valid for VoxelTraversal
642
594
  const ShapeConstructor = VoxelShapeType.getShapeConstructor(shapeType);
@@ -1176,13 +1128,12 @@ VoxelPrimitive.prototype.update = function (frameState) {
1176
1128
  return;
1177
1129
  }
1178
1130
 
1179
- updateVerticalExaggeration(this, frameState);
1180
-
1181
1131
  // Check if the shape is dirty before updating it. This needs to happen every
1182
1132
  // frame because the member variables can be modified externally via the
1183
1133
  // getters.
1184
- const shapeDirty = checkTransformAndBounds(this, provider);
1185
- if (shapeDirty) {
1134
+ const shapeDirty = checkTransformAndBounds(this);
1135
+ const exaggerationChanged = updateVerticalExaggeration(this, frameState);
1136
+ if (shapeDirty || exaggerationChanged) {
1186
1137
  this._shapeVisible = updateShapeAndTransforms(this);
1187
1138
  if (checkShapeDefines(this)) {
1188
1139
  this._shaderDirty = true;
@@ -1383,102 +1334,30 @@ function getTileCoordinates(primitive, positionLocal, result) {
1383
1334
  const scratchExaggerationScale = new Cartesian3();
1384
1335
  const scratchExaggerationCenter = new Cartesian3();
1385
1336
  const scratchCartographicCenter = new Cartographic();
1386
- const scratchExaggerationTranslation = new Cartesian3();
1387
1337
 
1388
1338
  /**
1389
- * Update the exaggerated bounds of a primitive to account for vertical exaggeration
1390
- * @param {VoxelPrimitive} primitive
1391
- * @param {FrameState} frameState
1339
+ * Check for changes in the vertical exaggeration of the primitive
1340
+ * @param {VoxelPrimitive} primitive The primitive to update
1341
+ * @param {FrameState} frameState The current frame state
1342
+ * @returns {boolean} <code>true</code> if the exaggeration was changed
1392
1343
  * @private
1393
1344
  */
1394
1345
  function updateVerticalExaggeration(primitive, frameState) {
1395
- primitive._exaggeratedMinBounds = Cartesian3.clone(
1396
- primitive._minBounds,
1397
- primitive._exaggeratedMinBounds,
1398
- );
1399
- primitive._exaggeratedMaxBounds = Cartesian3.clone(
1400
- primitive._maxBounds,
1401
- primitive._exaggeratedMaxBounds,
1402
- );
1346
+ const { verticalExaggeration, verticalExaggerationRelativeHeight } =
1347
+ frameState;
1403
1348
 
1404
- if (primitive.shape === VoxelShapeType.ELLIPSOID) {
1405
- // Apply the exaggeration by stretching the height bounds
1406
- const relativeHeight = frameState.verticalExaggerationRelativeHeight;
1407
- const exaggeration = frameState.verticalExaggeration;
1408
- primitive._exaggeratedMinBounds.z =
1409
- (primitive._minBounds.z - relativeHeight) * exaggeration + relativeHeight;
1410
- primitive._exaggeratedMaxBounds.z =
1411
- (primitive._maxBounds.z - relativeHeight) * exaggeration + relativeHeight;
1412
- } else {
1413
- // Apply the exaggeration via the model matrix
1414
- const exaggerationScale = Cartesian3.fromElements(
1415
- 1.0,
1416
- 1.0,
1417
- frameState.verticalExaggeration,
1418
- scratchExaggerationScale,
1419
- );
1420
- primitive._exaggeratedModelMatrix = Matrix4.multiplyByScale(
1421
- primitive._modelMatrix,
1422
- exaggerationScale,
1423
- primitive._exaggeratedModelMatrix,
1424
- );
1425
- primitive._exaggeratedModelMatrix = Matrix4.multiplyByTranslation(
1426
- primitive._exaggeratedModelMatrix,
1427
- computeBoxExaggerationTranslation(primitive, frameState),
1428
- primitive._exaggeratedModelMatrix,
1429
- );
1430
- }
1431
- }
1432
-
1433
- function computeBoxExaggerationTranslation(primitive, frameState) {
1434
- // Compute translation based on box center, relative height, and exaggeration
1435
- const {
1436
- shapeTransform = Matrix4.IDENTITY,
1437
- globalTransform = Matrix4.IDENTITY,
1438
- } = primitive._provider;
1439
-
1440
- // Find the Cartesian position of the center of the OBB
1441
- const initialCenter = Matrix4.getTranslation(
1442
- shapeTransform,
1443
- scratchExaggerationCenter,
1444
- );
1445
- const intermediateCenter = Matrix4.multiplyByPoint(
1446
- primitive._modelMatrix,
1447
- initialCenter,
1448
- scratchExaggerationCenter,
1449
- );
1450
- const transformedCenter = Matrix4.multiplyByPoint(
1451
- globalTransform,
1452
- intermediateCenter,
1453
- scratchExaggerationCenter,
1454
- );
1455
-
1456
- // Find the cartographic height
1457
- const ellipsoid = Ellipsoid.WGS84;
1458
- const centerCartographic = ellipsoid.cartesianToCartographic(
1459
- transformedCenter,
1460
- scratchCartographicCenter,
1461
- );
1462
-
1463
- let centerHeight = 0.0;
1464
- if (defined(centerCartographic)) {
1465
- centerHeight = centerCartographic.height;
1349
+ if (
1350
+ primitive._verticalExaggeration === verticalExaggeration &&
1351
+ primitive._verticalExaggerationRelativeHeight ===
1352
+ verticalExaggerationRelativeHeight
1353
+ ) {
1354
+ return false;
1466
1355
  }
1467
1356
 
1468
- // Find the shift that will put the center in the right position relative
1469
- // to relativeHeight, after it is scaled by verticalExaggeration
1470
- const exaggeratedHeight = VerticalExaggeration.getHeight(
1471
- centerHeight,
1472
- frameState.verticalExaggeration,
1473
- frameState.verticalExaggerationRelativeHeight,
1474
- );
1475
-
1476
- return Cartesian3.fromElements(
1477
- 0.0,
1478
- 0.0,
1479
- (exaggeratedHeight - centerHeight) / frameState.verticalExaggeration,
1480
- scratchExaggerationTranslation,
1481
- );
1357
+ primitive._verticalExaggeration = verticalExaggeration;
1358
+ primitive._verticalExaggerationRelativeHeight =
1359
+ verticalExaggerationRelativeHeight;
1360
+ return true;
1482
1361
  }
1483
1362
 
1484
1363
  /**
@@ -1575,39 +1454,14 @@ function initFromProvider(primitive, provider, context) {
1575
1454
  /**
1576
1455
  * Track changes in provider transform and primitive bounds
1577
1456
  * @param {VoxelPrimitive} primitive
1578
- * @param {VoxelProvider} provider
1579
1457
  * @returns {boolean} Whether any of the transform or bounds changed
1580
1458
  * @private
1581
1459
  */
1582
- function checkTransformAndBounds(primitive, provider) {
1583
- const shapeTransform = provider.shapeTransform ?? Matrix4.IDENTITY;
1584
- const globalTransform = provider.globalTransform ?? Matrix4.IDENTITY;
1585
-
1586
- // Compound model matrix = global transform * model matrix * shape transform
1587
- Matrix4.multiplyTransformation(
1588
- globalTransform,
1589
- primitive._exaggeratedModelMatrix,
1590
- primitive._compoundModelMatrix,
1591
- );
1592
- Matrix4.multiplyTransformation(
1593
- primitive._compoundModelMatrix,
1594
- shapeTransform,
1595
- primitive._compoundModelMatrix,
1596
- );
1460
+ function checkTransformAndBounds(primitive) {
1597
1461
  const numChanges =
1598
- updateBound(primitive, "_compoundModelMatrix", "_compoundModelMatrixOld") +
1462
+ updateBound(primitive, "_modelMatrix", "_modelMatrixOld") +
1599
1463
  updateBound(primitive, "_minBounds", "_minBoundsOld") +
1600
1464
  updateBound(primitive, "_maxBounds", "_maxBoundsOld") +
1601
- updateBound(
1602
- primitive,
1603
- "_exaggeratedMinBounds",
1604
- "_exaggeratedMinBoundsOld",
1605
- ) +
1606
- updateBound(
1607
- primitive,
1608
- "_exaggeratedMaxBounds",
1609
- "_exaggeratedMaxBoundsOld",
1610
- ) +
1611
1465
  updateBound(primitive, "_minClippingBounds", "_minClippingBoundsOld") +
1612
1466
  updateBound(primitive, "_maxClippingBounds", "_maxClippingBoundsOld");
1613
1467
  return numChanges > 0;
@@ -1633,6 +1487,13 @@ function updateBound(primitive, newBoundKey, oldBoundKey) {
1633
1487
  return changed ? 1 : 0;
1634
1488
  }
1635
1489
 
1490
+ const scratchExaggeratedMinBounds = new Cartesian3();
1491
+ const scratchExaggeratedMaxBounds = new Cartesian3();
1492
+ const scratchExaggeratedMinClippingBounds = new Cartesian3();
1493
+ const scratchExaggeratedMaxClippingBounds = new Cartesian3();
1494
+ const scratchExaggeratedModelMatrix = new Matrix4();
1495
+ const scratchCompoundModelMatrix = new Matrix4();
1496
+
1636
1497
  /**
1637
1498
  * Update the shape and related transforms
1638
1499
  * @param {VoxelPrimitive} primitive
@@ -1640,13 +1501,95 @@ function updateBound(primitive, newBoundKey, oldBoundKey) {
1640
1501
  * @private
1641
1502
  */
1642
1503
  function updateShapeAndTransforms(primitive) {
1504
+ const verticalExaggeration = primitive._verticalExaggeration;
1505
+ const verticalExaggerationRelativeHeight =
1506
+ primitive._verticalExaggerationRelativeHeight;
1507
+ const exaggeratedMinBounds = Cartesian3.clone(
1508
+ primitive._minBounds,
1509
+ scratchExaggeratedMinBounds,
1510
+ );
1511
+ const exaggeratedMaxBounds = Cartesian3.clone(
1512
+ primitive._maxBounds,
1513
+ scratchExaggeratedMaxBounds,
1514
+ );
1515
+ const exaggeratedMinClippingBounds = Cartesian3.clone(
1516
+ primitive._minClippingBounds,
1517
+ scratchExaggeratedMinClippingBounds,
1518
+ );
1519
+ const exaggeratedMaxClippingBounds = Cartesian3.clone(
1520
+ primitive._maxClippingBounds,
1521
+ scratchExaggeratedMaxClippingBounds,
1522
+ );
1523
+ const exaggeratedModelMatrix = Matrix4.clone(
1524
+ primitive._modelMatrix,
1525
+ scratchExaggeratedModelMatrix,
1526
+ );
1527
+
1528
+ if (primitive.shape === VoxelShapeType.ELLIPSOID) {
1529
+ // Apply the exaggeration by stretching the height bounds
1530
+ exaggeratedMinBounds.z = VerticalExaggeration.getHeight(
1531
+ primitive._minBounds.z,
1532
+ verticalExaggeration,
1533
+ verticalExaggerationRelativeHeight,
1534
+ );
1535
+ exaggeratedMaxBounds.z = VerticalExaggeration.getHeight(
1536
+ primitive._maxBounds.z,
1537
+ verticalExaggeration,
1538
+ verticalExaggerationRelativeHeight,
1539
+ );
1540
+ exaggeratedMinClippingBounds.z = VerticalExaggeration.getHeight(
1541
+ primitive._minClippingBounds.z,
1542
+ verticalExaggeration,
1543
+ verticalExaggerationRelativeHeight,
1544
+ );
1545
+ exaggeratedMaxClippingBounds.z = VerticalExaggeration.getHeight(
1546
+ primitive._maxClippingBounds.z,
1547
+ verticalExaggeration,
1548
+ verticalExaggerationRelativeHeight,
1549
+ );
1550
+ } else {
1551
+ // Apply the exaggeration via the model matrix
1552
+ const exaggerationScale = Cartesian3.fromElements(
1553
+ 1.0,
1554
+ 1.0,
1555
+ verticalExaggeration,
1556
+ scratchExaggerationScale,
1557
+ );
1558
+ Matrix4.multiplyByScale(
1559
+ exaggeratedModelMatrix,
1560
+ exaggerationScale,
1561
+ exaggeratedModelMatrix,
1562
+ );
1563
+ Matrix4.multiplyByTranslation(
1564
+ exaggeratedModelMatrix,
1565
+ computeBoxExaggerationTranslation(primitive),
1566
+ exaggeratedModelMatrix,
1567
+ );
1568
+ }
1569
+
1570
+ const provider = primitive._provider;
1571
+ const shapeTransform = provider.shapeTransform ?? Matrix4.IDENTITY;
1572
+ const globalTransform = provider.globalTransform ?? Matrix4.IDENTITY;
1573
+
1574
+ // Compound model matrix = global transform * model matrix * shape transform
1575
+ const compoundModelMatrix = Matrix4.multiplyTransformation(
1576
+ globalTransform,
1577
+ exaggeratedModelMatrix,
1578
+ scratchCompoundModelMatrix,
1579
+ );
1580
+ Matrix4.multiplyTransformation(
1581
+ compoundModelMatrix,
1582
+ shapeTransform,
1583
+ compoundModelMatrix,
1584
+ );
1585
+
1643
1586
  const shape = primitive._shape;
1644
1587
  const visible = shape.update(
1645
- primitive._compoundModelMatrix,
1646
- primitive._exaggeratedMinBounds,
1647
- primitive._exaggeratedMaxBounds,
1648
- primitive.minClippingBounds,
1649
- primitive.maxClippingBounds,
1588
+ compoundModelMatrix,
1589
+ exaggeratedMinBounds,
1590
+ exaggeratedMaxBounds,
1591
+ exaggeratedMinClippingBounds,
1592
+ exaggeratedMaxClippingBounds,
1650
1593
  );
1651
1594
  if (!visible) {
1652
1595
  return false;
@@ -1668,6 +1611,70 @@ function updateShapeAndTransforms(primitive) {
1668
1611
  return true;
1669
1612
  }
1670
1613
 
1614
+ const scratchExaggerationTranslation = new Cartesian3();
1615
+
1616
+ /**
1617
+ * Compute the translation to apply to box shapes to account for vertical exaggeration
1618
+ *
1619
+ * @param {VoxelPrimitive} primitive
1620
+ * @returns {Cartesian3} The translation to apply to the box to account for vertical exaggeration
1621
+ * @private
1622
+ */
1623
+ function computeBoxExaggerationTranslation(primitive) {
1624
+ const verticalExaggeration = primitive._verticalExaggeration;
1625
+ const verticalExaggerationRelativeHeight =
1626
+ primitive._verticalExaggerationRelativeHeight;
1627
+
1628
+ // Compute translation based on box center, relative height, and exaggeration
1629
+ const {
1630
+ shapeTransform = Matrix4.IDENTITY,
1631
+ globalTransform = Matrix4.IDENTITY,
1632
+ } = primitive._provider;
1633
+
1634
+ // Find the Cartesian position of the center of the OBB
1635
+ const initialCenter = Matrix4.getTranslation(
1636
+ shapeTransform,
1637
+ scratchExaggerationCenter,
1638
+ );
1639
+ const intermediateCenter = Matrix4.multiplyByPoint(
1640
+ primitive._modelMatrix,
1641
+ initialCenter,
1642
+ scratchExaggerationCenter,
1643
+ );
1644
+ const transformedCenter = Matrix4.multiplyByPoint(
1645
+ globalTransform,
1646
+ intermediateCenter,
1647
+ scratchExaggerationCenter,
1648
+ );
1649
+
1650
+ // Find the cartographic height
1651
+ const ellipsoid = Ellipsoid.WGS84;
1652
+ const centerCartographic = ellipsoid.cartesianToCartographic(
1653
+ transformedCenter,
1654
+ scratchCartographicCenter,
1655
+ );
1656
+
1657
+ let centerHeight = 0.0;
1658
+ if (defined(centerCartographic)) {
1659
+ centerHeight = centerCartographic.height;
1660
+ }
1661
+
1662
+ // Find the shift that will put the center in the right position relative
1663
+ // to relativeHeight, after it is scaled by verticalExaggeration
1664
+ const exaggeratedHeight = VerticalExaggeration.getHeight(
1665
+ centerHeight,
1666
+ verticalExaggeration,
1667
+ verticalExaggerationRelativeHeight,
1668
+ );
1669
+
1670
+ return Cartesian3.fromElements(
1671
+ 0.0,
1672
+ 0.0,
1673
+ (exaggeratedHeight - centerHeight) / verticalExaggeration,
1674
+ scratchExaggerationTranslation,
1675
+ );
1676
+ }
1677
+
1671
1678
  /**
1672
1679
  * Set uniforms that come from the traversal.
1673
1680
  * @param {VoxelTraversal} traversal
@@ -105,6 +105,8 @@ Object.defineProperties(VoxelShape.prototype, {
105
105
  * @param {Matrix4} modelMatrix The model matrix.
106
106
  * @param {Cartesian3} minBounds The minimum bounds.
107
107
  * @param {Cartesian3} maxBounds The maximum bounds.
108
+ * @param {Cartesian3} [clipMinBounds] The minimum clip bounds.
109
+ * @param {Cartesian3} [clipMaxBounds] The maximum clip bounds.
108
110
  * @returns {boolean} Whether the shape is visible.
109
111
  */
110
112
  VoxelShape.prototype.update = DeveloperError.throwInstantiationError;
@@ -7,7 +7,7 @@ import IonWorldImageryStyle from "./IonWorldImageryStyle.js";
7
7
  *
8
8
  * @function
9
9
  *
10
- * @param {Object} [options] Object with the following properties:
10
+ * @param {object} [options] Object with the following properties:
11
11
  * @param {IonWorldImageryStyle} [options.style=IonWorldImageryStyle] The style of base imagery, only AERIAL, AERIAL_WITH_LABELS, and ROAD are currently supported.
12
12
  * @returns {Promise<IonImageryProvider>}
13
13
  *