@cesium/engine 22.2.0 → 23.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 (282) hide show
  1. package/Build/Workers/{chunk-YFEZPDAY.js → chunk-2GL2EUEE.js} +11 -11
  2. package/Build/Workers/{chunk-A3NUMZBG.js → chunk-2WI4HGJU.js} +6 -6
  3. package/Build/Workers/{chunk-3JB2X2PR.js → chunk-36LBFITA.js} +665 -366
  4. package/Build/Workers/{chunk-VSZ5DB2W.js → chunk-3B65YFXC.js} +1 -1
  5. package/Build/Workers/{chunk-PSHZAHFE.js → chunk-4LGFX2P5.js} +11 -11
  6. package/Build/Workers/{chunk-AMWXJ5A7.js → chunk-4UNQX2MP.js} +2 -2
  7. package/Build/Workers/{chunk-LDSQMLRC.js → chunk-52K3GJKG.js} +3 -3
  8. package/Build/Workers/{chunk-MSTAVM2N.js → chunk-56OHFSLH.js} +10 -10
  9. package/Build/Workers/{chunk-IWOSJVFQ.js → chunk-5A7YSAXT.js} +14 -14
  10. package/Build/Workers/{chunk-PMDPP22G.js → chunk-5JP5FG7U.js} +7 -7
  11. package/Build/Workers/{chunk-DIJ7IG5D.js → chunk-5R7SBUTW.js} +10 -10
  12. package/Build/Workers/chunk-5VKZVPO5.js +1829 -0
  13. package/Build/Workers/{chunk-L2FSBEW2.js → chunk-6FVFM2KB.js} +5 -5
  14. package/Build/Workers/{chunk-G6WQA27G.js → chunk-6SLGTBB2.js} +5 -5
  15. package/Build/Workers/{chunk-3HUEBDFC.js → chunk-7KRN6JPQ.js} +14 -14
  16. package/Build/Workers/{chunk-GMHDOQPH.js → chunk-AA33B6PU.js} +4 -4
  17. package/Build/Workers/{chunk-7CDQUIP5.js → chunk-AP6XWET5.js} +8 -8
  18. package/Build/Workers/{chunk-IVN5HSOI.js → chunk-APDKMX7W.js} +6 -6
  19. package/Build/Workers/{chunk-72LZ3FN6.js → chunk-ARCFIOKA.js} +12 -12
  20. package/Build/Workers/{chunk-UBJYWGMV.js → chunk-BNBD2YZK.js} +16 -16
  21. package/Build/Workers/{chunk-VGH2CSC7.js → chunk-DT5SJBKA.js} +29 -15
  22. package/Build/Workers/{chunk-ED4UXMYY.js → chunk-ESD4IEOU.js} +5 -5
  23. package/Build/Workers/{chunk-JFN2DQHY.js → chunk-FSDVXW7M.js} +5 -5
  24. package/Build/Workers/{chunk-JERDRSEI.js → chunk-G3YT7M7A.js} +1 -1
  25. package/Build/Workers/{chunk-NY3CWLIZ.js → chunk-GN5NEUDT.js} +8 -8
  26. package/Build/Workers/{chunk-O3GWUTWM.js → chunk-HYLEKKO5.js} +1 -1
  27. package/Build/Workers/{chunk-64PJ4MTB.js → chunk-HYTFXWMY.js} +7 -7
  28. package/Build/Workers/{chunk-FPRM6PCE.js → chunk-IFA7VHHP.js} +560 -306
  29. package/Build/Workers/{chunk-FM5XPC2E.js → chunk-IYVDOB5V.js} +4 -4
  30. package/Build/Workers/{chunk-P7ISUYLW.js → chunk-JUGY5AZN.js} +4 -4
  31. package/Build/Workers/{chunk-JONWM4IO.js → chunk-KPYU6YZG.js} +1 -1
  32. package/Build/Workers/{chunk-JUOSYFXT.js → chunk-L7RDJ4V7.js} +1 -1
  33. package/Build/Workers/{chunk-MWGB6DLR.js → chunk-LDQWNMEC.js} +1 -1
  34. package/Build/Workers/{chunk-C6FTHSJA.js → chunk-MQJG522T.js} +6 -6
  35. package/Build/Workers/{chunk-WH4HDRGN.js → chunk-MT5M7RLZ.js} +2 -2
  36. package/Build/Workers/{chunk-4ZQN7M7E.js → chunk-N4AWE7TZ.js} +10 -10
  37. package/Build/Workers/{chunk-SDUH3N6G.js → chunk-NAYRNPEP.js} +4 -4
  38. package/Build/Workers/{chunk-7OPRTZBT.js → chunk-NNHU33JK.js} +7 -7
  39. package/Build/Workers/{chunk-CQCEPC6N.js → chunk-NQCAZU7S.js} +13 -13
  40. package/Build/Workers/{chunk-35J4D6PX.js → chunk-NUYLNQKV.js} +2 -2
  41. package/Build/Workers/{chunk-I45CATZK.js → chunk-OC6X22PG.js} +9 -9
  42. package/Build/Workers/{chunk-7MGTX4WP.js → chunk-OHBM4YG4.js} +12 -12
  43. package/Build/Workers/{chunk-DCR62BCO.js → chunk-OMXN7YF4.js} +12 -12
  44. package/Build/Workers/{chunk-XPNY2VY3.js → chunk-OQ3EAJNW.js} +2 -2
  45. package/Build/Workers/{chunk-4I7BCCNU.js → chunk-OQBPOKPZ.js} +6 -6
  46. package/Build/Workers/{chunk-2JNPWPLE.js → chunk-PQVNT5CJ.js} +6 -6
  47. package/Build/Workers/{chunk-K64RQCRK.js → chunk-QA24Q62E.js} +17 -17
  48. package/Build/Workers/{chunk-K6BXEBAF.js → chunk-QQX7S5QT.js} +17 -17
  49. package/Build/Workers/{chunk-2YVTOY5Z.js → chunk-QTOHIXGF.js} +10 -10
  50. package/Build/Workers/{chunk-4MCPC4TE.js → chunk-R7M4XNPP.js} +8 -8
  51. package/Build/Workers/{chunk-C35SJ4QP.js → chunk-SGKTBHFQ.js} +13 -13
  52. package/Build/Workers/{chunk-BKYJBTHW.js → chunk-SQTRWKO2.js} +5 -5
  53. package/Build/Workers/{chunk-I4D5IP46.js → chunk-T43FXHNC.js} +7 -7
  54. package/Build/Workers/{chunk-QO6Z5UJE.js → chunk-UEEGWJJP.js} +2 -2
  55. package/Build/Workers/{chunk-ZUWF63QU.js → chunk-WKXDCVBO.js} +4 -4
  56. package/Build/Workers/{chunk-N5MNKWED.js → chunk-Y5AJSEEN.js} +2 -2
  57. package/Build/Workers/{chunk-V26Y7ZQL.js → chunk-ZIW5FCIW.js} +37 -27
  58. package/Build/Workers/combineGeometry.js +24 -24
  59. package/Build/Workers/createBoxGeometry.js +18 -18
  60. package/Build/Workers/createBoxOutlineGeometry.js +16 -16
  61. package/Build/Workers/createCircleGeometry.js +26 -26
  62. package/Build/Workers/createCircleOutlineGeometry.js +19 -19
  63. package/Build/Workers/createCoplanarPolygonGeometry.js +33 -33
  64. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -31
  65. package/Build/Workers/createCorridorGeometry.js +29 -29
  66. package/Build/Workers/createCorridorOutlineGeometry.js +28 -28
  67. package/Build/Workers/createCylinderGeometry.js +20 -20
  68. package/Build/Workers/createCylinderOutlineGeometry.js +18 -18
  69. package/Build/Workers/createEllipseGeometry.js +26 -26
  70. package/Build/Workers/createEllipseOutlineGeometry.js +19 -19
  71. package/Build/Workers/createEllipsoidGeometry.js +19 -19
  72. package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -18
  73. package/Build/Workers/createFrustumGeometry.js +18 -18
  74. package/Build/Workers/createFrustumOutlineGeometry.js +18 -18
  75. package/Build/Workers/createGeometry.js +24 -24
  76. package/Build/Workers/createGroundPolylineGeometry.js +22 -22
  77. package/Build/Workers/createPlaneGeometry.js +16 -16
  78. package/Build/Workers/createPlaneOutlineGeometry.js +15 -15
  79. package/Build/Workers/createPolygonGeometry.js +32 -32
  80. package/Build/Workers/createPolygonOutlineGeometry.js +30 -30
  81. package/Build/Workers/createPolylineGeometry.js +25 -25
  82. package/Build/Workers/createPolylineVolumeGeometry.js +31 -31
  83. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
  84. package/Build/Workers/createRectangleGeometry.js +27 -27
  85. package/Build/Workers/createRectangleOutlineGeometry.js +20 -20
  86. package/Build/Workers/createSimplePolylineGeometry.js +23 -23
  87. package/Build/Workers/createSphereGeometry.js +19 -19
  88. package/Build/Workers/createSphereOutlineGeometry.js +18 -18
  89. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  90. package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
  91. package/Build/Workers/createVectorTileGeometries.js +24 -24
  92. package/Build/Workers/createVectorTilePoints.js +13 -13
  93. package/Build/Workers/createVectorTilePolygons.js +22 -22
  94. package/Build/Workers/createVectorTilePolylines.js +14 -14
  95. package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +25 -25
  96. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -22
  97. package/Build/Workers/createVerticesFromHeightmap.js +22 -22
  98. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +20 -20
  99. package/Build/Workers/createWallGeometry.js +24 -24
  100. package/Build/Workers/createWallOutlineGeometry.js +23 -23
  101. package/Build/Workers/decodeDraco.js +10 -10
  102. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  103. package/Build/Workers/decodeI3S.js +10 -10
  104. package/Build/Workers/gaussianSplatSorter.js +4 -4
  105. package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
  106. package/Build/Workers/incrementallyBuildTerrainPicker.js +20 -12
  107. package/Build/Workers/transcodeKTX2.js +6 -6
  108. package/Build/Workers/transferTypedArrayTest.js +1 -1
  109. package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -22
  110. package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +25 -25
  111. package/Source/Core/AttributeCompression.js +53 -6
  112. package/Source/Core/BoxGeometry.js +1 -1
  113. package/Source/Core/Cartesian2.js +689 -684
  114. package/Source/Core/Cartesian3.js +1044 -1043
  115. package/Source/Core/Cartesian4.js +816 -813
  116. package/Source/Core/CornerType.js +1 -1
  117. package/Source/Core/CorridorGeometry.js +1 -1
  118. package/Source/Core/FeatureDetection.js +1 -32
  119. package/Source/Core/Geometry.js +1 -1
  120. package/Source/Core/GoogleMaps.js +23 -2
  121. package/Source/Core/IntersectionTests.js +2 -2
  122. package/Source/Core/Ion.js +1 -1
  123. package/Source/Core/OpenCageGeocoderService.js +2 -3
  124. package/Source/Core/PinBuilder.js +1 -1
  125. package/Source/Core/PolygonGeometry.js +1 -1
  126. package/Source/Core/PolylineGeometry.js +1 -1
  127. package/Source/Core/PolylineVolumeGeometry.js +1 -1
  128. package/Source/Core/RectangleGeometry.js +1 -1
  129. package/Source/Core/ScreenSpaceEventHandler.js +4 -8
  130. package/Source/Core/TerrainMesh.js +11 -8
  131. package/Source/Core/TerrainPicker.js +24 -7
  132. package/Source/Core/VideoSynchronizer.js +1 -1
  133. package/Source/Core/WallGeometry.js +1 -1
  134. package/Source/Core/globalTypes.js +16 -0
  135. package/Source/Core/writeTextToCanvas.js +40 -86
  136. package/Source/DataSources/BillboardGraphics.js +1 -1
  137. package/Source/DataSources/BoxGraphics.js +1 -1
  138. package/Source/DataSources/CallbackPositionProperty.js +1 -1
  139. package/Source/DataSources/CorridorGraphics.js +1 -1
  140. package/Source/DataSources/CzmlDataSource.js +1 -1
  141. package/Source/DataSources/EllipseGraphics.js +1 -1
  142. package/Source/DataSources/EllipsoidGraphics.js +1 -1
  143. package/Source/DataSources/Entity.js +1 -1
  144. package/Source/DataSources/EntityCluster.js +2 -2
  145. package/Source/DataSources/GeoJsonDataSource.js +2 -2
  146. package/Source/DataSources/GpxDataSource.js +1 -1
  147. package/Source/DataSources/KmlDataSource.js +1 -1
  148. package/Source/DataSources/KmlTour.js +1 -1
  149. package/Source/DataSources/LabelGraphics.js +1 -1
  150. package/Source/DataSources/ModelGraphics.js +1 -1
  151. package/Source/DataSources/PlaneGraphics.js +1 -1
  152. package/Source/DataSources/PolygonGraphics.js +1 -1
  153. package/Source/DataSources/PolylineGraphics.js +1 -1
  154. package/Source/DataSources/PolylineVolumeGraphics.js +1 -1
  155. package/Source/DataSources/RectangleGraphics.js +1 -1
  156. package/Source/DataSources/WallGraphics.js +1 -1
  157. package/Source/DataSources/exportKml.js +1 -1
  158. package/Source/Renderer/Context.js +11 -10
  159. package/Source/Renderer/ContextLimits.js +66 -33
  160. package/Source/Renderer/ShaderDestination.js +54 -13
  161. package/Source/Renderer/ShaderSource.js +19 -18
  162. package/Source/Renderer/Texture.js +1 -1
  163. package/Source/Renderer/Texture3D.js +166 -7
  164. package/Source/Renderer/TextureAtlas.js +2 -2
  165. package/Source/Scene/Appearance.js +1 -1
  166. package/Source/Scene/ArcGisMapService.js +1 -1
  167. package/Source/Scene/Billboard.js +8 -5
  168. package/Source/Scene/BillboardCollection.js +65 -26
  169. package/Source/Scene/BillboardTexture.js +4 -1
  170. package/Source/Scene/BufferLoader.js +65 -74
  171. package/Source/Scene/Camera.js +13 -2
  172. package/Source/Scene/ClippingPlaneCollection.js +2 -2
  173. package/Source/Scene/CloudCollection.js +2 -2
  174. package/Source/Scene/CubeMapPanorama.js +351 -0
  175. package/Source/Scene/CumulusCloud.js +1 -1
  176. package/Source/Scene/DerivedCommand.js +8 -31
  177. package/Source/Scene/DracoLoader.js +79 -78
  178. package/Source/Scene/DynamicEnvironmentMapManager.js +41 -26
  179. package/Source/Scene/EquirectangularPanorama.js +264 -0
  180. package/Source/Scene/Fog.js +1 -1
  181. package/Source/Scene/FrameState.js +7 -0
  182. package/Source/Scene/GaussianSplatPrimitive.js +907 -168
  183. package/Source/Scene/Globe.js +3 -10
  184. package/Source/Scene/GlobeSurfaceShaderSet.js +36 -32
  185. package/Source/Scene/GltfBufferViewLoader.js +109 -118
  186. package/Source/Scene/GltfDracoLoader.js +167 -176
  187. package/Source/Scene/GltfImageLoader.js +91 -101
  188. package/Source/Scene/GltfIndexBufferLoader.js +228 -241
  189. package/Source/Scene/GltfJsonLoader.js +90 -99
  190. package/Source/Scene/GltfLoader.js +323 -324
  191. package/Source/Scene/GltfSpzLoader.js +127 -134
  192. package/Source/Scene/GltfStructuralMetadataLoader.js +181 -186
  193. package/Source/Scene/GltfTextureLoader.js +217 -231
  194. package/Source/Scene/GltfVertexBufferLoader.js +267 -276
  195. package/Source/Scene/GoogleStreetViewCubeMapPanoramaProvider.js +341 -0
  196. package/Source/Scene/ImageBasedLighting.js +2 -2
  197. package/Source/Scene/ImageryLayerCollection.js +2 -2
  198. package/Source/Scene/ImageryProvider.js +2 -2
  199. package/Source/Scene/Label.js +7 -5
  200. package/Source/Scene/LabelCollection.js +60 -2
  201. package/Source/Scene/Material.js +1 -1
  202. package/Source/Scene/MaterialAppearance.js +1 -1
  203. package/Source/Scene/Megatexture.js +174 -242
  204. package/Source/Scene/MetadataClassProperty.js +212 -7
  205. package/Source/Scene/MetadataComponentType.js +162 -127
  206. package/Source/Scene/MetadataSchemaLoader.js +60 -67
  207. package/Source/Scene/MetadataTable.js +14 -0
  208. package/Source/Scene/MetadataTableProperty.js +14 -0
  209. package/Source/Scene/Model/B3dmLoader.js +216 -224
  210. package/Source/Scene/Model/CustomShader.js +6 -1
  211. package/Source/Scene/Model/CustomShaderPipelineStage.js +122 -7
  212. package/Source/Scene/Model/GeoJsonLoader.js +53 -61
  213. package/Source/Scene/Model/GeometryPipelineStage.js +17 -3
  214. package/Source/Scene/Model/I3dmLoader.js +232 -240
  215. package/Source/Scene/Model/MaterialPipelineStage.js +17 -0
  216. package/Source/Scene/Model/MetadataPipelineStage.js +438 -22
  217. package/Source/Scene/Model/Model.js +1 -1
  218. package/Source/Scene/Model/PntsLoader.js +78 -89
  219. package/Source/Scene/ModelComponents.js +10 -0
  220. package/Source/Scene/Panorama.js +53 -0
  221. package/Source/Scene/PanoramaProvider.js +43 -0
  222. package/Source/Scene/ParticleSystem.js +2 -2
  223. package/Source/Scene/PointPrimitive.js +1 -1
  224. package/Source/Scene/PointPrimitiveCollection.js +14 -22
  225. package/Source/Scene/Polyline.js +0 -1
  226. package/Source/Scene/PolylineCollection.js +1 -4
  227. package/Source/Scene/PolylineColorAppearance.js +1 -6
  228. package/Source/Scene/PolylineMaterialAppearance.js +1 -6
  229. package/Source/Scene/PostProcessStageCollection.js +1 -1
  230. package/Source/Scene/PropertyTable.js +43 -0
  231. package/Source/Scene/PropertyTexture.js +1 -1
  232. package/Source/Scene/PropertyTextureProperty.js +0 -97
  233. package/Source/Scene/QuadtreePrimitive.js +6 -3
  234. package/Source/Scene/ResourceLoader.js +84 -92
  235. package/Source/Scene/Scene.js +12 -0
  236. package/Source/Scene/ShadowMap.js +1 -2
  237. package/Source/Scene/SkyBox.js +29 -164
  238. package/Source/Scene/StructuralMetadata.js +18 -3
  239. package/Source/Scene/Vector3DTileClampedPolylines.js +1 -5
  240. package/Source/Scene/Vector3DTilePolylines.js +1 -5
  241. package/Source/Scene/VoxelPrimitive.js +16 -33
  242. package/Source/Scene/VoxelRenderResources.js +1 -8
  243. package/Source/Scene/VoxelTraversal.js +16 -61
  244. package/Source/Scene/WebMapTileServiceImageryProvider.js +1 -1
  245. package/Source/Scene/createElevationBandMaterial.js +1 -1
  246. package/Source/Scene/parseStructuralMetadata.js +244 -0
  247. package/Source/Scene/processVoxelProperties.js +1 -1
  248. package/Source/Shaders/BillboardCollectionFS.glsl +66 -40
  249. package/Source/Shaders/BillboardCollectionFS.js +67 -40
  250. package/Source/Shaders/BillboardCollectionVS.glsl +22 -31
  251. package/Source/Shaders/BillboardCollectionVS.js +22 -31
  252. package/Source/Shaders/Builtin/CzmBuiltins.js +4 -0
  253. package/Source/Shaders/Builtin/Functions/columbusViewMorph.glsl +8 -1
  254. package/Source/Shaders/Builtin/Functions/columbusViewMorph.js +8 -1
  255. package/Source/Shaders/Builtin/Functions/decodeRGB8.glsl +22 -0
  256. package/Source/Shaders/Builtin/Functions/decodeRGB8.js +24 -0
  257. package/Source/Shaders/Builtin/Functions/unpackTexture.glsl +35 -0
  258. package/Source/Shaders/Builtin/Functions/unpackTexture.js +37 -0
  259. package/Source/Shaders/CubeMapPanoramaVS.glsl +11 -0
  260. package/Source/Shaders/CubeMapPanoramaVS.js +13 -0
  261. package/Source/Shaders/Model/MetadataStageFS.glsl +2 -1
  262. package/Source/Shaders/Model/MetadataStageFS.js +2 -1
  263. package/Source/Shaders/Model/MetadataStageVS.glsl +2 -1
  264. package/Source/Shaders/Model/MetadataStageVS.js +2 -1
  265. package/Source/Shaders/Model/ModelFS.glsl +9 -1
  266. package/Source/Shaders/Model/ModelFS.js +9 -1
  267. package/Source/Shaders/Model/ModelVS.glsl +4 -2
  268. package/Source/Shaders/Model/ModelVS.js +4 -2
  269. package/Source/Shaders/PointPrimitiveCollectionVS.glsl +8 -39
  270. package/Source/Shaders/PointPrimitiveCollectionVS.js +8 -39
  271. package/Source/Shaders/Voxels/IntersectionUtils.glsl +1 -1
  272. package/Source/Shaders/Voxels/IntersectionUtils.js +1 -1
  273. package/Source/Shaders/Voxels/Megatexture.glsl +15 -83
  274. package/Source/Shaders/Voxels/Megatexture.js +15 -83
  275. package/Source/Shaders/Voxels/Octree.glsl +6 -9
  276. package/Source/Shaders/Voxels/Octree.js +6 -9
  277. package/Source/Widget/CesiumWidget.js +1 -1
  278. package/Source/Workers/incrementallyBuildTerrainPicker.js +16 -2
  279. package/index.d.ts +582 -193
  280. package/index.js +91 -83
  281. package/package.json +2 -1
  282. package/Build/Workers/chunk-ZGWX2R5I.js +0 -1443
@@ -6,94 +6,95 @@ import TaskProcessor from "../Core/TaskProcessor.js";
6
6
  /**
7
7
  * @private
8
8
  */
9
- function DracoLoader() {}
9
+ class DracoLoader {
10
+ static _getDecoderTaskProcessor() {
11
+ if (!defined(DracoLoader._decoderTaskProcessor)) {
12
+ const processor = new TaskProcessor(
13
+ "decodeDraco",
14
+ DracoLoader._maxDecodingConcurrency,
15
+ );
16
+ processor
17
+ .initWebAssemblyModule({
18
+ wasmBinaryFile: "ThirdParty/draco_decoder.wasm",
19
+ })
20
+ .then(function (result) {
21
+ if (result) {
22
+ DracoLoader._taskProcessorReady = true;
23
+ } else {
24
+ DracoLoader._error = new RuntimeError(
25
+ "Draco decoder could not be initialized.",
26
+ );
27
+ }
28
+ })
29
+ .catch((error) => {
30
+ DracoLoader._error = error;
31
+ });
32
+ DracoLoader._decoderTaskProcessor = processor;
33
+ }
10
34
 
11
- // Maximum concurrency to use when decoding draco models
12
- DracoLoader._maxDecodingConcurrency = Math.max(
13
- FeatureDetection.hardwareConcurrency - 1,
14
- 1,
15
- );
16
-
17
- // Exposed for testing purposes
18
- DracoLoader._decoderTaskProcessor = undefined;
19
- DracoLoader._taskProcessorReady = false;
20
- DracoLoader._error = undefined;
21
- DracoLoader._getDecoderTaskProcessor = function () {
22
- if (!defined(DracoLoader._decoderTaskProcessor)) {
23
- const processor = new TaskProcessor(
24
- "decodeDraco",
25
- DracoLoader._maxDecodingConcurrency,
26
- );
27
- processor
28
- .initWebAssemblyModule({
29
- wasmBinaryFile: "ThirdParty/draco_decoder.wasm",
30
- })
31
- .then(function (result) {
32
- if (result) {
33
- DracoLoader._taskProcessorReady = true;
34
- } else {
35
- DracoLoader._error = new RuntimeError(
36
- "Draco decoder could not be initialized.",
37
- );
38
- }
39
- })
40
- .catch((error) => {
41
- DracoLoader._error = error;
42
- });
43
- DracoLoader._decoderTaskProcessor = processor;
35
+ return DracoLoader._decoderTaskProcessor;
44
36
  }
45
37
 
46
- return DracoLoader._decoderTaskProcessor;
47
- };
38
+ /**
39
+ * Decodes a compressed point cloud. Returns undefined if the task cannot be scheduled.
40
+ * @private
41
+ *
42
+ * @exception {RuntimeError} Draco decoder could not be initialized.
43
+ */
44
+ static decodePointCloud(parameters) {
45
+ const decoderTaskProcessor = DracoLoader._getDecoderTaskProcessor();
46
+ if (defined(DracoLoader._error)) {
47
+ throw DracoLoader._error;
48
+ }
48
49
 
49
- /**
50
- * Decodes a compressed point cloud. Returns undefined if the task cannot be scheduled.
51
- * @private
52
- *
53
- * @exception {RuntimeError} Draco decoder could not be initialized.
54
- */
55
- DracoLoader.decodePointCloud = function (parameters) {
56
- const decoderTaskProcessor = DracoLoader._getDecoderTaskProcessor();
57
- if (defined(DracoLoader._error)) {
58
- throw DracoLoader._error;
50
+ if (!DracoLoader._taskProcessorReady) {
51
+ // The task processor is not ready to schedule tasks
52
+ return;
53
+ }
54
+ return decoderTaskProcessor.scheduleTask(parameters, [
55
+ parameters.buffer.buffer,
56
+ ]);
59
57
  }
60
58
 
61
- if (!DracoLoader._taskProcessorReady) {
62
- // The task processor is not ready to schedule tasks
63
- return;
64
- }
65
- return decoderTaskProcessor.scheduleTask(parameters, [
66
- parameters.buffer.buffer,
67
- ]);
68
- };
59
+ /**
60
+ * Decodes a buffer view. Returns undefined if the task cannot be scheduled.
61
+ *
62
+ * @param {object} options Object with the following properties:
63
+ * @param {Uint8Array} options.array The typed array containing the buffer view data.
64
+ * @param {object} options.bufferView The glTF buffer view object.
65
+ * @param {Object<string, number>} options.compressedAttributes The compressed attributes.
66
+ * @param {boolean} options.dequantizeInShader Whether POSITION and NORMAL attributes should be dequantized on the GPU.
67
+ *
68
+ * @returns {Promise} A promise that resolves to the decoded indices and attributes.
69
+ * @private
70
+ *
71
+ * @exception {RuntimeError} Draco decoder could not be initialized.
72
+ */
73
+ static decodeBufferView(options) {
74
+ const decoderTaskProcessor = DracoLoader._getDecoderTaskProcessor();
69
75
 
70
- /**
71
- * Decodes a buffer view. Returns undefined if the task cannot be scheduled.
72
- *
73
- * @param {object} options Object with the following properties:
74
- * @param {Uint8Array} options.array The typed array containing the buffer view data.
75
- * @param {object} options.bufferView The glTF buffer view object.
76
- * @param {Object<string, number>} options.compressedAttributes The compressed attributes.
77
- * @param {boolean} options.dequantizeInShader Whether POSITION and NORMAL attributes should be dequantized on the GPU.
78
- *
79
- * @returns {Promise} A promise that resolves to the decoded indices and attributes.
80
- * @private
81
- *
82
- * @exception {RuntimeError} Draco decoder could not be initialized.
83
- */
84
- DracoLoader.decodeBufferView = function (options) {
85
- const decoderTaskProcessor = DracoLoader._getDecoderTaskProcessor();
76
+ if (defined(DracoLoader._error)) {
77
+ throw DracoLoader._error;
78
+ }
86
79
 
87
- if (defined(DracoLoader._error)) {
88
- throw DracoLoader._error;
89
- }
80
+ if (!DracoLoader._taskProcessorReady) {
81
+ // The task processor is not ready to schedule tasks
82
+ return;
83
+ }
90
84
 
91
- if (!DracoLoader._taskProcessorReady) {
92
- // The task processor is not ready to schedule tasks
93
- return;
85
+ return decoderTaskProcessor.scheduleTask(options, [options.array.buffer]);
94
86
  }
87
+ }
88
+
89
+ // Maximum concurrency to use when decoding draco models
90
+ DracoLoader._maxDecodingConcurrency = Math.max(
91
+ FeatureDetection.hardwareConcurrency - 1,
92
+ 1,
93
+ );
95
94
 
96
- return decoderTaskProcessor.scheduleTask(options, [options.array.buffer]);
97
- };
95
+ // Exposed for testing purposes
96
+ DracoLoader._decoderTaskProcessor = undefined;
97
+ DracoLoader._taskProcessorReady = false;
98
+ DracoLoader._error = undefined;
98
99
 
99
100
  export default DracoLoader;
@@ -33,7 +33,7 @@ import ConvolveSpecularMapVS from "../Shaders/ConvolveSpecularMapVS.js";
33
33
  * @typedef {object} DynamicEnvironmentMapManager.ConstructorOptions
34
34
  * Options for the DynamicEnvironmentMapManager constructor
35
35
  * @property {boolean} [enabled=true] If true, the environment map and related properties will continue to update.
36
- * @property {number} [mipmapLevels=7] The number of mipmap levels to generate for specular maps. More mipmap levels will produce a higher resolution specular reflection.
36
+ * @property {number} [mipmapLevels=7] The maximum desired number of mipmap levels to generate for specular maps. More mipmap levels will produce a higher resolution specular reflection. The actual number of mipmaps used will be bounded by the cubemap texture size supported on the client machine. The number of mipmaps must be at least one for the environment map to be generated.
37
37
  * @property {number} [maximumSecondsDifference=3600] The maximum amount of elapsed seconds before a new environment map is created.
38
38
  * @property {number} [maximumPositionEpsilon=1000] The maximum difference in position before a new environment map is created, in meters. Small differences in position will not visibly affect results.
39
39
  * @property {number} [atmosphereScatteringIntensity=2.0] The intensity of the scattered light emitted from the atmosphere. This should be adjusted relative to the value of {@link Scene.light} intensity.
@@ -81,14 +81,21 @@ function DynamicEnvironmentMapManager(options) {
81
81
 
82
82
  options = options ?? Frozen.EMPTY_OBJECT;
83
83
 
84
- const mipmapLevels = Math.min(
85
- options.mipmapLevels ?? 7,
86
- Math.log2(ContextLimits.maximumCubeMapSize),
84
+ const mipmapLevels = Math.max(
85
+ Math.floor(
86
+ Math.min(
87
+ options.mipmapLevels ?? 7,
88
+ Math.log2(ContextLimits.maximumCubeMapSize),
89
+ ),
90
+ ),
91
+ 0,
87
92
  );
88
93
 
89
94
  this._mipmapLevels = mipmapLevels;
95
+
96
+ const arrayLength = Math.max(mipmapLevels - 1, 0) * 6;
90
97
  this._radianceMapComputeCommands = new Array(6);
91
- this._convolutionComputeCommands = new Array((mipmapLevels - 1) * 6);
98
+ this._convolutionComputeCommands = new Array(arrayLength);
92
99
  this._irradianceComputeCommand = undefined;
93
100
 
94
101
  this._radianceMapFS = undefined;
@@ -97,7 +104,7 @@ function DynamicEnvironmentMapManager(options) {
97
104
  this._va = undefined;
98
105
 
99
106
  this._radianceMapTextures = new Array(6);
100
- this._specularMapTextures = new Array((mipmapLevels - 1) * 6);
107
+ this._specularMapTextures = new Array(arrayLength);
101
108
  this._radianceCubeMap = undefined;
102
109
  this._irradianceMapTexture = undefined;
103
110
 
@@ -105,7 +112,7 @@ function DynamicEnvironmentMapManager(options) {
105
112
  DynamicEnvironmentMapManager.DEFAULT_SPHERICAL_HARMONIC_COEFFICIENTS.slice();
106
113
 
107
114
  this._lastTime = new JulianDate();
108
- const width = Math.pow(2, mipmapLevels - 1);
115
+ const width = Math.max(Math.pow(2, mipmapLevels - 1), 1);
109
116
  this._textureDimensions = new Cartesian2(width, width);
110
117
 
111
118
  this._radiiAndDynamicAtmosphereColor = new Cartesian3();
@@ -621,6 +628,28 @@ function updateSpecularMaps(manager, frameState) {
621
628
  const context = frameState.context;
622
629
 
623
630
  let facesCopied = 0;
631
+ const checkComplete = () => {
632
+ // All faces for each mipmap level have been copied
633
+ const length = manager._specularMapTextures.length;
634
+ if (facesCopied >= length) {
635
+ manager._irradianceCommandDirty = true;
636
+
637
+ if (mipmapLevels > 1) {
638
+ radianceCubeMap.sampler = new Sampler({
639
+ minificationFilter: TextureMinificationFilter.LINEAR_MIPMAP_LINEAR,
640
+ });
641
+
642
+ manager._shouldRegenerateShaders = true;
643
+
644
+ // Cleanup shared resources
645
+ manager._va.destroy();
646
+ manager._va = undefined;
647
+ manager._convolveSP.destroy();
648
+ manager._convolveSP = undefined;
649
+ }
650
+ }
651
+ };
652
+
624
653
  const getPostExecute = (command, index, texture, face, level) => () => {
625
654
  if (manager.isDestroyed() || command.canceled) {
626
655
  DynamicEnvironmentMapManager._activeComputeCommandCount--;
@@ -638,22 +667,7 @@ function updateSpecularMaps(manager, frameState) {
638
667
  texture.destroy();
639
668
  manager._specularMapTextures[index] = undefined;
640
669
 
641
- // All faces for each mipmap level have been copied
642
- const length = manager._specularMapTextures.length;
643
- if (facesCopied >= length) {
644
- manager._irradianceCommandDirty = true;
645
- radianceCubeMap.sampler = new Sampler({
646
- minificationFilter: TextureMinificationFilter.LINEAR_MIPMAP_LINEAR,
647
- });
648
-
649
- manager._shouldRegenerateShaders = true;
650
-
651
- // Cleanup shared resources
652
- manager._va.destroy();
653
- manager._va = undefined;
654
- manager._convolveSP.destroy();
655
- manager._convolveSP = undefined;
656
- }
670
+ checkComplete();
657
671
  };
658
672
 
659
673
  let index = 0;
@@ -721,6 +735,7 @@ function updateSpecularMaps(manager, frameState) {
721
735
  width /= 2;
722
736
  height /= 2;
723
737
  }
738
+ checkComplete();
724
739
  }
725
740
 
726
741
  const irradianceTextureDimensions = new Cartesian2(3, 3); // 9 coefficients
@@ -839,9 +854,9 @@ function updateSphericalHarmonicCoefficients(manager, frameState) {
839
854
  DynamicEnvironmentMapManager.prototype.update = function (frameState) {
840
855
  const mode = frameState.mode;
841
856
  const isSupported =
842
- // A FrameState type works here because the function only references the context parameter.
843
- // @ts-ignore
844
- DynamicEnvironmentMapManager.isDynamicUpdateSupported(frameState);
857
+ // @ts-expect-error A FrameState type works here because the function only references the context parameter.
858
+ DynamicEnvironmentMapManager.isDynamicUpdateSupported(frameState) &&
859
+ this._mipmapLevels >= 1;
845
860
 
846
861
  if (
847
862
  !isSupported ||
@@ -0,0 +1,264 @@
1
+ import Frozen from "../Core/Frozen.js";
2
+ import defined from "../Core/defined.js";
3
+ import DeveloperError from "../Core/DeveloperError.js";
4
+ import Credit from "../Core/Credit.js";
5
+ import Matrix4 from "../Core/Matrix4.js";
6
+ import Cartesian2 from "../Core/Cartesian2.js";
7
+ import SphereGeometry from "../Core/SphereGeometry.js";
8
+ import GeometryInstance from "../Core/GeometryInstance.js";
9
+ import Material from "./Material.js";
10
+ import MaterialAppearance from "./MaterialAppearance.js";
11
+ import Primitive from "./Primitive.js";
12
+ import VertexFormat from "../Core/VertexFormat.js";
13
+ import destroyObject from "../Core/destroyObject.js";
14
+
15
+ const DEFAULT_RADIUS = 100000.0;
16
+
17
+ /**
18
+ * @typedef {object} EquirectangularPanorama.ConstructorOptions
19
+ *
20
+ * Initialization options for the EquirectangularPanorama constructor
21
+ *
22
+ * @property {Matrix4} options.transform A 4x4 transformation matrix that defines the panorama’s position and orientation
23
+ * (for example, derived from a position and heading-pitch-roll).
24
+ * @property {string|HTMLImageElement|HTMLCanvasElement|ImageBitmap} options.image A URL to an image resource, or a preloaded image object.
25
+ * @property {number} [options.radius=100000.0] The radius of the panorama in meters.
26
+ * @property {number} [options.repeatHorizontal=1.0] The number of times to repeat the texture horizontally.
27
+ * @property {number} [options.repeatVertical=1.0] The number of times to repeat the texture vertically.
28
+ * @property {Credit|string} [options.credit] A credit for the panorama, which is displayed on the canvas.
29
+ */
30
+
31
+ /**
32
+ * A {@link Panorama} that displays imagery in equirectangular format in a scene.
33
+ *
34
+ * @alias EquirectangularPanorama
35
+ * @constructor
36
+ *
37
+ * @param {EquirectangularPanorama.ConstructorOptions} options Object describing initialization options
38
+ *
39
+ * @example
40
+ * const position = Cesium.Cartesian3.fromDegrees(
41
+ * -75.1699, // longitude
42
+ * 39.9522, // latitude
43
+ * 100.0 // height in meters
44
+ * );
45
+ *
46
+ * const heading = Cesium.Math.toRadians(45.0); // rotation about up axis
47
+ * const pitch = Cesium.Math.toRadians(-30.0); // pitch (negative looks down)
48
+ * const roll = Cesium.Math.toRadians(10.0); // roll about forward axis
49
+ *
50
+ * const hpr = new Cesium.HeadingPitchRoll(
51
+ * heading,
52
+ * pitch,
53
+ * roll
54
+ * );
55
+ *
56
+ * const modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(
57
+ * position,
58
+ * hpr,
59
+ * Cesium.Ellipsoid.WGS84,
60
+ * Cesium.Transforms.eastNorthUpToFixedFrame
61
+ * );
62
+ *
63
+ * scene.primitives.add(new Cesium.EquirectangularPanorama({
64
+ * transform: modelMatrix,
65
+ * image: 'path/to/image',
66
+ * }));
67
+ *
68
+ * @demo {@link https://sandcastle.cesium.com/index.html?id=panorama|Cesium Sandcastle Panorama}
69
+ */
70
+ function EquirectangularPanorama(options) {
71
+ options = options ?? Frozen.EMPTY_OBJECT;
72
+
73
+ //>>includeStart('debug', pragmas.debug);
74
+ if (!defined(options.image)) {
75
+ throw new DeveloperError("options.image is required.");
76
+ }
77
+
78
+ if (defined(options.transform) && !(options.transform instanceof Matrix4)) {
79
+ throw new DeveloperError("options.transform must be a Matrix4.");
80
+ }
81
+ //>>includeEnd('debug');
82
+
83
+ // Credit specified by the user.
84
+ let credit = options.credit;
85
+ if (typeof credit === "string") {
86
+ credit = new Credit(credit);
87
+ }
88
+ this._credit = credit;
89
+
90
+ this._radius = defined(options.radius) ? options.radius : DEFAULT_RADIUS;
91
+ this._image = options.image;
92
+ this._transform = defined(options.transform)
93
+ ? options.transform
94
+ : Matrix4.IDENTITY;
95
+ this._repeatHorizontal = defined(options.repeatHorizontal)
96
+ ? options.repeatHorizontal
97
+ : 1.0;
98
+ this._repeatVertical = defined(options.repeatVertical)
99
+ ? options.repeatVertical
100
+ : 1.0;
101
+
102
+ const geometry = new SphereGeometry({
103
+ radius: this._radius,
104
+ vertexFormat: VertexFormat.ALL,
105
+ });
106
+
107
+ const geometryInstance = new GeometryInstance({
108
+ geometry: geometry,
109
+ modelMatrix: this._transform,
110
+ });
111
+
112
+ const equirectangularMaterial = new Material({
113
+ fabric: {
114
+ type: "Image",
115
+ uniforms: {
116
+ image: this._image, // 2:1 360 degrees equirectangular image path
117
+ repeat: new Cartesian2(-this._repeatHorizontal, this._repeatVertical), // flip horizontally by default to match expected orientation of images inside a sphere, but allow user to override
118
+ },
119
+ },
120
+ });
121
+
122
+ // Create the primitive with the material
123
+ this._primitive = new Primitive({
124
+ geometryInstances: geometryInstance,
125
+ appearance: new MaterialAppearance({
126
+ material: equirectangularMaterial,
127
+ closed: true,
128
+ faceForward: false,
129
+ translucent: false,
130
+ renderState: {
131
+ cull: {
132
+ enabled: false, // show inside of sphere
133
+ },
134
+ },
135
+ }),
136
+ credit: this._credit,
137
+ });
138
+
139
+ return this;
140
+ }
141
+
142
+ Object.defineProperties(EquirectangularPanorama.prototype, {
143
+ /**
144
+ * Gets the radius of the panorama.
145
+ * @memberof EquirectangularPanorama.prototype
146
+ * @type {number}
147
+ * @readonly
148
+ */
149
+ radius: {
150
+ get: function () {
151
+ return this._radius;
152
+ },
153
+ },
154
+
155
+ /**
156
+ * Gets the source image of the panorama.
157
+ * @memberof EquirectangularPanorama.prototype
158
+ * @type {string|HTMLImageElement|HTMLCanvasElement|ImageBitmap}
159
+ * @readonly
160
+ */
161
+ image: {
162
+ get: function () {
163
+ return this._image;
164
+ },
165
+ },
166
+
167
+ /**
168
+ * Gets the transform of the panorama.
169
+ * @memberof EquirectangularPanorama.prototype
170
+ * @type {Matrix4}
171
+ * @readonly
172
+ */
173
+ transform: {
174
+ get: function () {
175
+ return this._transform;
176
+ },
177
+ },
178
+
179
+ /**
180
+ * Gets the credits of the panorama.
181
+ * @memberof EquirectangularPanorama.prototype
182
+ * @type {Credit}
183
+ * @readonly
184
+ */
185
+ credit: {
186
+ get: function () {
187
+ return defined(this._credit) ? this._credit : undefined;
188
+ },
189
+ },
190
+
191
+ /**
192
+ * Determines if the equirectangular panorama will be shown.
193
+ * @memberof EquirectangularPanorama.prototype
194
+ * @type {boolean}
195
+ */
196
+ show: {
197
+ get: function () {
198
+ return defined(this._primitive) ? this._primitive.show : undefined;
199
+ },
200
+ set: function (value) {
201
+ if (defined(this._primitive)) {
202
+ this._primitive.show = value;
203
+ }
204
+ },
205
+ },
206
+ });
207
+
208
+ // Proxy update/destroy/etc to the primitive
209
+
210
+ /**
211
+ * Called when {@link Viewer} or {@link CesiumWidget} render the scene to
212
+ * get the draw commands needed to render this primitive.
213
+ * <p>
214
+ * Do not call this function directly. This is documented just to
215
+ * list the exceptions that may be propagated when the scene is rendered:
216
+ * </p>
217
+ *
218
+ */
219
+ EquirectangularPanorama.prototype.update = function (frameState) {
220
+ if (defined(this._credit)) {
221
+ frameState.creditDisplay.addCreditToNextFrame(this._credit);
222
+ }
223
+
224
+ return this._primitive.update(frameState);
225
+ };
226
+
227
+ /**
228
+ * Destroys the WebGL resources held by this object. Destroying an object allows for deterministic
229
+ * release of WebGL resources, instead of relying on the garbage collector to destroy this object.
230
+ * <br /><br />
231
+ * Once an object is destroyed, it should not be used; calling any function other than
232
+ * <code>isDestroyed</code> will result in a {@link DeveloperError} exception. Therefore,
233
+ * assign the return value (<code>undefined</code>) to the object as done in the example.
234
+ *
235
+ * @exception {DeveloperError} This object was destroyed, i.e., destroy() was called.
236
+ *
237
+ *
238
+ * @example
239
+ * equirectangularPanorama = equirectangularPanorama && equirectangularPanorama.destroy();
240
+ *
241
+ * @see EquirectangularPanorama#isDestroyed
242
+ */
243
+ EquirectangularPanorama.prototype.destroy = function () {
244
+ this._primitive = this._primitive && this._primitive.destroy();
245
+ return destroyObject(this);
246
+ };
247
+
248
+ /**
249
+ * Returns true if this object was destroyed; otherwise, false.
250
+ * <br /><br />
251
+ * If this object was destroyed, it should not be used; calling any function other than
252
+ * <code>isDestroyed</code> will result in a {@link DeveloperError} exception.
253
+ *
254
+ * @returns {boolean} <code>true</code> if this object was destroyed; otherwise, <code>false</code>.
255
+ *
256
+ * @see EquirectangularPanorama#destroy
257
+ */
258
+
259
+ EquirectangularPanorama.prototype.isDestroyed = function () {
260
+ return this._primitive.isDestroyed();
261
+ };
262
+
263
+ // Exposed for tests
264
+ export default EquirectangularPanorama;
@@ -8,7 +8,7 @@ import SceneMode from "./SceneMode.js";
8
8
  * Blends the atmosphere to geometry far from the camera for horizon views. Allows for additional
9
9
  * performance improvements by rendering less geometry and dispatching less terrain requests.
10
10
  *
11
- * @demo {@link https://sandcastle.cesium.com/index.html?src=Fog.html|Cesium Sandcastle Fog Demo}
11
+ * @demo {@link https://sandcastle.cesium.com/index.html?id=fog|Cesium Sandcastle Fog Demo}
12
12
  *
13
13
  * @alias Fog
14
14
  * @constructor
@@ -28,6 +28,13 @@ function FrameState(context, creditDisplay, jobScheduler) {
28
28
  */
29
29
  this.commandList = [];
30
30
 
31
+ /**
32
+ * An array of panorama rendering commands.
33
+ *
34
+ * @type {DrawCommand[]}
35
+ */
36
+ this.panoramaCommandList = [];
37
+
31
38
  /**
32
39
  * An array of shadow maps.
33
40
  * @type {ShadowMap[]}