@cesium/engine 9.0.0 → 9.2.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 (189) hide show
  1. package/Build/ThirdParty/Workers/pako_deflate.min.js +108 -210
  2. package/Build/ThirdParty/Workers/pako_inflate.min.js +466 -568
  3. package/Build/ThirdParty/Workers/z-worker-pako.js +56 -105
  4. package/Build/Workers/{chunk-VR5RBW52.js → chunk-26NE4LRW.js} +7 -7
  5. package/Build/Workers/{chunk-P2YAAMT2.js → chunk-26XJDV3D.js} +15 -15
  6. package/Build/Workers/{chunk-L4BW3RUA.js → chunk-2TRB253J.js} +7 -7
  7. package/Build/Workers/{chunk-NP2GYYE5.js → chunk-3PV5HQ2R.js} +6 -6
  8. package/Build/Workers/{chunk-BCU2LH5T.js → chunk-3VDHTBY5.js} +10 -10
  9. package/Build/Workers/{chunk-WHUSTDIB.js → chunk-4RG6WOXH.js} +10 -10
  10. package/Build/Workers/{chunk-P4XKB3QZ.js → chunk-5OK5JFDP.js} +5 -5
  11. package/Build/Workers/{chunk-2ZBL3MVO.js → chunk-7HLZRYGD.js} +10 -12
  12. package/Build/Workers/chunk-7PFZ4Z7C.js +961 -0
  13. package/Build/Workers/{chunk-24YTYWNB.js → chunk-A5CSB5ZE.js} +11 -13
  14. package/Build/Workers/{chunk-RMOEYCZW.js → chunk-AROLUUGS.js} +2 -2
  15. package/Build/Workers/{chunk-3NCVAGDA.js → chunk-BBBTT36L.js} +14 -14
  16. package/Build/Workers/{chunk-QKBGRKKG.js → chunk-BNT2SNWU.js} +4 -4
  17. package/Build/Workers/{chunk-LQJ5FFFR.js → chunk-CFBGPZU6.js} +11 -13
  18. package/Build/Workers/{chunk-C6OI26DR.js → chunk-CVCVMOQA.js} +1 -1
  19. package/Build/Workers/{chunk-SS4ESNE3.js → chunk-DIVFF6DK.js} +2 -2
  20. package/Build/Workers/{chunk-PXB7T27O.js → chunk-EJZVBTX4.js} +6 -6
  21. package/Build/Workers/{chunk-TZORKRNK.js → chunk-EODIOQ35.js} +1 -1
  22. package/Build/Workers/{chunk-QCQUZGXI.js → chunk-ETC45PHH.js} +5 -6
  23. package/Build/Workers/{chunk-E6WXPSJS.js → chunk-G7IAO7CW.js} +7 -7
  24. package/Build/Workers/{chunk-X2F6BEPY.js → chunk-GOQEANLM.js} +16 -16
  25. package/Build/Workers/{chunk-7COR472O.js → chunk-GUFV24F4.js} +7197 -5096
  26. package/Build/Workers/{chunk-5TIV3L26.js → chunk-GX2BWBN2.js} +13 -13
  27. package/Build/Workers/{chunk-ADOVHYWO.js → chunk-GX5LMUGZ.js} +469 -6
  28. package/Build/Workers/{chunk-2632RVPI.js → chunk-I6CW7ZE5.js} +7 -7
  29. package/Build/Workers/{chunk-YDVSBWEO.js → chunk-IF2OX6R4.js} +3 -5
  30. package/Build/Workers/{chunk-RSJXEO2A.js → chunk-IXYFH7DV.js} +95 -155
  31. package/Build/Workers/{chunk-ZNVSKMQ2.js → chunk-K5F23SZO.js} +6 -6
  32. package/Build/Workers/{chunk-MWV7IZK4.js → chunk-KTZK2UDR.js} +7 -7
  33. package/Build/Workers/{chunk-HBQPB6IH.js → chunk-LZFFO4KB.js} +12 -12
  34. package/Build/Workers/{chunk-GFA4SMXV.js → chunk-OYP23VAL.js} +11 -11
  35. package/Build/Workers/{chunk-ZYPTP7GS.js → chunk-PHT53MCH.js} +11 -11
  36. package/Build/Workers/{chunk-TJBU6GML.js → chunk-PUQR43HZ.js} +6 -6
  37. package/Build/Workers/{chunk-CO35JNNE.js → chunk-QZIWFSRM.js} +4 -4
  38. package/Build/Workers/{chunk-C3XBUYBO.js → chunk-RDR4KVPA.js} +17 -17
  39. package/Build/Workers/{chunk-YV4H2Y7M.js → chunk-RRUO4QEK.js} +4 -4
  40. package/Build/Workers/{chunk-LAQP3SCC.js → chunk-RTIT7UDN.js} +2 -2
  41. package/Build/Workers/{chunk-Z7FQLK6N.js → chunk-SC3TBKST.js} +4 -4
  42. package/Build/Workers/{chunk-GXUXEOE2.js → chunk-TDIGL45B.js} +1 -1
  43. package/Build/Workers/{chunk-EOXYZ34O.js → chunk-TP4FFUAH.js} +2 -2
  44. package/Build/Workers/{chunk-N4KXMWQU.js → chunk-U2LSTOMA.js} +2 -2
  45. package/Build/Workers/{chunk-6WF3KIF5.js → chunk-U6MTSO6A.js} +47 -84
  46. package/Build/Workers/{chunk-I37B3MZ2.js → chunk-UICVDDCQ.js} +1 -1
  47. package/Build/Workers/{chunk-DPUSFA7S.js → chunk-UKJCFXVV.js} +6 -6
  48. package/Build/Workers/{chunk-EPKE7GE3.js → chunk-UYKG3UFK.js} +5 -5
  49. package/Build/Workers/{chunk-RV7ZOSS6.js → chunk-W4OS542B.js} +13 -13
  50. package/Build/Workers/{chunk-DGDUKCJJ.js → chunk-WHDEZSAL.js} +6 -6
  51. package/Build/Workers/{chunk-NZWNZA6S.js → chunk-WOYQB5HM.js} +5 -5
  52. package/Build/Workers/{chunk-M2AYBTNH.js → chunk-WP3LCUOE.js} +13 -13
  53. package/Build/Workers/{chunk-73FKKY52.js → chunk-YGNQJ4YI.js} +5 -5
  54. package/Build/Workers/{chunk-SE4PXOEA.js → chunk-YGTWKLFY.js} +19 -19
  55. package/Build/Workers/{chunk-5R6VWLMH.js → chunk-ZHJDE6JN.js} +6 -6
  56. package/Build/Workers/combineGeometry.js +22 -24
  57. package/Build/Workers/createBoxGeometry.js +16 -18
  58. package/Build/Workers/createBoxOutlineGeometry.js +14 -16
  59. package/Build/Workers/createCircleGeometry.js +24 -26
  60. package/Build/Workers/createCircleOutlineGeometry.js +17 -19
  61. package/Build/Workers/createCoplanarPolygonGeometry.js +33 -34
  62. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +29 -31
  63. package/Build/Workers/createCorridorGeometry.js +27 -29
  64. package/Build/Workers/createCorridorOutlineGeometry.js +26 -28
  65. package/Build/Workers/createCylinderGeometry.js +18 -20
  66. package/Build/Workers/createCylinderOutlineGeometry.js +16 -18
  67. package/Build/Workers/createEllipseGeometry.js +24 -26
  68. package/Build/Workers/createEllipseOutlineGeometry.js +17 -19
  69. package/Build/Workers/createEllipsoidGeometry.js +17 -19
  70. package/Build/Workers/createEllipsoidOutlineGeometry.js +16 -18
  71. package/Build/Workers/createFrustumGeometry.js +16 -18
  72. package/Build/Workers/createFrustumOutlineGeometry.js +18 -19
  73. package/Build/Workers/createGeometry.js +22 -24
  74. package/Build/Workers/createGroundPolylineGeometry.js +23 -25
  75. package/Build/Workers/createPlaneGeometry.js +14 -16
  76. package/Build/Workers/createPlaneOutlineGeometry.js +13 -15
  77. package/Build/Workers/createPolygonGeometry.js +32 -34
  78. package/Build/Workers/createPolygonOutlineGeometry.js +28 -30
  79. package/Build/Workers/createPolylineGeometry.js +23 -25
  80. package/Build/Workers/createPolylineVolumeGeometry.js +29 -31
  81. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +25 -27
  82. package/Build/Workers/createRectangleGeometry.js +27 -29
  83. package/Build/Workers/createRectangleOutlineGeometry.js +18 -20
  84. package/Build/Workers/createSimplePolylineGeometry.js +21 -23
  85. package/Build/Workers/createSphereGeometry.js +17 -19
  86. package/Build/Workers/createSphereOutlineGeometry.js +16 -18
  87. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  88. package/Build/Workers/createVectorTileClampedPolylines.js +14 -16
  89. package/Build/Workers/createVectorTileGeometries.js +22 -24
  90. package/Build/Workers/createVectorTilePoints.js +12 -12
  91. package/Build/Workers/createVectorTilePolygons.js +20 -22
  92. package/Build/Workers/createVectorTilePolylines.js +14 -16
  93. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +23 -25
  94. package/Build/Workers/createVerticesFromHeightmap.js +23 -25
  95. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +19 -22
  96. package/Build/Workers/createWallGeometry.js +22 -24
  97. package/Build/Workers/createWallOutlineGeometry.js +21 -23
  98. package/Build/Workers/decodeDraco.js +11 -11
  99. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +12 -19
  100. package/Build/Workers/decodeI3S.js +10 -11
  101. package/Build/Workers/transcodeKTX2.js +44 -80
  102. package/Build/Workers/transferTypedArrayTest.js +1 -1
  103. package/Build/Workers/upsampleQuantizedTerrainMesh.js +20 -22
  104. package/Source/Core/Ion.js +1 -1
  105. package/Source/Core/Math.js +0 -5
  106. package/Source/Core/PixelFormat.js +1 -0
  107. package/Source/Core/Rectangle.js +89 -0
  108. package/Source/Core/TaskProcessor.js +19 -3
  109. package/Source/Core/sampleTerrain.js +3 -3
  110. package/Source/DataSources/DataSourceDisplay.js +5 -0
  111. package/Source/Renderer/ShaderBuilder.js +6 -3
  112. package/Source/Scene/ArcGisMapService.js +1 -1
  113. package/Source/Scene/Billboard.js +7 -5
  114. package/Source/Scene/Cesium3DTile.js +65 -0
  115. package/Source/Scene/Cesium3DTileset.js +48 -1
  116. package/Source/Scene/ClippingPolygon.js +212 -0
  117. package/Source/Scene/ClippingPolygonCollection.js +968 -0
  118. package/Source/Scene/Globe.js +14 -0
  119. package/Source/Scene/GlobeSurfaceShaderSet.js +81 -15
  120. package/Source/Scene/GlobeSurfaceTileProvider.js +81 -1
  121. package/Source/Scene/GltfLoader.js +458 -435
  122. package/Source/Scene/GltfLoaderUtil.js +3 -12
  123. package/Source/Scene/GltfPipeline/forEachTextureInMaterial.js +23 -7
  124. package/Source/Scene/GltfStructuralMetadataLoader.js +11 -9
  125. package/Source/Scene/Label.js +1 -1
  126. package/Source/Scene/Model/AlphaPipelineStage.js +1 -1
  127. package/Source/Scene/Model/GeometryPipelineStage.js +15 -43
  128. package/Source/Scene/Model/ImageBasedLightingPipelineStage.js +7 -0
  129. package/Source/Scene/Model/LightingPipelineStage.js +2 -4
  130. package/Source/Scene/Model/MaterialPipelineStage.js +346 -29
  131. package/Source/Scene/Model/Model.js +91 -3
  132. package/Source/Scene/Model/Model3DTileContent.js +21 -0
  133. package/Source/Scene/Model/ModelClippingPolygonsPipelineStage.js +92 -0
  134. package/Source/Scene/Model/ModelSceneGraph.js +5 -0
  135. package/Source/Scene/Model/ModelUtility.js +3 -0
  136. package/Source/Scene/Model/VerticalExaggerationPipelineStage.js +4 -6
  137. package/Source/Scene/ModelComponents.js +169 -1
  138. package/Source/Scene/PickDepth.js +23 -15
  139. package/Source/Scene/ResourceCache.js +41 -50
  140. package/Source/Scene/ResourceCacheKey.js +41 -53
  141. package/Source/Scene/Terrain.js +2 -2
  142. package/Source/Shaders/Builtin/CzmBuiltins.js +6 -8
  143. package/Source/Shaders/Builtin/Functions/clipPolygons.glsl +37 -0
  144. package/Source/Shaders/Builtin/Functions/clipPolygons.js +39 -0
  145. package/Source/Shaders/Builtin/Functions/maximumComponent.glsl +21 -0
  146. package/Source/Shaders/Builtin/Functions/maximumComponent.js +23 -0
  147. package/Source/Shaders/Builtin/Functions/pbrLighting.glsl +108 -44
  148. package/Source/Shaders/Builtin/Functions/pbrLighting.js +108 -44
  149. package/Source/Shaders/Builtin/Functions/unpackClippingExtents.glsl +14 -0
  150. package/Source/Shaders/Builtin/Functions/unpackClippingExtents.js +15 -0
  151. package/Source/Shaders/Builtin/Structs/modelMaterial.glsl +14 -0
  152. package/Source/Shaders/Builtin/Structs/modelMaterial.js +14 -0
  153. package/Source/Shaders/GlobeFS.glsl +13 -1
  154. package/Source/Shaders/GlobeFS.js +13 -1
  155. package/Source/Shaders/GlobeVS.glsl +32 -0
  156. package/Source/Shaders/GlobeVS.js +32 -0
  157. package/Source/Shaders/Model/GeometryStageVS.glsl +1 -1
  158. package/Source/Shaders/Model/GeometryStageVS.js +1 -1
  159. package/Source/Shaders/Model/ImageBasedLightingStageFS.glsl +211 -133
  160. package/Source/Shaders/Model/ImageBasedLightingStageFS.js +212 -133
  161. package/Source/Shaders/Model/LightingStageFS.glsl +113 -48
  162. package/Source/Shaders/Model/LightingStageFS.js +113 -48
  163. package/Source/Shaders/Model/MaterialStageFS.glsl +399 -137
  164. package/Source/Shaders/Model/MaterialStageFS.js +399 -137
  165. package/Source/Shaders/Model/ModelClippingPolygonsStageFS.glsl +6 -0
  166. package/Source/Shaders/Model/ModelClippingPolygonsStageFS.js +8 -0
  167. package/Source/Shaders/Model/ModelClippingPolygonsStageVS.glsl +27 -0
  168. package/Source/Shaders/Model/ModelClippingPolygonsStageVS.js +29 -0
  169. package/Source/Shaders/Model/ModelFS.glsl +6 -0
  170. package/Source/Shaders/Model/ModelFS.js +7 -1
  171. package/Source/Shaders/Model/ModelVS.glsl +4 -0
  172. package/Source/Shaders/Model/ModelVS.js +4 -0
  173. package/Source/Shaders/PolygonSignedDistanceFS.glsl +100 -0
  174. package/Source/Shaders/PolygonSignedDistanceFS.js +101 -0
  175. package/Source/ThirdParty/Workers/z-worker-pako.js +1 -1
  176. package/index.d.ts +230 -4
  177. package/index.js +234 -229
  178. package/package.json +1 -1
  179. package/Build/Workers/chunk-2KACWKS4.js +0 -501
  180. package/Build/Workers/chunk-2XPLH3JY.js +0 -2977
  181. package/Build/Workers/chunk-X6XOMPWL.js +0 -73
  182. package/Source/Shaders/Builtin/Functions/defaultPbrMaterial.glsl +0 -16
  183. package/Source/Shaders/Builtin/Functions/defaultPbrMaterial.js +0 -18
  184. package/Source/Shaders/Builtin/Functions/pbrMetallicRoughnessMaterial.glsl +0 -37
  185. package/Source/Shaders/Builtin/Functions/pbrMetallicRoughnessMaterial.js +0 -39
  186. package/Source/Shaders/Builtin/Functions/pbrSpecularGlossinessMaterial.glsl +0 -30
  187. package/Source/Shaders/Builtin/Functions/pbrSpecularGlossinessMaterial.js +0 -32
  188. package/Source/Shaders/Builtin/Structs/pbrParameters.glsl +0 -16
  189. package/Source/Shaders/Builtin/Structs/pbrParameters.js +0 -18
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @license
3
3
  * Cesium - https://github.com/CesiumGS/cesium
4
- * Version 1.116
4
+ * Version 1.118
5
5
  *
6
6
  * Copyright 2011-2022 Cesium Contributors
7
7
  *
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @license
3
3
  * Cesium - https://github.com/CesiumGS/cesium
4
- * Version 1.116
4
+ * Version 1.118
5
5
  *
6
6
  * Copyright 2011-2022 Cesium Contributors
7
7
  *
@@ -26,51 +26,49 @@
26
26
  import {
27
27
  EllipsoidalOccluder_default,
28
28
  TerrainEncoding_default
29
- } from "./chunk-BCU2LH5T.js";
29
+ } from "./chunk-3VDHTBY5.js";
30
30
  import {
31
31
  createTaskProcessorWorker_default
32
- } from "./chunk-RMOEYCZW.js";
32
+ } from "./chunk-AROLUUGS.js";
33
33
  import {
34
34
  OrientedBoundingBox_default
35
- } from "./chunk-WHUSTDIB.js";
35
+ } from "./chunk-4RG6WOXH.js";
36
36
  import {
37
37
  AttributeCompression_default
38
- } from "./chunk-E6WXPSJS.js";
39
- import "./chunk-LQJ5FFFR.js";
40
- import "./chunk-TJBU6GML.js";
41
- import "./chunk-L4BW3RUA.js";
42
- import "./chunk-NP2GYYE5.js";
38
+ } from "./chunk-G7IAO7CW.js";
39
+ import "./chunk-CFBGPZU6.js";
40
+ import "./chunk-PUQR43HZ.js";
41
+ import "./chunk-2TRB253J.js";
42
+ import "./chunk-3PV5HQ2R.js";
43
43
  import {
44
44
  IndexDatatype_default
45
- } from "./chunk-P4XKB3QZ.js";
45
+ } from "./chunk-5OK5JFDP.js";
46
46
  import {
47
47
  BoundingSphere_default
48
- } from "./chunk-7COR472O.js";
49
- import "./chunk-2KACWKS4.js";
50
- import "./chunk-X6XOMPWL.js";
48
+ } from "./chunk-7PFZ4Z7C.js";
51
49
  import {
52
50
  Rectangle_default
53
- } from "./chunk-2XPLH3JY.js";
54
- import "./chunk-NZWNZA6S.js";
51
+ } from "./chunk-GUFV24F4.js";
52
+ import "./chunk-WOYQB5HM.js";
55
53
  import {
56
54
  Cartesian2_default,
57
55
  Cartesian3_default,
58
56
  Cartographic_default,
59
57
  Ellipsoid_default
60
- } from "./chunk-ADOVHYWO.js";
58
+ } from "./chunk-GX5LMUGZ.js";
61
59
  import {
62
60
  Math_default
63
- } from "./chunk-QCQUZGXI.js";
64
- import "./chunk-I37B3MZ2.js";
65
- import "./chunk-N4KXMWQU.js";
66
- import "./chunk-TZORKRNK.js";
61
+ } from "./chunk-ETC45PHH.js";
62
+ import "./chunk-UICVDDCQ.js";
63
+ import "./chunk-U2LSTOMA.js";
64
+ import "./chunk-EODIOQ35.js";
67
65
  import {
68
66
  Check_default,
69
67
  DeveloperError_default
70
- } from "./chunk-SS4ESNE3.js";
68
+ } from "./chunk-DIVFF6DK.js";
71
69
  import {
72
70
  defined_default
73
- } from "./chunk-YDVSBWEO.js";
71
+ } from "./chunk-IF2OX6R4.js";
74
72
 
75
73
  // packages/engine/Source/Core/Intersections2D.js
76
74
  var Intersections2D = {};
@@ -4,7 +4,7 @@ import Resource from "./Resource.js";
4
4
 
5
5
  let defaultTokenCredit;
6
6
  const defaultAccessToken =
7
- "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJjM2I5YWEyNS02NzRiLTRmOTEtYWZhNi1jNzlhZTI5Yjc3YWYiLCJpZCI6MjU5LCJpYXQiOjE3MTE1NTQ2Njd9.dawdakmPEfdAKpH2-Cv-IDOlVHwicZ1Mgk7ZzI775hQ";
7
+ "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI0YjhlOGM0Yy0xNzcwLTQwNWEtODk4Yy0xMGJkODg4MTA5ZGEiLCJpZCI6MjU5LCJpYXQiOjE3MTc0MzM4NjB9.VwBpSnRTNdg_G6uvU-JNsRNcSOCDMKW_j3Nl5E7wfwg";
8
8
  /**
9
9
  * Default settings for accessing the Cesium ion API.
10
10
  *
@@ -205,7 +205,6 @@ CesiumMath.FOUR_GIGABYTES = 4 * 1024 * 1024 * 1024;
205
205
  * @param {number} value The value to return the sign of.
206
206
  * @returns {number} The sign of value.
207
207
  */
208
- // eslint-disable-next-line es/no-math-sign
209
208
  CesiumMath.sign = defaultValue(Math.sign, function sign(value) {
210
209
  value = +value; // coerce to number
211
210
  if (value === 0 || value !== value) {
@@ -292,7 +291,6 @@ CesiumMath.normalize = function (value, rangeMinimum, rangeMaximum) {
292
291
  * @param {number} value The number whose hyperbolic sine is to be returned.
293
292
  * @returns {number} The hyperbolic sine of <code>value</code>.
294
293
  */
295
- // eslint-disable-next-line es/no-math-sinh
296
294
  CesiumMath.sinh = defaultValue(Math.sinh, function sinh(value) {
297
295
  return (Math.exp(value) - Math.exp(-value)) / 2.0;
298
296
  });
@@ -317,7 +315,6 @@ CesiumMath.sinh = defaultValue(Math.sinh, function sinh(value) {
317
315
  * @param {number} value The number whose hyperbolic cosine is to be returned.
318
316
  * @returns {number} The hyperbolic cosine of <code>value</code>.
319
317
  */
320
- // eslint-disable-next-line es/no-math-cosh
321
318
  CesiumMath.cosh = defaultValue(Math.cosh, function cosh(value) {
322
319
  return (Math.exp(value) + Math.exp(-value)) / 2.0;
323
320
  });
@@ -1034,7 +1031,6 @@ CesiumMath.logBase = function (number, base) {
1034
1031
  * @param {number} [number] The number.
1035
1032
  * @returns {number} The result.
1036
1033
  */
1037
- // eslint-disable-next-line es/no-math-cbrt
1038
1034
  CesiumMath.cbrt = defaultValue(Math.cbrt, function cbrt(number) {
1039
1035
  const result = Math.pow(Math.abs(number), 1.0 / 3.0);
1040
1036
  return number < 0.0 ? -result : result;
@@ -1047,7 +1043,6 @@ CesiumMath.cbrt = defaultValue(Math.cbrt, function cbrt(number) {
1047
1043
  * @param {number} number The number.
1048
1044
  * @returns {number} The result.
1049
1045
  */
1050
- // eslint-disable-next-line es/no-math-log2
1051
1046
  CesiumMath.log2 = defaultValue(Math.log2, function log2(number) {
1052
1047
  return Math.log(number) * Math.LOG2E;
1053
1048
  });
@@ -240,6 +240,7 @@ PixelFormat.validate = function (pixelFormat) {
240
240
  */
241
241
  PixelFormat.isColorFormat = function (pixelFormat) {
242
242
  return (
243
+ pixelFormat === PixelFormat.RED ||
243
244
  pixelFormat === PixelFormat.ALPHA ||
244
245
  pixelFormat === PixelFormat.RGB ||
245
246
  pixelFormat === PixelFormat.RGBA ||
@@ -1,9 +1,12 @@
1
+ import Cartesian3 from "./Cartesian3.js";
1
2
  import Cartographic from "./Cartographic.js";
2
3
  import Check from "./Check.js";
3
4
  import defaultValue from "./defaultValue.js";
4
5
  import defined from "./defined.js";
5
6
  import Ellipsoid from "./Ellipsoid.js";
6
7
  import CesiumMath from "./Math.js";
8
+ import Transforms from "./Transforms.js";
9
+ import Matrix4 from "./Matrix4.js";
7
10
 
8
11
  /**
9
12
  * A two dimensional region specified as longitude and latitude coordinates.
@@ -337,6 +340,92 @@ Rectangle.fromCartesianArray = function (cartesians, ellipsoid, result) {
337
340
  return result;
338
341
  };
339
342
 
343
+ const fromBoundingSphereMatrixScratch = new Cartesian3();
344
+ const fromBoundingSphereEastScratch = new Cartesian3();
345
+ const fromBoundingSphereNorthScratch = new Cartesian3();
346
+ const fromBoundingSphereWestScratch = new Cartesian3();
347
+ const fromBoundingSphereSouthScratch = new Cartesian3();
348
+ const fromBoundingSpherePositionsScratch = new Array(5);
349
+ for (let n = 0; n < fromBoundingSpherePositionsScratch.length; ++n) {
350
+ fromBoundingSpherePositionsScratch[n] = new Cartesian3();
351
+ }
352
+ /**
353
+ * Create a rectangle from a bounding sphere, ignoring height.
354
+ *
355
+ *
356
+ * @param {BoundingSphere} boundingSphere The bounding sphere.
357
+ * @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid.
358
+ * @param {Rectangle} [result] The object onto which to store the result, or undefined if a new instance should be created.
359
+ * @returns {Rectangle} The modified result parameter or a new Rectangle instance if none was provided.
360
+ */
361
+ Rectangle.fromBoundingSphere = function (boundingSphere, ellipsoid, result) {
362
+ //>>includeStart('debug', pragmas.debug);
363
+ Check.typeOf.object("boundingSphere", boundingSphere);
364
+ //>>includeEnd('debug');
365
+
366
+ const center = boundingSphere.center;
367
+ const radius = boundingSphere.radius;
368
+
369
+ if (!defined(ellipsoid)) {
370
+ ellipsoid = Ellipsoid.WGS84;
371
+ }
372
+
373
+ if (!defined(result)) {
374
+ result = new Rectangle();
375
+ }
376
+
377
+ if (Cartesian3.equals(center, Cartesian3.ZERO)) {
378
+ Rectangle.clone(Rectangle.MAX_VALUE, result);
379
+ return result;
380
+ }
381
+
382
+ const fromENU = Transforms.eastNorthUpToFixedFrame(
383
+ center,
384
+ ellipsoid,
385
+ fromBoundingSphereMatrixScratch
386
+ );
387
+ const east = Matrix4.multiplyByPointAsVector(
388
+ fromENU,
389
+ Cartesian3.UNIT_X,
390
+ fromBoundingSphereEastScratch
391
+ );
392
+ Cartesian3.normalize(east, east);
393
+ const north = Matrix4.multiplyByPointAsVector(
394
+ fromENU,
395
+ Cartesian3.UNIT_Y,
396
+ fromBoundingSphereNorthScratch
397
+ );
398
+ Cartesian3.normalize(north, north);
399
+
400
+ Cartesian3.multiplyByScalar(north, radius, north);
401
+ Cartesian3.multiplyByScalar(east, radius, east);
402
+
403
+ const south = Cartesian3.negate(north, fromBoundingSphereSouthScratch);
404
+ const west = Cartesian3.negate(east, fromBoundingSphereWestScratch);
405
+
406
+ const positions = fromBoundingSpherePositionsScratch;
407
+
408
+ // North
409
+ let corner = positions[0];
410
+ Cartesian3.add(center, north, corner);
411
+
412
+ // West
413
+ corner = positions[1];
414
+ Cartesian3.add(center, west, corner);
415
+
416
+ // South
417
+ corner = positions[2];
418
+ Cartesian3.add(center, south, corner);
419
+
420
+ // East
421
+ corner = positions[3];
422
+ Cartesian3.add(center, east, corner);
423
+
424
+ positions[4] = center;
425
+
426
+ return Rectangle.fromCartesianArray(positions, ellipsoid, result);
427
+ };
428
+
340
429
  /**
341
430
  * Duplicates a Rectangle.
342
431
  *
@@ -81,18 +81,34 @@ function urlFromScript(script) {
81
81
  function createWorker(url) {
82
82
  const uri = new Uri(url);
83
83
  const isUri = uri.scheme().length !== 0 && uri.fragment().length === 0;
84
+ const moduleID = url.replace(/\.js$/, "");
84
85
 
85
86
  const options = {};
86
87
  let workerPath;
88
+ let crossOriginUrl;
89
+
90
+ // If we are provided a fully resolved URL, check it is cross-origin
91
+ // Or if provided a module ID, check the full absolute URL instead.
87
92
  if (isCrossOriginUrl(url)) {
93
+ crossOriginUrl = url;
94
+ } else if (!isUri) {
95
+ const moduleAbsoluteUrl = buildModuleUrl(
96
+ `${TaskProcessor._workerModulePrefix}/${moduleID}.js`
97
+ );
98
+
99
+ if (isCrossOriginUrl(moduleAbsoluteUrl)) {
100
+ crossOriginUrl = moduleAbsoluteUrl;
101
+ }
102
+ }
103
+
104
+ if (crossOriginUrl) {
88
105
  // To load cross-origin, create a shim worker from a blob URL
89
- const script = `importScripts("${url}");`;
106
+ const script = `import "${crossOriginUrl}";`;
90
107
  workerPath = urlFromScript(script);
108
+ options.type = "module";
91
109
  return new Worker(workerPath, options);
92
110
  }
93
111
 
94
- const moduleID = url.replace(/\.js$/, "");
95
-
96
112
  /* global CESIUM_WORKERS */
97
113
  if (!isUri && typeof CESIUM_WORKERS !== "undefined") {
98
114
  // If the workers are embedded, create a shim worker from the embedded script data
@@ -20,7 +20,7 @@ import defined from "./defined.js";
20
20
  * @param {TerrainProvider} terrainProvider The terrain provider from which to query heights.
21
21
  * @param {number} level The terrain level-of-detail from which to query terrain heights.
22
22
  * @param {Cartographic[]} positions The positions to update with terrain heights.
23
- * @param {boolean} [rejectOnTileFail=false] If true, for a failed terrain tile request the promise will be rejected. If false, returned heights will be undefined.
23
+ * @param {boolean} [rejectOnTileFail=false] If true, for any failed terrain tile requests, the promise will be rejected. If false, returned heights will be undefined.
24
24
  * @returns {Promise<Cartographic[]>} A promise that resolves to the provided list of positions when terrain the query has completed.
25
25
  *
26
26
  * @see sampleTerrainMostDetailed
@@ -139,12 +139,12 @@ function drainTileRequestQueue(tileRequests, results, rejectOnTileFail) {
139
139
  rejectOnTileFail
140
140
  );
141
141
  if (success) {
142
- return drainTileRequestQueue(tileRequests, results);
142
+ return drainTileRequestQueue(tileRequests, results, rejectOnTileFail);
143
143
  }
144
144
 
145
145
  // wait a small fixed amount of time first, before retrying the same request again
146
146
  return delay(100).then(() => {
147
- return drainTileRequestQueue(tileRequests, results);
147
+ return drainTileRequestQueue(tileRequests, results, rejectOnTileFail);
148
148
  });
149
149
  }
150
150
 
@@ -325,6 +325,11 @@ DataSourceDisplay.prototype.update = function (time) {
325
325
  result = visualizers[x].update(time) && result;
326
326
  }
327
327
 
328
+ // Request a rendering of the scene when the data source
329
+ // becomes 'ready' for the first time
330
+ if (!this._ready && result) {
331
+ this._scene.requestRender();
332
+ }
328
333
  this._ready = result;
329
334
 
330
335
  return result;
@@ -369,21 +369,24 @@ ShaderBuilder.prototype.addAttribute = function (type, identifier) {
369
369
  *
370
370
  * @param {string} type The GLSL type of the varying
371
371
  * @param {string} identifier An identifier for the varying. Identifiers must begin with <code>v_</code> to be consistent with Cesium's style guide.
372
+ * @param {string} [qualifier] A qualifier for the varying, such as <code>flat</code>.
372
373
  *
373
374
  * @example
374
375
  * // creates the line "in vec3 v_color;" in the vertex shader
375
376
  * // creates the line "out vec3 v_color;" in the fragment shader
376
377
  * shaderBuilder.addVarying("vec3", "v_color");
377
378
  */
378
- ShaderBuilder.prototype.addVarying = function (type, identifier) {
379
+ ShaderBuilder.prototype.addVarying = function (type, identifier, qualifier) {
379
380
  //>>includeStart('debug', pragmas.debug);
380
381
  Check.typeOf.string("type", type);
381
382
  Check.typeOf.string("identifier", identifier);
382
383
  //>>includeEnd('debug');
383
384
 
385
+ qualifier = defined(qualifier) ? `${qualifier} ` : "";
386
+
384
387
  const line = `${type} ${identifier};`;
385
- this._vertexShaderParts.varyingLines.push(`out ${line}`);
386
- this._fragmentShaderParts.varyingLines.push(`in ${line}`);
388
+ this._vertexShaderParts.varyingLines.push(`${qualifier}out ${line}`);
389
+ this._fragmentShaderParts.varyingLines.push(`${qualifier}in ${line}`);
387
390
  };
388
391
 
389
392
  /**
@@ -4,7 +4,7 @@ import Resource from "../Core/Resource.js";
4
4
 
5
5
  let defaultTokenCredit;
6
6
  const defaultAccessToken =
7
- "AAPK3b7fccd1509046758d03c6641e404040gQG5edfR9eun2VcwtbXJKNbQjIZ7ma2vUd9ulqZK4lo3R_DJIAhwoGW9p86JNauB";
7
+ "AAPKe5e6f1571ad74096bfacbdf289c5cdb687BUrehhWYnNo9tN4coC66_qhHDNruh3ygZV90buspkWdOqZUq6tb0kCb_dms9Ir";
8
8
  /**
9
9
  * Default options for accessing the ArcGIS image tile service.
10
10
  *
@@ -28,7 +28,7 @@ import VerticalOrigin from "./VerticalOrigin.js";
28
28
  * Initialization options for the first param of Billboard constructor
29
29
  *
30
30
  * @property {Cartesian3} position The cartesian position of the billboard.
31
- * @property {string} [id] A user-defined object to return when the billboard is picked with {@link Scene#pick}.
31
+ * @property {*} [id] A user-defined object to return when the billboard is picked with {@link Scene#pick}.
32
32
  * @property {boolean} [show=true] Determines if this billboard will be shown.
33
33
  * @property {string | HTMLCanvasElement} [image] A loaded HTMLImageElement, ImageData, or a url to an image to use for the billboard.
34
34
  * @property {number} [scale=1.0] A number specifying the uniform scale that is multiplied with the billboard's image size in pixels.
@@ -892,7 +892,7 @@ Object.defineProperties(Billboard.prototype, {
892
892
  /**
893
893
  * Gets or sets the user-defined object returned when the billboard is picked.
894
894
  * @memberof Billboard.prototype
895
- * @type {object}
895
+ * @type {*}
896
896
  */
897
897
  id: {
898
898
  get: function () {
@@ -1139,7 +1139,7 @@ Billboard._updateClamping = function (collection, owner) {
1139
1139
  }
1140
1140
 
1141
1141
  function updateFunction(clampedPosition) {
1142
- owner._clampedPosition = ellipsoid.cartographicToCartesian(
1142
+ const updatedClampedPosition = ellipsoid.cartographicToCartesian(
1143
1143
  clampedPosition,
1144
1144
  owner._clampedPosition
1145
1145
  );
@@ -1149,12 +1149,14 @@ Billboard._updateClamping = function (collection, owner) {
1149
1149
  clampedPosition.height += position.height;
1150
1150
  ellipsoid.cartographicToCartesian(
1151
1151
  clampedPosition,
1152
- owner._clampedPosition
1152
+ updatedClampedPosition
1153
1153
  );
1154
1154
  } else {
1155
- owner._clampedPosition.x += position.height;
1155
+ updatedClampedPosition.x += position.height;
1156
1156
  }
1157
1157
  }
1158
+
1159
+ owner._clampedPosition = updatedClampedPosition;
1158
1160
  }
1159
1161
 
1160
1162
  owner._removeCallbackFunc = scene.updateHeight(
@@ -411,6 +411,16 @@ function Cesium3DTile(tileset, baseResource, header, parent) {
411
411
  */
412
412
  this.clippingPlanesDirty = false;
413
413
 
414
+ /**
415
+ * Tracks if the tile's relationship with a ClippingPolygonCollection has changed with regards
416
+ * to the ClippingPolygonCollection's state.
417
+ *
418
+ * @type {boolean}
419
+ *
420
+ * @private
421
+ */
422
+ this.clippingPolygonsDirty = false;
423
+
414
424
  /**
415
425
  * Tracks if the tile's request should be deferred until all non-deferred
416
426
  * tiles load.
@@ -481,7 +491,9 @@ function Cesium3DTile(tileset, baseResource, header, parent) {
481
491
  this._refines = false;
482
492
  this._shouldSelect = false;
483
493
  this._isClipped = true;
494
+ this._isClippedByPolygon = false;
484
495
  this._clippingPlanesState = 0; // encapsulates (_isClipped, clippingPlanes.enabled) and number/function
496
+ this._clippingPolygonsState = 0; // encapsulates (_isClipped, clippingPolygons.enabled) and number/function
485
497
  this._debugBoundingVolume = undefined;
486
498
  this._debugContentBoundingVolume = undefined;
487
499
  this._debugViewerRequestVolume = undefined;
@@ -1418,6 +1430,8 @@ Cesium3DTile.prototype.unloadContent = function () {
1418
1430
  this.lastStyleTime = 0.0;
1419
1431
  this.clippingPlanesDirty = this._clippingPlanesState === 0;
1420
1432
  this._clippingPlanesState = 0;
1433
+ this.clippingPolygonsDirty = this._clippingPolygonsState === 0;
1434
+ this._clippingPolygonsState = 0;
1421
1435
 
1422
1436
  this._debugColorizeTiles = false;
1423
1437
 
@@ -1516,6 +1530,17 @@ Cesium3DTile.prototype.visibility = function (
1516
1530
  }
1517
1531
  }
1518
1532
 
1533
+ const clippingPolygons = tileset.clippingPolygons;
1534
+ if (defined(clippingPolygons) && clippingPolygons.enabled) {
1535
+ const intersection = clippingPolygons.computeIntersectionWithBoundingVolume(
1536
+ boundingVolume
1537
+ );
1538
+
1539
+ this._isClippedByPolygon = intersection !== Intersect.OUTSIDE;
1540
+ // Polygon clipping intersections are determined by outer rectangles, therefore we cannot
1541
+ // preemptively determine if a tile is completely clipped or not here.
1542
+ }
1543
+
1519
1544
  return cullingVolume.computeVisibilityWithPlaneMask(
1520
1545
  boundingVolume,
1521
1546
  parentVisibilityPlaneMask
@@ -1562,6 +1587,17 @@ Cesium3DTile.prototype.contentVisibility = function (frameState) {
1562
1587
  }
1563
1588
  }
1564
1589
 
1590
+ const clippingPolygons = tileset.clippingPolygons;
1591
+ if (defined(clippingPolygons) && clippingPolygons.enabled) {
1592
+ const intersection = clippingPolygons.computeIntersectionWithBoundingVolume(
1593
+ boundingVolume
1594
+ );
1595
+ this._isClippedByPolygon = intersection !== Intersect.OUTSIDE;
1596
+ if (intersection === Intersect.INSIDE) {
1597
+ return Intersect.OUTSIDE;
1598
+ }
1599
+ }
1600
+
1565
1601
  return cullingVolume.computeVisibility(boundingVolume);
1566
1602
  };
1567
1603
 
@@ -2150,6 +2186,33 @@ function updateClippingPlanes(tile, tileset) {
2150
2186
  }
2151
2187
  }
2152
2188
 
2189
+ /**
2190
+ * Compute and compare ClippingPolygons state:
2191
+ * - enabled-ness - are clipping polygons enabled? is this tile clipped?
2192
+ * - clipping polygon count & position count
2193
+ * - clipping function (inverse)
2194
+
2195
+ * @private
2196
+ * @param {Cesium3DTile} tile
2197
+ * @param {Cesium3DTileset} tileset
2198
+ */
2199
+ function updateClippingPolygons(tile, tileset) {
2200
+ const clippingPolygons = tileset.clippingPolygons;
2201
+ let currentClippingPolygonsState = 0;
2202
+ if (
2203
+ defined(clippingPolygons) &&
2204
+ tile._isClippedByPolygon &&
2205
+ clippingPolygons.enabled
2206
+ ) {
2207
+ currentClippingPolygonsState = clippingPolygons.clippingPolygonsState;
2208
+ }
2209
+ // If clippingPolygonState for tile changed, mark clippingPolygonsDirty so content can update
2210
+ if (currentClippingPolygonsState !== tile._clippingPolygonsState) {
2211
+ tile._clippingPolygonsState = currentClippingPolygonsState;
2212
+ tile.clippingPolygonsDirty = true;
2213
+ }
2214
+ }
2215
+
2153
2216
  /**
2154
2217
  * Get the draw commands needed to render this tile.
2155
2218
  *
@@ -2163,6 +2226,7 @@ Cesium3DTile.prototype.update = function (tileset, frameState, passOptions) {
2163
2226
  const commandStart = commandList.length;
2164
2227
 
2165
2228
  updateClippingPlanes(this, tileset);
2229
+ updateClippingPolygons(this, tileset);
2166
2230
  applyDebugSettings(this, tileset, frameState, passOptions);
2167
2231
  updateContent(this, tileset, frameState);
2168
2232
 
@@ -2176,6 +2240,7 @@ Cesium3DTile.prototype.update = function (tileset, frameState, passOptions) {
2176
2240
  }
2177
2241
 
2178
2242
  this.clippingPlanesDirty = false; // reset after content update
2243
+ this.clippingPolygonsDirty = false;
2179
2244
  };
2180
2245
 
2181
2246
  const scratchCommandList = [];
@@ -41,6 +41,7 @@ import Cesium3DTilesetHeatmap from "./Cesium3DTilesetHeatmap.js";
41
41
  import Cesium3DTilesetStatistics from "./Cesium3DTilesetStatistics.js";
42
42
  import Cesium3DTileStyleEngine from "./Cesium3DTileStyleEngine.js";
43
43
  import ClippingPlaneCollection from "./ClippingPlaneCollection.js";
44
+ import ClippingPolygonCollection from "./ClippingPolygonCollection.js";
44
45
  import hasExtension from "./hasExtension.js";
45
46
  import ImplicitTileset from "./ImplicitTileset.js";
46
47
  import ImplicitTileCoordinates from "./ImplicitTileCoordinates.js";
@@ -97,6 +98,7 @@ import Ray from "../Core/Ray.js";
97
98
  * @property {boolean} [immediatelyLoadDesiredLevelOfDetail=false] When <code>skipLevelOfDetail</code> is <code>true</code>, only tiles that meet the maximum screen space error will ever be downloaded. Skipping factors are ignored and just the desired tiles are loaded.
98
99
  * @property {boolean} [loadSiblings=false] When <code>skipLevelOfDetail</code> is <code>true</code>, determines whether siblings of visible tiles are always downloaded during traversal.
99
100
  * @property {ClippingPlaneCollection} [clippingPlanes] The {@link ClippingPlaneCollection} used to selectively disable rendering the tileset.
101
+ * @property {ClippingPolygonCollection} [clippingPolygons] The {@link ClippingPolygonCollection} used to selectively disable rendering the tileset.
100
102
  * @property {ClassificationType} [classificationType] Determines whether terrain, 3D Tiles or both will be classified by this tileset. See {@link Cesium3DTileset#classificationType} for details about restrictions and limitations.
101
103
  * @property {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid determining the size and shape of the globe.
102
104
  * @property {object} [pointCloudShading] Options for constructing a {@link PointCloudShading} object to control point attenuation based on geometric error and lighting.
@@ -800,7 +802,22 @@ function Cesium3DTileset(options) {
800
802
  this.loadSiblings = defaultValue(options.loadSiblings, false);
801
803
 
802
804
  this._clippingPlanes = undefined;
803
- this.clippingPlanes = options.clippingPlanes;
805
+ if (defined(options.clippingPlanes)) {
806
+ ClippingPlaneCollection.setOwner(
807
+ options.clippingPlanes,
808
+ this,
809
+ "_clippingPlanes"
810
+ );
811
+ }
812
+
813
+ this._clippingPolygons = undefined;
814
+ if (defined(options.clippingPolygons)) {
815
+ ClippingPolygonCollection.setOwner(
816
+ options.clippingPolygons,
817
+ this,
818
+ "_clippingPolygons"
819
+ );
820
+ }
804
821
 
805
822
  if (defined(options.imageBasedLighting)) {
806
823
  this._imageBasedLighting = options.imageBasedLighting;
@@ -1120,6 +1137,22 @@ Object.defineProperties(Cesium3DTileset.prototype, {
1120
1137
  },
1121
1138
  },
1122
1139
 
1140
+ /**
1141
+ * The {@link ClippingPolygonCollection} used to selectively disable rendering the tileset.
1142
+ *
1143
+ * @memberof Cesium3DTileset.prototype
1144
+ *
1145
+ * @type {ClippingPolygonCollection}
1146
+ */
1147
+ clippingPolygons: {
1148
+ get: function () {
1149
+ return this._clippingPolygons;
1150
+ },
1151
+ set: function (value) {
1152
+ ClippingPolygonCollection.setOwner(value, this, "_clippingPolygons");
1153
+ },
1154
+ },
1155
+
1123
1156
  /**
1124
1157
  * Gets the tileset's properties dictionary object, which contains metadata about per-feature properties.
1125
1158
  * <p>
@@ -2519,6 +2552,12 @@ Cesium3DTileset.prototype.prePassesUpdate = function (frameState) {
2519
2552
  clippingPlanes.update(frameState);
2520
2553
  }
2521
2554
 
2555
+ // Update clipping polygons
2556
+ const clippingPolygons = this._clippingPolygons;
2557
+ if (defined(clippingPolygons) && clippingPolygons.enabled) {
2558
+ clippingPolygons.update(frameState);
2559
+ }
2560
+
2522
2561
  if (!defined(this._loadTimestamp)) {
2523
2562
  this._loadTimestamp = JulianDate.clone(frameState.time);
2524
2563
  }
@@ -3372,6 +3411,12 @@ Cesium3DTileset.prototype.updateForPass = function (
3372
3411
  originalCullingVolume
3373
3412
  );
3374
3413
 
3414
+ // Update clipping polygons
3415
+ const clippingPolygons = this._clippingPolygons;
3416
+ if (defined(clippingPolygons) && clippingPolygons.enabled) {
3417
+ clippingPolygons.queueCommands(frameState);
3418
+ }
3419
+
3375
3420
  const passStatistics = this._statisticsPerPass[pass];
3376
3421
 
3377
3422
  if (this.show || ignoreCommands) {
@@ -3440,6 +3485,8 @@ Cesium3DTileset.prototype.destroy = function () {
3440
3485
  this._tileDebugLabels =
3441
3486
  this._tileDebugLabels && this._tileDebugLabels.destroy();
3442
3487
  this._clippingPlanes = this._clippingPlanes && this._clippingPlanes.destroy();
3488
+ this._clippingPolygons =
3489
+ this._clippingPolygons && this._clippingPolygons.destroy();
3443
3490
 
3444
3491
  // Traverse the tree and destroy all tiles
3445
3492
  if (defined(this._root)) {