@cesium/engine 22.3.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 (193) hide show
  1. package/Build/Workers/{chunk-EAAH543Q.js → chunk-2GL2EUEE.js} +11 -11
  2. package/Build/Workers/{chunk-EUDHHS7K.js → chunk-2WI4HGJU.js} +6 -6
  3. package/Build/Workers/{chunk-LWZHJWYK.js → chunk-36LBFITA.js} +665 -366
  4. package/Build/Workers/{chunk-7U5YNLF3.js → chunk-3B65YFXC.js} +1 -1
  5. package/Build/Workers/{chunk-D63Z7KKL.js → chunk-4LGFX2P5.js} +11 -11
  6. package/Build/Workers/{chunk-D6OKR3BQ.js → chunk-4UNQX2MP.js} +2 -2
  7. package/Build/Workers/{chunk-BO22JHBX.js → chunk-52K3GJKG.js} +3 -3
  8. package/Build/Workers/{chunk-XLIJV3YZ.js → chunk-56OHFSLH.js} +10 -10
  9. package/Build/Workers/{chunk-AWELU5C6.js → chunk-5A7YSAXT.js} +14 -14
  10. package/Build/Workers/{chunk-T5MJDW43.js → chunk-5JP5FG7U.js} +7 -7
  11. package/Build/Workers/{chunk-NVL7JXAQ.js → chunk-5R7SBUTW.js} +10 -10
  12. package/Build/Workers/chunk-5VKZVPO5.js +1829 -0
  13. package/Build/Workers/{chunk-YHPBT4I5.js → chunk-6FVFM2KB.js} +5 -5
  14. package/Build/Workers/{chunk-WHLGBMBC.js → chunk-6SLGTBB2.js} +5 -5
  15. package/Build/Workers/{chunk-VIQIKMTZ.js → chunk-7KRN6JPQ.js} +14 -14
  16. package/Build/Workers/{chunk-TCOUGKXF.js → chunk-AA33B6PU.js} +4 -4
  17. package/Build/Workers/{chunk-S2KVL7OJ.js → chunk-AP6XWET5.js} +8 -8
  18. package/Build/Workers/{chunk-5PJB7ASO.js → chunk-APDKMX7W.js} +6 -6
  19. package/Build/Workers/{chunk-IXL46IYV.js → chunk-ARCFIOKA.js} +12 -12
  20. package/Build/Workers/{chunk-KIJR26N3.js → chunk-BNBD2YZK.js} +16 -16
  21. package/Build/Workers/{chunk-4R6FGUFP.js → chunk-DT5SJBKA.js} +29 -15
  22. package/Build/Workers/{chunk-FUDC3KOT.js → chunk-ESD4IEOU.js} +5 -5
  23. package/Build/Workers/{chunk-K2PLKJJG.js → chunk-FSDVXW7M.js} +5 -5
  24. package/Build/Workers/{chunk-4BBANFU6.js → chunk-G3YT7M7A.js} +1 -1
  25. package/Build/Workers/{chunk-K4PGSAR5.js → chunk-GN5NEUDT.js} +8 -8
  26. package/Build/Workers/{chunk-OOYICVOK.js → chunk-HYLEKKO5.js} +1 -1
  27. package/Build/Workers/{chunk-FDOLXORR.js → chunk-HYTFXWMY.js} +7 -7
  28. package/Build/Workers/{chunk-7SLNBIZS.js → chunk-IFA7VHHP.js} +560 -277
  29. package/Build/Workers/{chunk-N66PIK46.js → chunk-IYVDOB5V.js} +4 -4
  30. package/Build/Workers/{chunk-ZWWN2CQH.js → chunk-JUGY5AZN.js} +4 -4
  31. package/Build/Workers/{chunk-4O2ARYS7.js → chunk-KPYU6YZG.js} +1 -1
  32. package/Build/Workers/{chunk-TY5JXMVO.js → chunk-L7RDJ4V7.js} +1 -1
  33. package/Build/Workers/{chunk-L4OFWHNI.js → chunk-LDQWNMEC.js} +1 -1
  34. package/Build/Workers/{chunk-N6XBJBI7.js → chunk-MQJG522T.js} +6 -6
  35. package/Build/Workers/{chunk-FS42VX2H.js → chunk-MT5M7RLZ.js} +2 -2
  36. package/Build/Workers/{chunk-7ATKQRBM.js → chunk-N4AWE7TZ.js} +10 -10
  37. package/Build/Workers/{chunk-EOSX23OS.js → chunk-NAYRNPEP.js} +4 -4
  38. package/Build/Workers/{chunk-NO3LMU7T.js → chunk-NNHU33JK.js} +7 -7
  39. package/Build/Workers/{chunk-HWGP4GVC.js → chunk-NQCAZU7S.js} +13 -13
  40. package/Build/Workers/{chunk-6GBGEUWR.js → chunk-NUYLNQKV.js} +2 -2
  41. package/Build/Workers/{chunk-E4YDCSQK.js → chunk-OC6X22PG.js} +9 -9
  42. package/Build/Workers/{chunk-ZGGVEGTA.js → chunk-OHBM4YG4.js} +12 -12
  43. package/Build/Workers/{chunk-6WDMPXQ7.js → chunk-OMXN7YF4.js} +12 -12
  44. package/Build/Workers/{chunk-LK7GEFGB.js → chunk-OQ3EAJNW.js} +2 -2
  45. package/Build/Workers/{chunk-M5DVYXJJ.js → chunk-OQBPOKPZ.js} +6 -6
  46. package/Build/Workers/{chunk-WUWPKBOZ.js → chunk-PQVNT5CJ.js} +6 -6
  47. package/Build/Workers/{chunk-W5NV72VR.js → chunk-QA24Q62E.js} +17 -17
  48. package/Build/Workers/{chunk-PJLRXIMS.js → chunk-QQX7S5QT.js} +17 -17
  49. package/Build/Workers/{chunk-D2PEV362.js → chunk-QTOHIXGF.js} +10 -10
  50. package/Build/Workers/{chunk-MASEF4OV.js → chunk-R7M4XNPP.js} +8 -8
  51. package/Build/Workers/{chunk-2MLJ46ZZ.js → chunk-SGKTBHFQ.js} +13 -13
  52. package/Build/Workers/{chunk-EY5HOJFQ.js → chunk-SQTRWKO2.js} +5 -5
  53. package/Build/Workers/{chunk-AFGP5BXS.js → chunk-T43FXHNC.js} +7 -7
  54. package/Build/Workers/{chunk-IHFAFGR2.js → chunk-UEEGWJJP.js} +2 -2
  55. package/Build/Workers/{chunk-TMGLPEZW.js → chunk-WKXDCVBO.js} +4 -4
  56. package/Build/Workers/{chunk-VRAAQ3FS.js → chunk-Y5AJSEEN.js} +2 -2
  57. package/Build/Workers/{chunk-Y5MRBKQN.js → chunk-ZIW5FCIW.js} +18 -18
  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 +10 -10
  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/Cartesian2.js +689 -684
  113. package/Source/Core/Cartesian3.js +1044 -1043
  114. package/Source/Core/Cartesian4.js +816 -813
  115. package/Source/Core/GoogleMaps.js +23 -2
  116. package/Source/Core/Ion.js +1 -1
  117. package/Source/Core/OpenCageGeocoderService.js +2 -3
  118. package/Source/Core/globalTypes.js +16 -0
  119. package/Source/Renderer/ShaderDestination.js +54 -13
  120. package/Source/Scene/ArcGisMapService.js +1 -1
  121. package/Source/Scene/Billboard.js +7 -4
  122. package/Source/Scene/BillboardCollection.js +64 -25
  123. package/Source/Scene/BufferLoader.js +65 -74
  124. package/Source/Scene/CubeMapPanorama.js +351 -0
  125. package/Source/Scene/DerivedCommand.js +8 -31
  126. package/Source/Scene/DracoLoader.js +79 -78
  127. package/Source/Scene/EquirectangularPanorama.js +264 -0
  128. package/Source/Scene/FrameState.js +7 -0
  129. package/Source/Scene/GaussianSplatPrimitive.js +906 -167
  130. package/Source/Scene/GlobeSurfaceShaderSet.js +36 -32
  131. package/Source/Scene/GltfBufferViewLoader.js +109 -118
  132. package/Source/Scene/GltfDracoLoader.js +167 -176
  133. package/Source/Scene/GltfImageLoader.js +91 -101
  134. package/Source/Scene/GltfIndexBufferLoader.js +228 -241
  135. package/Source/Scene/GltfJsonLoader.js +90 -99
  136. package/Source/Scene/GltfLoader.js +313 -324
  137. package/Source/Scene/GltfSpzLoader.js +127 -134
  138. package/Source/Scene/GltfStructuralMetadataLoader.js +181 -186
  139. package/Source/Scene/GltfTextureLoader.js +217 -231
  140. package/Source/Scene/GltfVertexBufferLoader.js +267 -276
  141. package/Source/Scene/GoogleStreetViewCubeMapPanoramaProvider.js +341 -0
  142. package/Source/Scene/Label.js +6 -4
  143. package/Source/Scene/LabelCollection.js +59 -1
  144. package/Source/Scene/MetadataClassProperty.js +212 -7
  145. package/Source/Scene/MetadataComponentType.js +162 -127
  146. package/Source/Scene/MetadataSchemaLoader.js +60 -67
  147. package/Source/Scene/MetadataTable.js +14 -0
  148. package/Source/Scene/MetadataTableProperty.js +14 -0
  149. package/Source/Scene/Model/B3dmLoader.js +216 -224
  150. package/Source/Scene/Model/CustomShader.js +6 -1
  151. package/Source/Scene/Model/CustomShaderPipelineStage.js +122 -7
  152. package/Source/Scene/Model/GeoJsonLoader.js +53 -61
  153. package/Source/Scene/Model/GeometryPipelineStage.js +17 -3
  154. package/Source/Scene/Model/I3dmLoader.js +232 -240
  155. package/Source/Scene/Model/MaterialPipelineStage.js +1 -1
  156. package/Source/Scene/Model/MetadataPipelineStage.js +438 -22
  157. package/Source/Scene/Model/PntsLoader.js +78 -89
  158. package/Source/Scene/Panorama.js +53 -0
  159. package/Source/Scene/PanoramaProvider.js +43 -0
  160. package/Source/Scene/PointPrimitiveCollection.js +14 -22
  161. package/Source/Scene/PropertyTable.js +43 -0
  162. package/Source/Scene/PropertyTexture.js +1 -1
  163. package/Source/Scene/PropertyTextureProperty.js +0 -97
  164. package/Source/Scene/ResourceLoader.js +84 -92
  165. package/Source/Scene/Scene.js +12 -0
  166. package/Source/Scene/SkyBox.js +29 -164
  167. package/Source/Scene/StructuralMetadata.js +18 -3
  168. package/Source/Scene/parseStructuralMetadata.js +244 -0
  169. package/Source/Shaders/BillboardCollectionFS.glsl +66 -40
  170. package/Source/Shaders/BillboardCollectionFS.js +67 -40
  171. package/Source/Shaders/BillboardCollectionVS.glsl +22 -31
  172. package/Source/Shaders/BillboardCollectionVS.js +22 -31
  173. package/Source/Shaders/Builtin/CzmBuiltins.js +4 -0
  174. package/Source/Shaders/Builtin/Functions/decodeRGB8.glsl +22 -0
  175. package/Source/Shaders/Builtin/Functions/decodeRGB8.js +24 -0
  176. package/Source/Shaders/Builtin/Functions/unpackTexture.glsl +35 -0
  177. package/Source/Shaders/Builtin/Functions/unpackTexture.js +37 -0
  178. package/Source/Shaders/CubeMapPanoramaVS.glsl +11 -0
  179. package/Source/Shaders/CubeMapPanoramaVS.js +13 -0
  180. package/Source/Shaders/Model/MetadataStageFS.glsl +2 -1
  181. package/Source/Shaders/Model/MetadataStageFS.js +2 -1
  182. package/Source/Shaders/Model/MetadataStageVS.glsl +2 -1
  183. package/Source/Shaders/Model/MetadataStageVS.js +2 -1
  184. package/Source/Shaders/Model/ModelFS.glsl +2 -2
  185. package/Source/Shaders/Model/ModelFS.js +2 -2
  186. package/Source/Shaders/Model/ModelVS.glsl +2 -2
  187. package/Source/Shaders/Model/ModelVS.js +2 -2
  188. package/Source/Shaders/PointPrimitiveCollectionVS.glsl +8 -39
  189. package/Source/Shaders/PointPrimitiveCollectionVS.js +8 -39
  190. package/index.d.ts +564 -189
  191. package/index.js +127 -119
  192. package/package.json +1 -1
  193. package/Build/Workers/chunk-LYBNPUEI.js +0 -1443
@@ -5,7 +5,11 @@ import Resource from "./Resource.js";
5
5
  * Default settings for accessing the Google Maps API.
6
6
  * <br/>
7
7
  * An API key is only required if you are directly using any Google Maps APIs, such as through {@link createGooglePhotorealistic3DTileset}.
8
- * Follow instructions for managing API keys for the Google Maps Platform at {@link https://developers.google.com/maps/documentation/embed/get-api-key}
8
+ * Follow instructions for managing API keys for the Google Maps Platform at {@link https://developers.google.com/maps/documentation/embed/get-api-key}.
9
+ * <br/>
10
+ * You can enable multiple Google Maps Platform APIs on a single API key.
11
+ * However, a separate {@link GoogleMaps.defaultStreetViewStaticApiKey}
12
+ * is available if you prefer to use a dedicated key for the Street View Static API.
9
13
  *
10
14
  * @see createGooglePhotorealistic3DTileset
11
15
  * @see https://developers.google.com/maps/documentation/embed/get-api-key
@@ -31,9 +35,26 @@ GoogleMaps.mapTilesApiEndpoint = new Resource({
31
35
  url: "https://tile.googleapis.com/",
32
36
  });
33
37
 
38
+ /**
39
+ * Gets or sets the default Google Maps Street View Static API key.
40
+ *
41
+ * @type {undefined|string}
42
+ */
43
+ GoogleMaps.defaultStreetViewStaticApiKey = undefined;
44
+
45
+ /**
46
+ * Gets or sets the default Google Street View Static API endpoint.
47
+ *
48
+ * @type {string|Resource}
49
+ * @default https://maps.googleapis.com/maps/api/streetview
50
+ */
51
+ GoogleMaps.streetViewStaticApiEndpoint = new Resource({
52
+ url: "https://maps.googleapis.com/maps/api/streetview",
53
+ });
54
+
34
55
  GoogleMaps.getDefaultCredit = function () {
35
56
  return new Credit(
36
- `<img src="https://assets.ion.cesium.com/google-credit.png" style="vertical-align: -5px" alt="Google">`,
57
+ `<img alt=\"Google\" src=\"https://assets.ion.cesium.com/google-credit.png\" style=\"vertical-align:-6px\">`,
37
58
  true,
38
59
  );
39
60
  };
@@ -4,7 +4,7 @@ import Resource from "./Resource.js";
4
4
 
5
5
  let defaultTokenCredit;
6
6
  const defaultAccessToken =
7
- "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJlZWVkZjhjNC01NjdhLTQwNTctOTExMy02MThlYjIxM2U4OTkiLCJpZCI6MjU5LCJpYXQiOjE3NzAwNTUxOTV9.aJTRjsRlsJwPC0Nfcq4xscYc2lPJcGFku_PVxp1ZPyQ";
7
+ "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJhMzVlNTU2ZC1lYmM1LTQ2OWEtODRhOS0wYTFkODZmZTQ0OTgiLCJpZCI6MjU5LCJpYXQiOjE3NzI0ODIxOTR9.1oVHvVA9yr1C3CbLjlzcQQUyBuUuNaNCcc9_Giy8t7U";
8
8
  /**
9
9
  * Default settings for accessing the Cesium ion API.
10
10
  *
@@ -119,9 +119,8 @@ OpenCageGeocoderService.prototype.geocode = async function (query) {
119
119
  bounds.northeast.lat,
120
120
  );
121
121
  } else {
122
- const lon = resultObject.geometry.lat;
123
- const lat = resultObject.geometry.lng;
124
- destination = Cartesian3.fromDegrees(lon, lat);
122
+ const { lng, lat } = resultObject.geometry;
123
+ destination = Cartesian3.fromDegrees(lng, lat);
125
124
  }
126
125
 
127
126
  return {
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Union of all numeric typed array types.
3
+ * @typedef {Float64Array|Float32Array|Uint32Array|Uint16Array|Uint8Array|Int32Array|Int16Array|Int8Array} TypedArray
4
+ */
5
+
6
+ /**
7
+ * Union of all numeric typed array constructor types.
8
+ * @typedef {Float64ArrayConstructor|Float32ArrayConstructor|Uint32ArrayConstructor|Uint16ArrayConstructor|Uint8ArrayConstructor|Int32ArrayConstructor|Int16ArrayConstructor|Int8ArrayConstructor} TypedArrayConstructor
9
+ */
10
+
11
+ /**
12
+ * This file is omitted from 'workspaceSourceFiles' in 'scripts/build.js', and
13
+ * must provide type-only exports exclusively, without runtime values.
14
+ * @ignore
15
+ */
16
+ export default null;
@@ -1,15 +1,17 @@
1
1
  import Check from "../Core/Check.js";
2
+ import DeveloperError from "../Core/DeveloperError.js";
2
3
 
3
4
  /**
4
- * An enum describing whether a variable should be added to the
5
- * vertex shader, the fragment shader, or both.
5
+ * A bit flag describing whether a variable should be added to the
6
+ * vertex shader, the fragment shader, or both (or none).
6
7
  *
7
8
  * @private
8
9
  */
9
10
  const ShaderDestination = {
10
- VERTEX: 0,
11
- FRAGMENT: 1,
12
- BOTH: 2,
11
+ NONE: 0,
12
+ VERTEX: 1,
13
+ FRAGMENT: 2,
14
+ BOTH: 3,
13
15
  };
14
16
 
15
17
  /**
@@ -24,10 +26,7 @@ ShaderDestination.includesVertexShader = function (destination) {
24
26
  Check.typeOf.number("destination", destination);
25
27
  //>>includeEnd('debug');
26
28
 
27
- return (
28
- destination === ShaderDestination.VERTEX ||
29
- destination === ShaderDestination.BOTH
30
- );
29
+ return (destination & ShaderDestination.VERTEX) !== 0;
31
30
  };
32
31
 
33
32
  /**
@@ -42,10 +41,52 @@ ShaderDestination.includesFragmentShader = function (destination) {
42
41
  Check.typeOf.number("destination", destination);
43
42
  //>>includeEnd('debug');
44
43
  //
45
- return (
46
- destination === ShaderDestination.FRAGMENT ||
47
- destination === ShaderDestination.BOTH
48
- );
44
+
45
+ return (destination & ShaderDestination.FRAGMENT) !== 0;
46
+ };
47
+
48
+ /**
49
+ * Compute the union of multiple ShaderDestinations (e.g., VERTEX | FRAGMENT yields BOTH)
50
+ * @param {...ShaderDestination} destinations
51
+ * @returns {ShaderDestination} The union of the provided destinations
52
+ * @private
53
+ */
54
+ ShaderDestination.union = function (...destinations) {
55
+ //>>includeStart('debug', pragmas.debug);
56
+ if (destinations.length === 0) {
57
+ throw new DeveloperError(
58
+ "ShaderDestination.union requires at least one destination.",
59
+ );
60
+ }
61
+ //>>includeEnd('debug');
62
+
63
+ let result = 0;
64
+ for (let i = 0; i < destinations.length; i++) {
65
+ result |= destinations[i];
66
+ }
67
+ return result;
68
+ };
69
+
70
+ /**
71
+ * Compute the intersection of multiple ShaderDestinations (e.g., VERTEX & FRAGMENT yields NONE)
72
+ * @param {...ShaderDestination} destinations
73
+ * @returns {ShaderDestination} The intersection of the provided destinations
74
+ * @private
75
+ */
76
+ ShaderDestination.intersection = function (...destinations) {
77
+ //>>includeStart('debug', pragmas.debug);
78
+ if (destinations.length === 0) {
79
+ throw new DeveloperError(
80
+ "ShaderDestination.intersection requires at least one destination.",
81
+ );
82
+ }
83
+ //>>includeEnd('debug');
84
+
85
+ let result = destinations[0];
86
+ for (let i = 1; i < destinations.length; i++) {
87
+ result &= destinations[i];
88
+ }
89
+ return result;
49
90
  };
50
91
 
51
92
  export default Object.freeze(ShaderDestination);
@@ -4,7 +4,7 @@ import Resource from "../Core/Resource.js";
4
4
 
5
5
  let defaultTokenCredit;
6
6
  const defaultAccessToken =
7
- "AAPTxy8BH1VEsoebNVZXo8HurEOF051kAEKlhkOhBEc9BmQBN5OwMQnvqcM3GTdzwDusCXj4eE5jKKONHLoPEAvNXnML4d2_ObFMHiYtbS6gOWoNlH6cNDium9FLGy4eRBK7mcDQKdokYzlY27y-WPo25dgjAfx6C0rbvGsk0yn7FHPv8yDcsW5frQhhXIJ48lW5UcbIlpxY_j-Im5MJfxgIQuUA_m0tvy4rxbkTMNS26yA.AT1_DJvNEaWq";
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
 
@@ -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
@@ -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;
@@ -10,46 +10,40 @@ import ResourceLoaderState from "./ResourceLoaderState.js";
10
10
  * Implements the {@link ResourceLoader} interface.
11
11
  * </p>
12
12
  *
13
- * @alias BufferLoader
14
- * @constructor
15
- * @augments ResourceLoader
16
- *
17
- * @param {object} options Object with the following properties:
18
- * @param {Uint8Array} [options.typedArray] The typed array containing the embedded buffer contents. Mutually exclusive with options.resource.
19
- * @param {Resource} [options.resource] The {@link Resource} pointing to the external buffer. Mutually exclusive with options.typedArray.
20
- * @param {string} [options.cacheKey] The cache key of the resource.
21
- *
22
- * @exception {DeveloperError} One of options.typedArray and options.resource must be defined.
23
- *
24
13
  * @private
25
14
  */
26
- function BufferLoader(options) {
27
- options = options ?? Frozen.EMPTY_OBJECT;
28
- const typedArray = options.typedArray;
29
- const resource = options.resource;
30
- const cacheKey = options.cacheKey;
15
+ class BufferLoader extends ResourceLoader {
16
+ /**
17
+ * @param {object} options Object with the following properties:
18
+ * @param {Uint8Array} [options.typedArray] The typed array containing the embedded buffer contents. Mutually exclusive with options.resource.
19
+ * @param {Resource} [options.resource] The {@link Resource} pointing to the external buffer. Mutually exclusive with options.typedArray.
20
+ * @param {string} [options.cacheKey] The cache key of the resource.
21
+ *
22
+ * @exception {DeveloperError} One of options.typedArray and options.resource must be defined.
23
+ */
24
+ constructor(options) {
25
+ super();
31
26
 
32
- //>>includeStart('debug', pragmas.debug);
33
- if (defined(typedArray) === defined(resource)) {
34
- throw new DeveloperError(
35
- "One of options.typedArray and options.resource must be defined.",
36
- );
37
- }
38
- //>>includeEnd('debug');
27
+ options = options ?? Frozen.EMPTY_OBJECT;
28
+ const typedArray = options.typedArray;
29
+ const resource = options.resource;
30
+ const cacheKey = options.cacheKey;
39
31
 
40
- this._typedArray = typedArray;
41
- this._resource = resource;
42
- this._cacheKey = cacheKey;
43
- this._state = ResourceLoaderState.UNLOADED;
44
- this._promise = undefined;
45
- }
32
+ //>>includeStart('debug', pragmas.debug);
33
+ if (defined(typedArray) === defined(resource)) {
34
+ throw new DeveloperError(
35
+ "One of options.typedArray and options.resource must be defined.",
36
+ );
37
+ }
38
+ //>>includeEnd('debug');
46
39
 
47
- if (defined(Object.create)) {
48
- BufferLoader.prototype = Object.create(ResourceLoader.prototype);
49
- BufferLoader.prototype.constructor = BufferLoader;
50
- }
40
+ this._typedArray = typedArray;
41
+ this._resource = resource;
42
+ this._cacheKey = cacheKey;
43
+ this._state = ResourceLoaderState.UNLOADED;
44
+ this._promise = undefined;
45
+ }
51
46
 
52
- Object.defineProperties(BufferLoader.prototype, {
53
47
  /**
54
48
  * The cache key of the resource.
55
49
  *
@@ -59,11 +53,10 @@ Object.defineProperties(BufferLoader.prototype, {
59
53
  * @readonly
60
54
  * @private
61
55
  */
62
- cacheKey: {
63
- get: function () {
64
- return this._cacheKey;
65
- },
66
- },
56
+ get cacheKey() {
57
+ return this._cacheKey;
58
+ }
59
+
67
60
  /**
68
61
  * The typed array containing the embedded buffer contents.
69
62
  *
@@ -73,31 +66,45 @@ Object.defineProperties(BufferLoader.prototype, {
73
66
  * @readonly
74
67
  * @private
75
68
  */
76
- typedArray: {
77
- get: function () {
78
- return this._typedArray;
79
- },
80
- },
81
- });
69
+ get typedArray() {
70
+ return this._typedArray;
71
+ }
82
72
 
83
- /**
84
- * Loads the resource.
85
- * @returns {Promise<BufferLoader>} A promise which resolves to the loader when the resource loading is completed.
86
- * @private
87
- */
88
- BufferLoader.prototype.load = async function () {
89
- if (defined(this._promise)) {
73
+ /**
74
+ * Loads the resource.
75
+ * @returns {Promise<BufferLoader>} A promise which resolves to the loader when the resource loading is completed.
76
+ * @private
77
+ */
78
+ async load() {
79
+ if (defined(this._promise)) {
80
+ return this._promise;
81
+ }
82
+
83
+ if (defined(this._typedArray)) {
84
+ this._promise = Promise.resolve(this);
85
+ return this._promise;
86
+ }
87
+
88
+ this._promise = loadExternalBuffer(this);
90
89
  return this._promise;
91
90
  }
92
91
 
93
- if (defined(this._typedArray)) {
94
- this._promise = Promise.resolve(this);
95
- return this._promise;
92
+ /**
93
+ * Exposed for testing
94
+ * @private
95
+ */
96
+ static _fetchArrayBuffer(resource) {
97
+ return resource.fetchArrayBuffer();
96
98
  }
97
99
 
98
- this._promise = loadExternalBuffer(this);
99
- return this._promise;
100
- };
100
+ /**
101
+ * Unloads the resource.
102
+ * @private
103
+ */
104
+ unload() {
105
+ this._typedArray = undefined;
106
+ }
107
+ }
101
108
 
102
109
  async function loadExternalBuffer(bufferLoader) {
103
110
  const resource = bufferLoader._resource;
@@ -122,20 +129,4 @@ async function loadExternalBuffer(bufferLoader) {
122
129
  }
123
130
  }
124
131
 
125
- /**
126
- * Exposed for testing
127
- * @private
128
- */
129
- BufferLoader._fetchArrayBuffer = function (resource) {
130
- return resource.fetchArrayBuffer();
131
- };
132
-
133
- /**
134
- * Unloads the resource.
135
- * @private
136
- */
137
- BufferLoader.prototype.unload = function () {
138
- this._typedArray = undefined;
139
- };
140
-
141
132
  export default BufferLoader;