@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
@@ -153,14 +153,11 @@ function getBuiltinsAndAutomaticUniforms(shaderSource) {
153
153
  }
154
154
 
155
155
  function combineShader(shaderSource, isFragmentShader, context) {
156
- let i;
157
- let length;
158
-
159
156
  // Combine shader sources, generally for pseudo-polymorphism, e.g., czm_getMaterial.
160
157
  let combinedSources = "";
161
158
  const sources = shaderSource.sources;
162
159
  if (defined(sources)) {
163
- for (i = 0, length = sources.length; i < length; ++i) {
160
+ for (let i = 0; i < sources.length; ++i) {
164
161
  // #line needs to be on its own line.
165
162
  combinedSources += `\n#line 0\n${sources[i]}`;
166
163
  }
@@ -225,30 +222,34 @@ function combineShader(shaderSource, isFragmentShader, context) {
225
222
  let result = "";
226
223
 
227
224
  const extensionsLength = extensions.length;
228
- for (i = 0; i < extensionsLength; i++) {
225
+ for (let i = 0; i < extensionsLength; i++) {
229
226
  result += extensions[i];
230
227
  }
231
228
 
232
229
  if (isFragmentShader) {
233
- // If high precision isn't support replace occurrences of highp with mediump
234
- // The highp keyword is not always available on older mobile devices
230
+ // If high precision isn't supported, replace occurrences of highp with mediump.
231
+ // The highp keyword is not always available on older mobile devices.
235
232
  // See https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/WebGL_best_practices#In_WebGL_1_highp_float_support_is_optional_in_fragment_shaders
236
- result +=
237
- "\
238
- #ifdef GL_FRAGMENT_PRECISION_HIGH\n\
239
- precision highp float;\n\
240
- precision highp int;\n\
241
- #else\n\
242
- precision mediump float;\n\
243
- precision mediump int;\n\
244
- #define highp mediump\n\
245
- #endif\n\n";
233
+ result += `
234
+ #ifdef GL_FRAGMENT_PRECISION_HIGH
235
+ precision highp float;
236
+ precision highp int;
237
+ #else
238
+ precision mediump float;
239
+ precision mediump int;
240
+ #define highp mediump
241
+ #endif
242
+ `;
243
+ }
244
+
245
+ if (context.webgl2) {
246
+ result += `precision highp sampler3D;\n\n`;
246
247
  }
247
248
 
248
249
  // Prepend #defines for uber-shaders
249
250
  const defines = shaderSource.defines;
250
251
  if (defined(defines)) {
251
- for (i = 0, length = defines.length; i < length; ++i) {
252
+ for (let i = 0, length = defines.length; i < length; ++i) {
252
253
  const define = defines[i];
253
254
  if (define.length !== 0) {
254
255
  result += `#define ${define}\n`;
@@ -398,7 +398,7 @@ function loadBufferSource(texture, source) {
398
398
  * @param {number} xOffset The texel x coordinate of the lower left corner of the subregion of the texture to be updated.
399
399
  * @param {number} yOffset The texel y coordinate of the lower left corner of the subregion of the texture to be updated.
400
400
  * @param {number} width The width of the source data, in pixels.
401
- * @param {number} width The height of the source data, in pixels.
401
+ * @param {number} height The height of the source data, in pixels.
402
402
  *
403
403
  * @private
404
404
  */
@@ -68,7 +68,8 @@ function Texture3D(options) {
68
68
  sampler = new Sampler(),
69
69
  } = options;
70
70
 
71
- if (!context.webgl2) {
71
+ // 3D textures are not supported in a WebGL1 context. But we allow a stub context for testing.
72
+ if (!context.webgl2 && !defined(context.options.getWebGLStub)) {
72
73
  throw new DeveloperError(
73
74
  "WebGL1 does not support texture3D. Please use a WebGL2 context.",
74
75
  );
@@ -113,25 +114,25 @@ function Texture3D(options) {
113
114
 
114
115
  Check.typeOf.number.greaterThan("width", width, 0);
115
116
 
116
- if (width > ContextLimits.maximumTextureSize) {
117
+ if (width > ContextLimits.maximum3DTextureSize) {
117
118
  throw new DeveloperError(
118
- `Width must be less than or equal to the maximum texture3D size (${ContextLimits.maximumTextureSize}). Check maximumTextureSize.`,
119
+ `Width must be less than or equal to the maximum texture3D size (${ContextLimits.maximum3DTextureSize}). Check maximum3DTextureSize.`,
119
120
  );
120
121
  }
121
122
 
122
123
  Check.typeOf.number.greaterThan("height", height, 0);
123
124
 
124
- if (height > ContextLimits.maximumTextureSize) {
125
+ if (height > ContextLimits.maximum3DTextureSize) {
125
126
  throw new DeveloperError(
126
- `Height must be less than or equal to the maximum texture3D size (${ContextLimits.maximumTextureSize}). Check maximumTextureSize.`,
127
+ `Height must be less than or equal to the maximum texture3D size (${ContextLimits.maximum3DTextureSize}). Check maximum3DTextureSize.`,
127
128
  );
128
129
  }
129
130
 
130
131
  Check.typeOf.number.greaterThan("depth", depth, 0);
131
132
 
132
- if (depth > ContextLimits.maximumTextureSize) {
133
+ if (depth > ContextLimits.maximum3DTextureSize) {
133
134
  throw new DeveloperError(
134
- `Depth must be less than or equal to the maximum texture3D size (${ContextLimits.maximumTextureSize}). Check maximumTextureSize.`,
135
+ `Depth must be less than or equal to the maximum texture3D size (${ContextLimits.maximum3DTextureSize}). Check maximum3DTextureSize.`,
135
136
  );
136
137
  }
137
138
 
@@ -333,6 +334,164 @@ function loadBufferSource(texture3D, source) {
333
334
  }
334
335
  }
335
336
 
337
+ /**
338
+ * Copy new image data into this texture, from a source object with width, height, depth, and arrayBufferView properties.
339
+ * @param {object} options Object with the following properties:
340
+ * @param {object} options.source The source object with width, height, depth, and arrayBufferView properties.
341
+ * @param {number} [options.xOffset=0] The offset in the x direction within the texture to copy into.
342
+ * @param {number} [options.yOffset=0] The offset in the y direction within the texture to copy into.
343
+ * @param {number} [options.zOffset=0] The offset in the z direction within the texture to copy into.
344
+ * @param {boolean} [options.skipColorSpaceConversion=false] If true, any custom gamma or color profiles in the texture will be ignored.
345
+ *
346
+ * @exception {DeveloperError} Unsupported copyFrom with a compressed texture pixel format.
347
+ * @exception {DeveloperError} xOffset must be greater than or equal to zero.
348
+ * @exception {DeveloperError} yOffset must be greater than or equal to zero.
349
+ * @exception {DeveloperError} zOffset must be greater than or equal to zero.
350
+ * @exception {DeveloperError} xOffset + source.width must be less than or equal to width.
351
+ * @exception {DeveloperError} yOffset + source.height must be less than or equal to height.
352
+ * @exception {DeveloperError} zOffset + source.depth must be less than or equal to depth.
353
+ * @exception {DeveloperError} This texture was destroyed, i.e., destroy() was called.
354
+ * @private
355
+ * @example
356
+ * texture.copyFrom({
357
+ * source: {
358
+ * width : 1,
359
+ * height : 1,
360
+ * depth : 1,
361
+ * arrayBufferView : new Uint8Array([255, 0, 0, 255])
362
+ * }
363
+ * });
364
+ */
365
+ Texture3D.prototype.copyFrom = function (options) {
366
+ options = options ?? Frozen.EMPTY_OBJECT;
367
+
368
+ const { source, xOffset = 0, yOffset = 0, zOffset = 0 } = options;
369
+
370
+ //>>includeStart('debug', pragmas.debug);
371
+ Check.defined("options.source", source);
372
+ Check.defined("options.source.arrayBufferView", source.arrayBufferView);
373
+ if (PixelFormat.isCompressedFormat(this._pixelFormat)) {
374
+ throw new DeveloperError(
375
+ "Unsupported copyFrom with a compressed texture pixel format.",
376
+ );
377
+ }
378
+ Check.typeOf.number.greaterThanOrEquals("xOffset", xOffset, 0);
379
+ Check.typeOf.number.greaterThanOrEquals("yOffset", yOffset, 0);
380
+ Check.typeOf.number.greaterThanOrEquals("zOffset", zOffset, 0);
381
+ Check.typeOf.number.lessThanOrEquals(
382
+ "xOffset + options.source.width",
383
+ xOffset + source.width,
384
+ this._width,
385
+ );
386
+ Check.typeOf.number.lessThanOrEquals(
387
+ "yOffset + options.source.height",
388
+ yOffset + source.height,
389
+ this._height,
390
+ );
391
+ Check.typeOf.number.lessThanOrEquals(
392
+ "zOffset + options.source.depth",
393
+ zOffset + source.depth,
394
+ this._depth,
395
+ );
396
+ //>>includeEnd('debug');
397
+
398
+ const context = this._context;
399
+ const gl = context._gl;
400
+ const target = this._textureTarget;
401
+
402
+ gl.activeTexture(gl.TEXTURE0);
403
+ gl.bindTexture(target, this._texture);
404
+
405
+ const { width, height, depth } = source;
406
+ let uploaded = false;
407
+ if (!this._initialized) {
408
+ if (
409
+ xOffset === 0 &&
410
+ yOffset === 0 &&
411
+ zOffset === 0 &&
412
+ width === this._width &&
413
+ height === this._height &&
414
+ depth === this._depth
415
+ ) {
416
+ loadBufferSource(this, source);
417
+ uploaded = true;
418
+ } else {
419
+ gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
420
+ gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
421
+ loadNull(this);
422
+ }
423
+ this._initialized = true;
424
+ }
425
+
426
+ if (!uploaded) {
427
+ loadPartialBufferSource(
428
+ this,
429
+ source.arrayBufferView,
430
+ xOffset,
431
+ yOffset,
432
+ zOffset,
433
+ width,
434
+ height,
435
+ depth,
436
+ );
437
+ }
438
+
439
+ gl.bindTexture(target, null);
440
+ };
441
+
442
+ /**
443
+ * Load texel data from a buffer into part of a 3D texture
444
+ *
445
+ * @param {Texture3D} texture3D The texture3D to which texel values will be loaded.
446
+ * @param {TypedArray} arrayBufferView The texel values to be loaded into the texture3D.
447
+ * @param {number} xOffset The texel x coordinate of the lower left corner of the subregion of the texture to be updated.
448
+ * @param {number} yOffset The texel y coordinate of the lower left corner of the subregion of the texture to be updated.
449
+ * @param {number} zOffset The texel z coordinate of the lower left corner of the subregion of the texture to be updated.
450
+ * @param {number} width The width of the source data, in pixels.
451
+ * @param {number} height The height of the source data, in pixels.
452
+ * @param {number} depth The depth of the source data, in pixels.
453
+ *
454
+ * @private
455
+ */
456
+ function loadPartialBufferSource(
457
+ texture3D,
458
+ arrayBufferView,
459
+ xOffset,
460
+ yOffset,
461
+ zOffset,
462
+ width,
463
+ height,
464
+ depth,
465
+ ) {
466
+ const context = texture3D._context;
467
+ const gl = context._gl;
468
+
469
+ const { pixelFormat, pixelDatatype } = texture3D;
470
+
471
+ const unpackAlignment = PixelFormat.alignmentInBytes(
472
+ pixelFormat,
473
+ pixelDatatype,
474
+ width,
475
+ );
476
+ gl.pixelStorei(gl.UNPACK_ALIGNMENT, unpackAlignment);
477
+ gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
478
+ gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
479
+
480
+ gl.texSubImage3D(
481
+ texture3D._textureTarget,
482
+ 0,
483
+ xOffset,
484
+ yOffset,
485
+ zOffset,
486
+ width,
487
+ height,
488
+ depth,
489
+ pixelFormat,
490
+ PixelDatatype.toWebGLConstant(pixelDatatype, context),
491
+ arrayBufferView,
492
+ );
493
+ }
494
+
336
495
  /**
337
496
  * Compute a dimension of the image for the next mip level.
338
497
  *
@@ -641,7 +641,7 @@ async function resolveImage(image, id) {
641
641
  * or a URL to an Image, or a Promise for an image, or a function that creates an image.
642
642
  * @param {number} width A number specifying the width of the texture. If undefined, the image width will be used.
643
643
  * @param {number} height A number specifying the height of the texture. If undefined, the image height will be used.
644
- * @returns {Promise<number>} A Promise that resolves to the image region index, or -1 if resources are in the process of being destroyed.
644
+ * @returns {Promise<number> | number} The image region index or a promise that resolves to it. -1 is returned if resources are in the process of being destroyed.
645
645
  */
646
646
  TextureAtlas.prototype.addImage = function (id, image, width, height) {
647
647
  //>>includeStart('debug', pragmas.debug);
@@ -657,7 +657,7 @@ TextureAtlas.prototype.addImage = function (id, image, width, height) {
657
657
  }
658
658
  if (defined(index)) {
659
659
  // This image has already been added and resolved
660
- return Promise.resolve(index);
660
+ return index;
661
661
  }
662
662
 
663
663
  index = this._nextIndex++;
@@ -28,7 +28,7 @@ import CullFace from "./CullFace.js";
28
28
  * @see PolylineColorAppearance
29
29
  * @see PolylineMaterialAppearance
30
30
  *
31
- * @demo {@link https://sandcastle.cesium.com/index.html?src=Geometry%20and%20Appearances.html|Geometry and Appearances Demo}
31
+ * @demo {@link https://sandcastle.cesium.com/index.html?id=geometry-and-appearances|Geometry and Appearances Demo}
32
32
  */
33
33
  function Appearance(options) {
34
34
  options = options ?? Frozen.EMPTY_OBJECT;
@@ -4,7 +4,7 @@ import Resource from "../Core/Resource.js";
4
4
 
5
5
  let defaultTokenCredit;
6
6
  const defaultAccessToken =
7
- "AAPTxy8BH1VEsoebNVZXo8HurEOF051kAEKlhkOhBEc9BmT-YXumqp4JkvycMs8ZG2hKk2SGBrZlhKMqjDAD5-6Bfkm_qv2ikp3Q3QSZyA_gQmxc8WOi5Z38wPaDHFE06ozG_AMTUg2bOPx2B64azLZ2U4MPzYI01EWp4tZnTgEKEBA2S5ip51CE6gSm0glwVGSEMFb3jjJkxH2JvjWM8eU2sTTihBKpJWxbQYppczgBsdw.AT1_YjTi2kjL";
7
+ "AAPTahokHpH_PEeQIduLwb1A8ZA..rA8bGH-48FscqzwJpCALUEqt2P_mHiflgl0WkBvCxPJzsFMRqAukz-mcG8oZ3eKnfk4MHGvCFMNsNrxXb2fGxfKH-3TQxCZVkCycztIPWRM5OIQ7pzTZIBOO9D7N8VXXpyPtp2bSsxWp5dUpv8qsgrfMHU4IXWGiiKWELBnANXn1QgzyLKngOHAgYWUq2OQ2XuULOpwJwOEWpyX5KvoLavJP0LFJdjB08Mmz-wCvnFqwr8CZjFpKaVSbAT1_aZs2dlMP";
8
8
  /**
9
9
  * Default options for accessing the ArcGIS image tile service.
10
10
  *
@@ -52,7 +52,7 @@ import isDataUri from "../Core/isDataUri.js";
52
52
  * @property {NearFarScalar} [pixelOffsetScaleByDistance] A {@link NearFarScalar} Specifying near and far pixel offset scaling properties of a Billboard based on the billboard's distance from the camera.
53
53
  * @property {BoundingRectangle} [imageSubRegion] A {@link BoundingRectangle} Specifying the sub-region of the image to use for the billboard, rather than the entire image.
54
54
  * @property {DistanceDisplayCondition} [distanceDisplayCondition] A {@link DistanceDisplayCondition} Specifying the distance from the camera at which this billboard will be displayed.
55
- * @property {number} [disableDepthTestDistance] A number specifying the distance from the camera at which to disable the depth test to, for example, prevent clipping against terrain.
55
+ * @property {number} [disableDepthTestDistance] The distance from the camera, beyond which, depth testing is disabled—to, for example, prevent clipping against terrain.
56
56
  * @property {SplitDirection} [splitDirection] A {@link SplitDirection} Specifying the split property of the billboard.
57
57
  */
58
58
 
@@ -93,7 +93,7 @@ import isDataUri from "../Core/isDataUri.js";
93
93
  * @param {Billboard.ConstructorOptions} options Object describing initialization options
94
94
  * @param {BillboardCollection} billboardCollection Instance of BillboardCollection
95
95
  *
96
- * @demo {@link https://sandcastle.cesium.com/index.html?src=Billboards.html|Cesium Sandcastle Billboard Demo}
96
+ * @demo {@link https://sandcastle.cesium.com/index.html?id=billboards|Cesium Sandcastle Billboard Demo}
97
97
  */
98
98
  function Billboard(options, billboardCollection) {
99
99
  options = options ?? Frozen.EMPTY_OBJECT;
@@ -845,10 +845,13 @@ Object.defineProperties(Billboard.prototype, {
845
845
  },
846
846
 
847
847
  /**
848
- * Gets or sets the distance from the camera at which to disable the depth test to, for example, prevent clipping against terrain.
849
- * When set to zero, the depth test is always applied. When set to Number.POSITIVE_INFINITY, the depth test is never applied.
848
+ * Gets or sets the distance from the camera, beyond which, depth testing is disbaled—to,
849
+ * for example, prevent clipping against terrain. When set to <code>undefined</code> or
850
+ * <code>0</code>, the depth test is always applied. When set to
851
+ * <code>Number.POSITIVE_INFINITY</code>, the depth test is never applied.
850
852
  * @memberof Billboard.prototype
851
- * @type {number}
853
+ * @type {number|undefined}
854
+ * @default undefined
852
855
  */
853
856
  disableDepthTestDistance: {
854
857
  get: function () {
@@ -118,7 +118,8 @@ const attributeLocationsInstanced = {
118
118
  * is used for rendering both opaque and translucent billboards. However, if either all of the billboards are completely opaque or all are completely translucent,
119
119
  * setting the technique to BlendOption.OPAQUE or BlendOption.TRANSLUCENT can improve performance by up to 2x.
120
120
  * @param {boolean} [options.show=true] Determines if the billboards in the collection will be shown.
121
- *
121
+ * @param {number} [options.coarseDepthTestDistance] The distance from the camera, beyond which, billboards are depth-tested against an approximation of the globe ellipsoid rather than against the full globe depth buffer. If unspecified, the default value is determined relative to the value of {@link Ellipsoid.default}.
122
+ * @param {number} [options.threePointDepthTestDistance] The distance from the camera, within which, billboards with a {@link Billboard#heightReference} value of {@link HeightReference.CLAMP_TO_GROUND} or {@link HeightReference.CLAMP_TO_TERRAIN} are depth tested against three key points. This ensures that if any key point of the billboard is visible, the whole billboard will be visible. If unspecified, the default value is determined relative to the value of {@link Ellipsoid.default}.
122
123
  * @performance For best performance, prefer a few collections, each with many billboards, to
123
124
  * many collections with only a few billboards each. Organize collections so that billboards
124
125
  * with the same update frequency are in the same collection, i.e., billboards that do not
@@ -130,7 +131,7 @@ const attributeLocationsInstanced = {
130
131
  * @see Billboard
131
132
  * @see LabelCollection
132
133
  *
133
- * @demo {@link https://sandcastle.cesium.com/index.html?src=Billboards.html|Cesium Sandcastle Billboard Demo}
134
+ * @demo {@link https://sandcastle.cesium.com/index.html?id=billboards|Cesium Sandcastle Billboard Demo}
134
135
  *
135
136
  * @example
136
137
  * // Create a billboard collection with two billboards
@@ -317,8 +318,11 @@ function BillboardCollection(options) {
317
318
  ];
318
319
 
319
320
  this._highlightColor = Color.clone(Color.WHITE); // Only used by Vector3DTilePoints
320
- this._coarseDepthTestDistance = Ellipsoid.default.minimumRadius / 100;
321
- this._threePointDepthTestDistance = Ellipsoid.default.minimumRadius / 1000;
321
+ this._coarseDepthTestDistance =
322
+ options.coarseDepthTestDistance ?? Ellipsoid.default.minimumRadius / 10.0;
323
+ this._threePointDepthTestDistance =
324
+ options.threePointDepthTestDistance ??
325
+ Ellipsoid.default.minimumRadius / 1000.0;
322
326
 
323
327
  this._uniforms = {
324
328
  u_atlas: () => {
@@ -327,13 +331,9 @@ function BillboardCollection(options) {
327
331
  u_highlightColor: () => {
328
332
  return this._highlightColor;
329
333
  },
330
- // An eye-space distance, beyond which, the billboard is simply tested against a camera-facing plane at the ellipsoid's center,
331
- // rather than against a depth texture. Note: only if the disableDepthTestingDistance property permits.
332
334
  u_coarseDepthTestDistance: () => {
333
335
  return this._coarseDepthTestDistance;
334
336
  },
335
- // Within this distance, if the billboard is clamped to the ground, we'll depth-test 3 key points.
336
- // If any key point is visible, the whole billboard will be visible.
337
337
  u_threePointDepthTestDistance: () => {
338
338
  return this._threePointDepthTestDistance;
339
339
  },
@@ -466,6 +466,56 @@ Object.defineProperties(BillboardCollection.prototype, {
466
466
  return this._billboardTextureCache;
467
467
  },
468
468
  },
469
+
470
+ /**
471
+ * The distance from the camera, beyond which, billboards are depth-tested against an approximation of
472
+ * the globe ellipsoid rather than against the full globe depth buffer. When set to <code>0</code>, the
473
+ * approximate depth test is always applied. When set to <code>Number.POSITIVE_INFINITY</code>, the
474
+ * approximate depth test is never applied.
475
+ * <br/><br/>
476
+ * This setting only applies when a billboard's {@link Billboard#disableDepthTestDistance} value would
477
+ * otherwise allow depth testing—i.e., distance from the camera to the billboard is less than a
478
+ * billboard's {@link Billboard#disableDepthTestDistance} value.
479
+ * @memberof BillboardCollection.prototype
480
+ * @type {number}
481
+ */
482
+ coarseDepthTestDistance: {
483
+ get: function () {
484
+ return this._coarseDepthTestDistance;
485
+ },
486
+ set: function (value) {
487
+ //>>includeStart('debug', pragmas.debug);
488
+ Check.typeOf.number("coarseDepthTestDistance", value);
489
+ //>>includeEnd('debug');
490
+ this._coarseDepthTestDistance = value;
491
+ },
492
+ },
493
+
494
+ /**
495
+ * The distance from the camera, within which, billboards with a {@link Billboard#heightReference} value
496
+ * of {@link HeightReference.CLAMP_TO_GROUND} or {@link HeightReference.CLAMP_TO_TERRAIN} are depth tested
497
+ * against three key points. This ensures that if any key point of the billboard is visible, the whole
498
+ * billboard will be visible. When set to <code>0</code>, this feature is disabled and portions of a
499
+ * billboards behind terrain be clipped.
500
+ * <br/><br/>
501
+ * This setting only applies when a billboard's {@link Billboard#disableDepthTestDistance} value would
502
+ * otherwise allow depth testing—i.e., distance from the camera to the billboard is less than a
503
+ * billboard's {@link Billboard#disableDepthTestDistance} value.
504
+ * @see {@link https://cesium.com/blog/2018/07/30/billboards-on-terrain-improvements/|Billboards and Labels on Terrain Improvements}
505
+ * @memberof BillboardCollection.prototype
506
+ * @type {number}
507
+ */
508
+ threePointDepthTestDistance: {
509
+ get: function () {
510
+ return this._threePointDepthTestDistance;
511
+ },
512
+ set: function (value) {
513
+ //>>includeStart('debug', pragmas.debug);
514
+ Check.typeOf.number("threePointDepthTestDistance", value);
515
+ //>>includeEnd('debug');
516
+ this._threePointDepthTestDistance = value;
517
+ },
518
+ },
469
519
  });
470
520
 
471
521
  function destroyBillboards(billboards) {
@@ -1204,22 +1254,14 @@ function writeCompressedAttrib2(
1204
1254
  );
1205
1255
  let labelHorizontalOrigin = billboard._labelHorizontalOrigin ?? -2;
1206
1256
  labelHorizontalOrigin += 2;
1207
- const compressed3 = imageHeight * LEFT_SHIFT2 + labelHorizontalOrigin;
1208
1257
 
1209
- let red = Color.floatToByte(color.red);
1210
- let green = Color.floatToByte(color.green);
1211
- let blue = Color.floatToByte(color.blue);
1212
- const compressed0 = red * LEFT_SHIFT16 + green * LEFT_SHIFT8 + blue;
1213
-
1214
- red = Color.floatToByte(pickColor.red);
1215
- green = Color.floatToByte(pickColor.green);
1216
- blue = Color.floatToByte(pickColor.blue);
1217
- const compressed1 = red * LEFT_SHIFT16 + green * LEFT_SHIFT8 + blue;
1218
-
1219
- let compressed2 =
1258
+ const compressed0 = AttributeCompression.encodeRGB8(color);
1259
+ const compressed1 = AttributeCompression.encodeRGB8(pickColor);
1260
+ const compressed2 =
1220
1261
  Color.floatToByte(color.alpha) * LEFT_SHIFT16 +
1221
- Color.floatToByte(pickColor.alpha) * LEFT_SHIFT8;
1222
- compressed2 += sizeInMeters * 2.0 + validAlignedAxis;
1262
+ Color.floatToByte(pickColor.alpha) * LEFT_SHIFT8 +
1263
+ (sizeInMeters * 2.0 + validAlignedAxis);
1264
+ const compressed3 = imageHeight * LEFT_SHIFT2 + labelHorizontalOrigin;
1223
1265
 
1224
1266
  if (billboardCollection._instanced) {
1225
1267
  i = billboard._index;
@@ -1526,10 +1568,7 @@ function writeSDF(billboardCollection, frameState, vafWriters, billboard) {
1526
1568
  const outlineColor = billboard.outlineColor;
1527
1569
  const outlineWidth = billboard.outlineWidth;
1528
1570
 
1529
- const red = Color.floatToByte(outlineColor.red);
1530
- const green = Color.floatToByte(outlineColor.green);
1531
- const blue = Color.floatToByte(outlineColor.blue);
1532
- const compressed0 = red * LEFT_SHIFT16 + green * LEFT_SHIFT8 + blue;
1571
+ const compressed0 = AttributeCompression.encodeRGB8(outlineColor);
1533
1572
 
1534
1573
  // Compute the relative outline distance
1535
1574
  const outlineDistance = outlineWidth / SDFSettings.RADIUS;
@@ -199,7 +199,10 @@ BillboardTexture.prototype.loadImage = async function (
199
199
  let index;
200
200
  const atlas = this._billboardCollection.textureAtlas;
201
201
  try {
202
- index = await atlas.addImage(id, image, width, height);
202
+ index = atlas.addImage(id, image, width, height);
203
+ if (index instanceof Promise) {
204
+ index = await index;
205
+ }
203
206
  } catch (error) {
204
207
  // There was an error loading the image
205
208
  billboardTexture._loadState = BillboardLoadState.ERROR;