@cesium/engine 8.0.0 → 9.1.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 (192) hide show
  1. package/Build/ThirdParty/Workers/z-worker-pako.js +7 -10
  2. package/Build/Workers/{chunk-F4HFJMGM.js → chunk-2CSEEWHN.js} +6 -6
  3. package/Build/Workers/{chunk-7TC63SJW.js → chunk-34DGOKCO.js} +10 -12
  4. package/Build/Workers/{chunk-7ZFGPDJA.js → chunk-3RZK5NNV.js} +4 -4
  5. package/Build/Workers/{chunk-M7ERACJJ.js → chunk-3S2MFY4B.js} +13 -13
  6. package/Build/Workers/{chunk-BROJAZRZ.js → chunk-4AJGCQFX.js} +13 -13
  7. package/Build/Workers/{chunk-2FWRMUTY.js → chunk-4KIUON73.js} +4 -4
  8. package/Build/Workers/{chunk-5QULIR53.js → chunk-4PHPQRSH.js} +4 -4
  9. package/Build/Workers/{chunk-X4356LRH.js → chunk-66E3H2KU.js} +12 -12
  10. package/Build/Workers/{chunk-G43QFN4Q.js → chunk-6HCAQOVK.js} +6 -6
  11. package/Build/Workers/{chunk-23UFSGND.js → chunk-7LPEGKOF.js} +7 -7
  12. package/Build/Workers/{chunk-DDUQAJ4P.js → chunk-7VZNXIKG.js} +7 -7
  13. package/Build/Workers/{chunk-JURN7NPV.js → chunk-A6NCZSL3.js} +19 -19
  14. package/Build/Workers/{chunk-ZT7KWISZ.js → chunk-AOFMPKUB.js} +4 -4
  15. package/Build/Workers/{chunk-BIKA3NRA.js → chunk-AOIKO5Y7.js} +5 -5
  16. package/Build/Workers/{chunk-YWTJ2B4B.js → chunk-BDUJXBVF.js} +1 -1
  17. package/Build/Workers/{chunk-OGXZVPPM.js → chunk-C5CE4OG6.js} +469 -6
  18. package/Build/Workers/{chunk-FNIRWHJB.js → chunk-CE6GTZ4I.js} +11 -13
  19. package/Build/Workers/{chunk-SH5USDPI.js → chunk-CYAJYEKW.js} +6 -6
  20. package/Build/Workers/{chunk-Y5UQJLYE.js → chunk-FOZQIHZK.js} +6 -6
  21. package/Build/Workers/{chunk-2FRVPMCS.js → chunk-G7CJQKKD.js} +7 -7
  22. package/Build/Workers/{chunk-EERJKOAF.js → chunk-GIFJ77E4.js} +4 -4
  23. package/Build/Workers/{chunk-FJKNFAKQ.js → chunk-I5TDPPC4.js} +7197 -5096
  24. package/Build/Workers/{chunk-3VAZEH7M.js → chunk-IBXGK4WV.js} +2 -2
  25. package/Build/Workers/{chunk-VOXYEYJT.js → chunk-JI2445T5.js} +11 -11
  26. package/Build/Workers/{chunk-PGSJK77E.js → chunk-KPY4F4BW.js} +6 -6
  27. package/Build/Workers/{chunk-I46ZRR5W.js → chunk-LVJCR7DH.js} +17 -17
  28. package/Build/Workers/{chunk-T3XIFPYR.js → chunk-LW7WGHEU.js} +16 -16
  29. package/Build/Workers/{chunk-HU6N6EXB.js → chunk-MWYZ64MH.js} +12 -11
  30. package/Build/Workers/chunk-NI2R52QD.js +961 -0
  31. package/Build/Workers/{chunk-SOWMRMWA.js → chunk-PEABJLCK.js} +1 -1
  32. package/Build/Workers/{chunk-EG6PTBY2.js → chunk-PK7TEP3J.js} +15 -15
  33. package/Build/Workers/{chunk-GRC2ZTAF.js → chunk-POLFRINT.js} +14 -14
  34. package/Build/Workers/{chunk-Z3TIFFGF.js → chunk-PS6AEMBR.js} +7 -7
  35. package/Build/Workers/{chunk-Y2ME2IJV.js → chunk-PWF3YJJ5.js} +13 -13
  36. package/Build/Workers/{chunk-2A75IWRS.js → chunk-QKF7XXEQ.js} +7 -7
  37. package/Build/Workers/{chunk-4H7PY4U5.js → chunk-RL73GOEF.js} +2 -2
  38. package/Build/Workers/{chunk-MDWEGWPA.js → chunk-RR7EOKGZ.js} +10 -10
  39. package/Build/Workers/{chunk-F3YA3Y2Z.js → chunk-S4XDCPKD.js} +1 -1
  40. package/Build/Workers/{chunk-PPH7OFP3.js → chunk-TMMOULW3.js} +5 -5
  41. package/Build/Workers/{chunk-XGI5BXZY.js → chunk-U4IMCOF5.js} +2 -2
  42. package/Build/Workers/{chunk-4DO5W5XZ.js → chunk-UAJEGIWA.js} +6 -6
  43. package/Build/Workers/{chunk-BBWDMCVU.js → chunk-UCPPWV64.js} +1 -1
  44. package/Build/Workers/{chunk-FZRIVR7Y.js → chunk-V7JB576Q.js} +5 -5
  45. package/Build/Workers/{chunk-2UPKWTMJ.js → chunk-WEGCQ5DY.js} +6 -6
  46. package/Build/Workers/{chunk-STW2DGFI.js → chunk-WFICTTOE.js} +2 -2
  47. package/Build/Workers/{chunk-LPR3YNP2.js → chunk-WWP3I7R5.js} +5 -5
  48. package/Build/Workers/{chunk-A5DWLWCY.js → chunk-XHLDDE65.js} +10 -10
  49. package/Build/Workers/{chunk-UEXTBDBE.js → chunk-XWML5Y7N.js} +11 -13
  50. package/Build/Workers/{chunk-EHWHNOEX.js → chunk-YLZTCEBJ.js} +1 -1
  51. package/Build/Workers/{chunk-34FXV7D7.js → chunk-ZC4AGBZK.js} +2 -2
  52. package/Build/Workers/{chunk-GATZHF3K.js → chunk-ZDP32RQI.js} +2 -2
  53. package/Build/Workers/{chunk-KKCR2YOP.js → chunk-ZWPIM77Q.js} +11 -11
  54. package/Build/Workers/combineGeometry.js +22 -24
  55. package/Build/Workers/createBoxGeometry.js +16 -18
  56. package/Build/Workers/createBoxOutlineGeometry.js +14 -16
  57. package/Build/Workers/createCircleGeometry.js +24 -26
  58. package/Build/Workers/createCircleOutlineGeometry.js +17 -19
  59. package/Build/Workers/createCoplanarPolygonGeometry.js +33 -34
  60. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +29 -31
  61. package/Build/Workers/createCorridorGeometry.js +27 -29
  62. package/Build/Workers/createCorridorOutlineGeometry.js +26 -28
  63. package/Build/Workers/createCylinderGeometry.js +18 -20
  64. package/Build/Workers/createCylinderOutlineGeometry.js +16 -18
  65. package/Build/Workers/createEllipseGeometry.js +24 -26
  66. package/Build/Workers/createEllipseOutlineGeometry.js +17 -19
  67. package/Build/Workers/createEllipsoidGeometry.js +17 -19
  68. package/Build/Workers/createEllipsoidOutlineGeometry.js +16 -18
  69. package/Build/Workers/createFrustumGeometry.js +16 -18
  70. package/Build/Workers/createFrustumOutlineGeometry.js +18 -19
  71. package/Build/Workers/createGeometry.js +23 -25
  72. package/Build/Workers/createGroundPolylineGeometry.js +23 -25
  73. package/Build/Workers/createPlaneGeometry.js +14 -16
  74. package/Build/Workers/createPlaneOutlineGeometry.js +13 -15
  75. package/Build/Workers/createPolygonGeometry.js +33 -35
  76. package/Build/Workers/createPolygonOutlineGeometry.js +28 -30
  77. package/Build/Workers/createPolylineGeometry.js +23 -25
  78. package/Build/Workers/createPolylineVolumeGeometry.js +29 -31
  79. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +25 -27
  80. package/Build/Workers/createRectangleGeometry.js +27 -29
  81. package/Build/Workers/createRectangleOutlineGeometry.js +18 -20
  82. package/Build/Workers/createSimplePolylineGeometry.js +21 -23
  83. package/Build/Workers/createSphereGeometry.js +17 -19
  84. package/Build/Workers/createSphereOutlineGeometry.js +16 -18
  85. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  86. package/Build/Workers/createVectorTileClampedPolylines.js +14 -16
  87. package/Build/Workers/createVectorTileGeometries.js +22 -24
  88. package/Build/Workers/createVectorTilePoints.js +12 -12
  89. package/Build/Workers/createVectorTilePolygons.js +20 -22
  90. package/Build/Workers/createVectorTilePolylines.js +14 -16
  91. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +23 -25
  92. package/Build/Workers/createVerticesFromHeightmap.js +23 -25
  93. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +19 -22
  94. package/Build/Workers/createWallGeometry.js +22 -24
  95. package/Build/Workers/createWallOutlineGeometry.js +21 -23
  96. package/Build/Workers/decodeDraco.js +11 -11
  97. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  98. package/Build/Workers/decodeI3S.js +10 -11
  99. package/Build/Workers/transcodeKTX2.js +8 -8
  100. package/Build/Workers/transferTypedArrayTest.js +1 -1
  101. package/Build/Workers/upsampleQuantizedTerrainMesh.js +20 -22
  102. package/Source/Core/Check.d.ts +127 -0
  103. package/Source/Core/Check.js +0 -1
  104. package/Source/Core/Geometry.js +1 -1
  105. package/Source/Core/Ion.js +1 -1
  106. package/Source/Core/PixelFormat.js +1 -0
  107. package/Source/Core/PolygonGeometry.js +1 -1
  108. package/Source/Core/Rectangle.js +89 -0
  109. package/Source/Core/VerticalExaggeration.js +2 -1
  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 +37 -3
  114. package/Source/Scene/BillboardCollection.js +1 -1
  115. package/Source/Scene/BingMapsImageryProvider.js +4 -0
  116. package/Source/Scene/Cesium3DTile.js +65 -0
  117. package/Source/Scene/Cesium3DTilesVoxelProvider.js +2 -9
  118. package/Source/Scene/Cesium3DTileset.js +52 -40
  119. package/Source/Scene/ClippingPolygon.js +212 -0
  120. package/Source/Scene/ClippingPolygonCollection.js +968 -0
  121. package/Source/Scene/Globe.js +14 -67
  122. package/Source/Scene/GlobeSurfaceShaderSet.js +81 -15
  123. package/Source/Scene/GlobeSurfaceTileProvider.js +81 -1
  124. package/Source/Scene/Label.js +33 -0
  125. package/Source/Scene/LabelCollection.js +2 -1
  126. package/Source/Scene/Model/Model.js +83 -0
  127. package/Source/Scene/Model/Model3DTileContent.js +21 -0
  128. package/Source/Scene/Model/ModelClippingPolygonsPipelineStage.js +92 -0
  129. package/Source/Scene/Model/ModelSceneGraph.js +5 -0
  130. package/Source/Scene/Primitive.js +0 -3
  131. package/Source/Scene/SensorVolumePortionToDisplay.js +1 -1
  132. package/Source/Scene/Terrain.js +2 -2
  133. package/Source/Scene/VoxelBoxShape.js +0 -15
  134. package/Source/Scene/VoxelCylinderShape.js +14 -131
  135. package/Source/Scene/VoxelEllipsoidShape.js +136 -227
  136. package/Source/Scene/VoxelPrimitive.js +106 -14
  137. package/Source/Scene/VoxelRenderResources.js +9 -3
  138. package/Source/Scene/VoxelShape.js +0 -10
  139. package/Source/Scene/processVoxelProperties.js +1 -0
  140. package/Source/Shaders/Builtin/CzmBuiltins.js +4 -0
  141. package/Source/Shaders/Builtin/Functions/clipPolygons.glsl +37 -0
  142. package/Source/Shaders/Builtin/Functions/clipPolygons.js +39 -0
  143. package/Source/Shaders/Builtin/Functions/unpackClippingExtents.glsl +14 -0
  144. package/Source/Shaders/Builtin/Functions/unpackClippingExtents.js +15 -0
  145. package/Source/Shaders/GlobeFS.glsl +12 -0
  146. package/Source/Shaders/GlobeFS.js +12 -0
  147. package/Source/Shaders/GlobeVS.glsl +32 -0
  148. package/Source/Shaders/GlobeVS.js +32 -0
  149. package/Source/Shaders/Model/GeometryStageVS.glsl +1 -1
  150. package/Source/Shaders/Model/GeometryStageVS.js +1 -1
  151. package/Source/Shaders/Model/ModelClippingPolygonsStageFS.glsl +6 -0
  152. package/Source/Shaders/Model/ModelClippingPolygonsStageFS.js +8 -0
  153. package/Source/Shaders/Model/ModelClippingPolygonsStageVS.glsl +27 -0
  154. package/Source/Shaders/Model/ModelClippingPolygonsStageVS.js +29 -0
  155. package/Source/Shaders/Model/ModelFS.glsl +6 -0
  156. package/Source/Shaders/Model/ModelFS.js +7 -1
  157. package/Source/Shaders/Model/ModelVS.glsl +4 -0
  158. package/Source/Shaders/Model/ModelVS.js +4 -0
  159. package/Source/Shaders/PolygonSignedDistanceFS.glsl +100 -0
  160. package/Source/Shaders/PolygonSignedDistanceFS.js +101 -0
  161. package/Source/Shaders/Voxels/IntersectBox.glsl +21 -47
  162. package/Source/Shaders/Voxels/IntersectBox.js +21 -47
  163. package/Source/Shaders/Voxels/IntersectClippingPlanes.glsl +1 -1
  164. package/Source/Shaders/Voxels/IntersectClippingPlanes.js +1 -1
  165. package/Source/Shaders/Voxels/IntersectCylinder.glsl +66 -96
  166. package/Source/Shaders/Voxels/IntersectCylinder.js +66 -96
  167. package/Source/Shaders/Voxels/IntersectEllipsoid.glsl +226 -154
  168. package/Source/Shaders/Voxels/IntersectEllipsoid.js +226 -154
  169. package/Source/Shaders/Voxels/IntersectionUtils.glsl +33 -11
  170. package/Source/Shaders/Voxels/IntersectionUtils.js +33 -11
  171. package/Source/Shaders/Voxels/Megatexture.glsl +1 -2
  172. package/Source/Shaders/Voxels/Megatexture.js +1 -2
  173. package/Source/Shaders/Voxels/Octree.glsl +14 -9
  174. package/Source/Shaders/Voxels/Octree.js +14 -9
  175. package/Source/Shaders/Voxels/VoxelFS.glsl +93 -43
  176. package/Source/Shaders/Voxels/VoxelFS.js +93 -43
  177. package/Source/Shaders/Voxels/VoxelUtils.glsl +31 -0
  178. package/Source/Shaders/Voxels/VoxelUtils.js +33 -0
  179. package/Source/Shaders/Voxels/convertUvToBox.glsl +24 -3
  180. package/Source/Shaders/Voxels/convertUvToBox.js +24 -4
  181. package/Source/Shaders/Voxels/convertUvToCylinder.glsl +50 -8
  182. package/Source/Shaders/Voxels/convertUvToCylinder.js +50 -8
  183. package/Source/Shaders/Voxels/convertUvToEllipsoid.glsl +82 -53
  184. package/Source/Shaders/Voxels/convertUvToEllipsoid.js +82 -53
  185. package/Source/ThirdParty/Workers/z-worker-pako.js +1 -1
  186. package/Source/Workers/createGeometry.js +1 -1
  187. package/index.d.ts +478 -35
  188. package/index.js +61 -52
  189. package/package.json +2 -2
  190. package/Build/Workers/chunk-BG4UCVXN.js +0 -73
  191. package/Build/Workers/chunk-TTUZP4BO.js +0 -501
  192. package/Build/Workers/chunk-YJEBABKH.js +0 -2977
@@ -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
  *
@@ -1,4 +1,5 @@
1
1
  import Cartesian3 from "./Cartesian3.js";
2
+ import Cartographic from "./Cartographic.js";
2
3
  import DeveloperError from "./DeveloperError.js";
3
4
  import defined from "./defined.js";
4
5
 
@@ -26,7 +27,7 @@ VerticalExaggeration.getHeight = function (height, scale, relativeHeight) {
26
27
  return (height - relativeHeight) * scale + relativeHeight;
27
28
  };
28
29
 
29
- const scratchCartographic = new Cartesian3();
30
+ const scratchCartographic = new Cartographic();
30
31
 
31
32
  /**
32
33
  * Scales a position by exaggeration.
@@ -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
- "AAPKc6e43bbc520149f79229d173c04883558jat1YV8r6Xjl50ulCDeLTkHzW0vzUC-9m6ASQvGmPbo4-xY_kAzsJxJZm-j_Unr";
7
+ "AAPK809db8a668914f14bf886dcf16d4dc82Hm5SsO4xOJY2n4-V_ypQyxlGKJRQugNnPIslyTLkk5-HHQl9BRpgdNXaKNGe7oxx";
8
8
  /**
9
9
  * Default options for accessing the ArcGIS image tile service.
10
10
  *
@@ -22,6 +22,35 @@ import SceneMode from "./SceneMode.js";
22
22
  import SceneTransforms from "./SceneTransforms.js";
23
23
  import VerticalOrigin from "./VerticalOrigin.js";
24
24
 
25
+ /**
26
+ * @typedef {object} Billboard.ConstructorOptions
27
+ *
28
+ * Initialization options for the first param of Billboard constructor
29
+ *
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}.
32
+ * @property {boolean} [show=true] Determines if this billboard will be shown.
33
+ * @property {string | HTMLCanvasElement} [image] A loaded HTMLImageElement, ImageData, or a url to an image to use for the billboard.
34
+ * @property {number} [scale=1.0] A number specifying the uniform scale that is multiplied with the billboard's image size in pixels.
35
+ * @property {Cartesian2} [pixelOffset=Cartesian2.ZERO] A {@link Cartesian2} Specifying the pixel offset in screen space from the origin of this billboard.
36
+ * @property {Cartesian3} [eyeOffset=Cartesian3.ZERO] A {@link Cartesian3} Specifying the 3D Cartesian offset applied to this billboard in eye coordinates.
37
+ * @property {HorizontalOrigin} [horizontalOrigin=HorizontalOrigin.CENTER] A {@link HorizontalOrigin} Specifying the horizontal origin of this billboard.
38
+ * @property {VerticalOrigin} [verticalOrigin=VerticalOrigin.CENTER] A {@link VerticalOrigin} Specifying the vertical origin of this billboard.
39
+ * @property {HeightReference} [heightReference=HeightReference.NONE] A {@link HeightReference} Specifying the height reference of this billboard.
40
+ * @property {Color} [color=Color.WHITE] A {@link Color} Specifying the color that is multiplied with the billboard's texture.
41
+ * @property {number} [rotation=0] A number specifying the rotation angle in radians.
42
+ * @property {Cartesian3} [alignedAxis=Cartesian3.ZERO] A {@link Cartesian3} Specifying the aligned axis in world space.
43
+ * @property {boolean} [sizeInMeters] A boolean specifying if the billboard size is in meters or pixels.
44
+ * @property {number} [width] A number specifying the width of the billboard. If undefined, the image width will be used.
45
+ * @property {number} [height] A number specifying the height of the billboard. If undefined, the image height will be used.
46
+ * @property {NearFarScalar} [scaleByDistance] A {@link NearFarScalar} Specifying near and far scaling properties of a Billboard based on the billboard's distance from the camera.
47
+ * @property {NearFarScalar} [translucencyByDistance] A {@link NearFarScalar} Specifying near and far translucency properties of a Billboard based on the billboard's distance from the camera.
48
+ * @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.
49
+ * @property {BoundingRectangle} [imageSubRegion] A {@link BoundingRectangle} Specifying the sub-region of the image to use for the billboard, rather than the entire image.
50
+ * @property {DistanceDisplayCondition} [distanceDisplayCondition] A {@link DistanceDisplayCondition} Specifying the distance from the camera at which this billboard will be displayed.
51
+ * @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.
52
+ */
53
+
25
54
  /**
26
55
  * <div class="notice">
27
56
  * A billboard is created and its initial
@@ -56,6 +85,9 @@ import VerticalOrigin from "./VerticalOrigin.js";
56
85
  * @internalConstructor
57
86
  * @class
58
87
  *
88
+ * @param {Billboard.ConstructorOptions} options Object describing initialization options
89
+ * @param {BillboardCollection} billboardCollection Instance of BillboardCollection
90
+ *
59
91
  * @demo {@link https://sandcastle.cesium.com/index.html?src=Billboards.html|Cesium Sandcastle Billboard Demo}
60
92
  */
61
93
  function Billboard(options, billboardCollection) {
@@ -1107,7 +1139,7 @@ Billboard._updateClamping = function (collection, owner) {
1107
1139
  }
1108
1140
 
1109
1141
  function updateFunction(clampedPosition) {
1110
- owner._clampedPosition = ellipsoid.cartographicToCartesian(
1142
+ const updatedClampedPosition = ellipsoid.cartographicToCartesian(
1111
1143
  clampedPosition,
1112
1144
  owner._clampedPosition
1113
1145
  );
@@ -1117,12 +1149,14 @@ Billboard._updateClamping = function (collection, owner) {
1117
1149
  clampedPosition.height += position.height;
1118
1150
  ellipsoid.cartographicToCartesian(
1119
1151
  clampedPosition,
1120
- owner._clampedPosition
1152
+ updatedClampedPosition
1121
1153
  );
1122
1154
  } else {
1123
- owner._clampedPosition.x += position.height;
1155
+ updatedClampedPosition.x += position.height;
1124
1156
  }
1125
1157
  }
1158
+
1159
+ owner._clampedPosition = updatedClampedPosition;
1126
1160
  }
1127
1161
 
1128
1162
  owner._removeCallbackFunc = scene.updateHeight(
@@ -426,7 +426,7 @@ function destroyBillboards(billboards) {
426
426
  * Creates and adds a billboard with the specified initial properties to the collection.
427
427
  * The added billboard is returned so it can be modified or removed from the collection later.
428
428
  *
429
- * @param {object}[options] A template describing the billboard's properties as shown in Example 1.
429
+ * @param {Billboard.ConstructorOptions}[options] A template describing the billboard's properties as shown in Example 1.
430
430
  * @returns {Billboard} The billboard that was added to the collection.
431
431
  *
432
432
  * @performance Calling <code>add</code> is expected constant time. However, the collection's vertex buffer
@@ -500,6 +500,10 @@ BingMapsImageryProvider.fromUrl = async function (url, options) {
500
500
  queryParameters.mapLayer = options.mapLayer;
501
501
  }
502
502
 
503
+ if (defined(options.culture)) {
504
+ queryParameters.culture = options.culture;
505
+ }
506
+
503
507
  const metadataResource = resource.getDerivedResource({
504
508
  url: `REST/v1/Imagery/Metadata/${mapStyle}`,
505
509
  queryParameters: queryParameters,
@@ -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 = [];
@@ -247,15 +247,8 @@ function getEllipsoidShape(region) {
247
247
 
248
248
  const shapeTransform = Matrix4.fromScale(Ellipsoid.WGS84.radii);
249
249
 
250
- const minBoundsX = west;
251
- const maxBoundsX = east;
252
- const minBoundsY = south;
253
- const maxBoundsY = north;
254
- const minBoundsZ = minHeight;
255
- const maxBoundsZ = maxHeight;
256
-
257
- const minBounds = new Cartesian3(minBoundsX, minBoundsY, minBoundsZ);
258
- const maxBounds = new Cartesian3(maxBoundsX, maxBoundsY, maxBoundsZ);
250
+ const minBounds = new Cartesian3(west, south, minHeight);
251
+ const maxBounds = new Cartesian3(east, north, maxHeight);
259
252
 
260
253
  return {
261
254
  shape: VoxelShapeType.ELLIPSOID,
@@ -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.
@@ -113,7 +115,6 @@ import Ray from "../Core/Ray.js";
113
115
  * @property {boolean} [showCreditsOnScreen=false] Whether to display the credits of this tileset on screen.
114
116
  * @property {SplitDirection} [splitDirection=SplitDirection.NONE] The {@link SplitDirection} split to apply to this tileset.
115
117
  * @property {boolean} [enableCollision=false] When <code>true</code>, enables collisions for camera or CPU picking. While this is <code>true</code> the camera will be prevented from going below the tileset surface if {@link ScreenSpaceCameraController#enableCollisionDetection} is true.
116
- * @property {boolean} [disableCollision=true] Whether to turn off collisions for camera collisions or picking. While this is <code>true</code> the camera will be allowed to go in or below the tileset surface if {@link ScreenSpaceCameraController#enableCollisionDetection} is true. Deprecated.
117
118
  * @property {boolean} [projectTo2D=false] Whether to accurately project the tileset to 2D. If this is true, the tileset will be projected accurately to 2D, but it will use more memory to do so. If this is false, the tileset will use less memory and will still render in 2D / CV mode, but its projected positions may be inaccurate. This cannot be set after the tileset has been created.
118
119
  * @property {boolean} [enablePick=false] Whether to allow collision and CPU picking with <code>pick</code> when using WebGL 1. If using WebGL 2 or above, this option will be ignored. If using WebGL 1 and this is true, the <code>pick</code> operation will work correctly, but it will use more memory to do so. If running with WebGL 1 and this is false, the model will use less memory, but <code>pick</code> will always return <code>undefined</code>. This cannot be set after the tileset has loaded.
119
120
  * @property {string} [debugHeatmapTilePropertyName] The tile variable to colorize as a heatmap. All rendered tiles will be colorized relative to each other's specified variable value.
@@ -801,7 +802,22 @@ function Cesium3DTileset(options) {
801
802
  this.loadSiblings = defaultValue(options.loadSiblings, false);
802
803
 
803
804
  this._clippingPlanes = undefined;
804
- 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
+ }
805
821
 
806
822
  if (defined(options.imageBasedLighting)) {
807
823
  this._imageBasedLighting = options.imageBasedLighting;
@@ -871,16 +887,6 @@ function Cesium3DTileset(options) {
871
887
  * @default false
872
888
  */
873
889
  this.enableCollision = defaultValue(options.enableCollision, false);
874
-
875
- if (defined(options.disableCollision)) {
876
- deprecationWarning(
877
- "Cesium3DTileset options.disableCollision",
878
- "Cesium3DTileset options.disableCollision has been deprecated in CesiumJS 1.115. It will be removed in CesiumJS 1.116. Use options.enableCollision instead."
879
- );
880
-
881
- this.enableCollision = !options.disableCollision;
882
- }
883
-
884
890
  this._projectTo2D = defaultValue(options.projectTo2D, false);
885
891
  this._enablePick = defaultValue(options.enablePick, false);
886
892
 
@@ -1083,34 +1089,6 @@ Object.defineProperties(Cesium3DTileset.prototype, {
1083
1089
  },
1084
1090
  },
1085
1091
 
1086
- /**
1087
- * Whether to turn off collisions for camera collisions or picking. While this is <code>true</code> the camera will be allowed to go in or below the tileset surface if {@link ScreenSpaceCameraController#enableCollisionDetection} is true.
1088
- * @memberof Cesium3DTileset.prototype
1089
- *
1090
- * @type {boolean}
1091
- * @default true
1092
- *
1093
- * @deprecated
1094
- */
1095
- disableCollision: {
1096
- get: function () {
1097
- deprecationWarning(
1098
- "Cesium3DTileset.disableCollision",
1099
- "Cesium3DTileset.disableCollision has been deprecated in CesiumJS 1.115. It will be removed in CesiumJS 1.116. Use Cesium3DTileset.enableCollision instead."
1100
- );
1101
-
1102
- return !this.enableCollision;
1103
- },
1104
- set: function (value) {
1105
- deprecationWarning(
1106
- "Cesium3DTileset.disableCollision",
1107
- "Cesium3DTileset.disableCollision has been deprecated in CesiumJS 1.115. It will be removed in CesiumJS 1.116. Use Cesium3DTileset.enableCollision instead."
1108
- );
1109
-
1110
- this.enableCollision = !value;
1111
- },
1112
- },
1113
-
1114
1092
  /**
1115
1093
  * Gets the tileset's asset object property, which contains metadata about the tileset.
1116
1094
  * <p>
@@ -1159,6 +1137,22 @@ Object.defineProperties(Cesium3DTileset.prototype, {
1159
1137
  },
1160
1138
  },
1161
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
+
1162
1156
  /**
1163
1157
  * Gets the tileset's properties dictionary object, which contains metadata about per-feature properties.
1164
1158
  * <p>
@@ -2558,6 +2552,12 @@ Cesium3DTileset.prototype.prePassesUpdate = function (frameState) {
2558
2552
  clippingPlanes.update(frameState);
2559
2553
  }
2560
2554
 
2555
+ // Update clipping polygons
2556
+ const clippingPolygons = this._clippingPolygons;
2557
+ if (defined(clippingPolygons) && clippingPolygons.enabled) {
2558
+ clippingPolygons.update(frameState);
2559
+ }
2560
+
2561
2561
  if (!defined(this._loadTimestamp)) {
2562
2562
  this._loadTimestamp = JulianDate.clone(frameState.time);
2563
2563
  }
@@ -2677,6 +2677,10 @@ const scratchUpdateHeightCartographic = new Cartographic();
2677
2677
  const scratchUpdateHeightCartographic2 = new Cartographic();
2678
2678
  const scratchUpdateHeightCartesian = new Cartesian3();
2679
2679
  function processUpdateHeight(tileset, tile, frameState) {
2680
+ if (!tileset.enableCollision || !tileset.show) {
2681
+ return;
2682
+ }
2683
+
2680
2684
  const heightCallbackData = tileset._addHeightCallbacks;
2681
2685
  const boundingSphere = tile.boundingSphere;
2682
2686
 
@@ -3407,6 +3411,12 @@ Cesium3DTileset.prototype.updateForPass = function (
3407
3411
  originalCullingVolume
3408
3412
  );
3409
3413
 
3414
+ // Update clipping polygons
3415
+ const clippingPolygons = this._clippingPolygons;
3416
+ if (defined(clippingPolygons) && clippingPolygons.enabled) {
3417
+ clippingPolygons.queueCommands(frameState);
3418
+ }
3419
+
3410
3420
  const passStatistics = this._statisticsPerPass[pass];
3411
3421
 
3412
3422
  if (this.show || ignoreCommands) {
@@ -3475,6 +3485,8 @@ Cesium3DTileset.prototype.destroy = function () {
3475
3485
  this._tileDebugLabels =
3476
3486
  this._tileDebugLabels && this._tileDebugLabels.destroy();
3477
3487
  this._clippingPlanes = this._clippingPlanes && this._clippingPlanes.destroy();
3488
+ this._clippingPolygons =
3489
+ this._clippingPolygons && this._clippingPolygons.destroy();
3478
3490
 
3479
3491
  // Traverse the tree and destroy all tiles
3480
3492
  if (defined(this._root)) {