@cesium/engine 22.0.0 → 22.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 (151) hide show
  1. package/Build/ThirdParty/Workers/zip-web-worker.js +10 -7
  2. package/Build/Workers/chunk-23T2IPHV.js +55 -0
  3. package/Build/Workers/{chunk-VVZ667H6.js → chunk-2AM4E2WD.js} +2 -2
  4. package/Build/Workers/{chunk-XQ347YWU.js → chunk-2MWF4IES.js} +16 -14
  5. package/Build/Workers/{chunk-75HAJIDT.js → chunk-2RCIRXNI.js} +1 -1
  6. package/Build/Workers/{chunk-RQRODXVN.js → chunk-3YTMGEXW.js} +5 -1424
  7. package/Build/Workers/{chunk-N52ZRKUE.js → chunk-4BHWJWS3.js} +6 -6
  8. package/Build/Workers/{chunk-5T5SY63I.js → chunk-5JKH4AMT.js} +2 -2
  9. package/Build/Workers/{chunk-EJO3NKMS.js → chunk-6HKAPCSO.js} +1 -1
  10. package/Build/Workers/{chunk-BJSNGGBM.js → chunk-A53R2F2L.js} +4 -4
  11. package/Build/Workers/{chunk-H7B7FU2U.js → chunk-A6YFUGJO.js} +5 -5
  12. package/Build/Workers/{chunk-VCVA7BMD.js → chunk-AJYWXC6I.js} +4 -4
  13. package/Build/Workers/{chunk-3GL53OCU.js → chunk-AOIO5VUS.js} +276 -2277
  14. package/Build/Workers/{chunk-SZN34LQ5.js → chunk-B7JRBTT6.js} +10 -10
  15. package/Build/Workers/{chunk-726NINF5.js → chunk-CHNDJRYA.js} +20 -18
  16. package/Build/Workers/{chunk-L7U26FFD.js → chunk-CJOV55CW.js} +20 -18
  17. package/Build/Workers/{chunk-NE5JTQJP.js → chunk-COGPE5Z2.js} +10 -8
  18. package/Build/Workers/{chunk-XPVZWY4A.js → chunk-CW7W27IZ.js} +12 -8
  19. package/Build/Workers/{chunk-GYRDA3XK.js → chunk-DICY26ID.js} +20 -16
  20. package/Build/Workers/{chunk-AOM3FHBN.js → chunk-DMEFNTUV.js} +69 -7
  21. package/Build/Workers/{chunk-XZO6F23E.js → chunk-DQSJEOZY.js} +1 -1
  22. package/Build/Workers/{chunk-MXHRZHDF.js → chunk-GDU4RZSZ.js} +16 -36
  23. package/Build/Workers/{chunk-JDJAPBZP.js → chunk-GKWOUMYA.js} +1 -1
  24. package/Build/Workers/{chunk-OUBBMEWX.js → chunk-GTY4K4IA.js} +9 -7
  25. package/Build/Workers/{chunk-LWJXCI3F.js → chunk-H6Q7E4BQ.js} +8 -6
  26. package/Build/Workers/{chunk-YLXWC7OW.js → chunk-HHGOFZVQ.js} +7 -5
  27. package/Build/Workers/{chunk-34YXP222.js → chunk-HXKUEOOD.js} +5 -5
  28. package/Build/Workers/{chunk-EZ7NJXQN.js → chunk-I4REFVXB.js} +4 -4
  29. package/Build/Workers/{chunk-OE22564R.js → chunk-IL5F6WEE.js} +3 -3
  30. package/Build/Workers/{chunk-QSMIHPUM.js → chunk-JKXPC5HD.js} +2 -2
  31. package/Build/Workers/{chunk-7KAXDKRU.js → chunk-KKGD7HAW.js} +13 -11
  32. package/Build/Workers/{chunk-YLILBDWK.js → chunk-KROSQJUA.js} +2 -2
  33. package/Build/Workers/{chunk-NHZNMTIR.js → chunk-L4JLDVCM.js} +5 -5
  34. package/Build/Workers/{chunk-2D3GLFZD.js → chunk-LIYMRHGR.js} +15 -13
  35. package/Build/Workers/{chunk-P2H75UV5.js → chunk-MKMZHRB3.js} +16 -11
  36. package/Build/Workers/{chunk-KUB64XW6.js → chunk-MO25ZQ2I.js} +12 -10
  37. package/Build/Workers/{chunk-ECHAJNQJ.js → chunk-O6RZEKHZ.js} +12 -12
  38. package/Build/Workers/{chunk-5ZF53EY6.js → chunk-OOCGX2OD.js} +4 -4
  39. package/Build/Workers/{chunk-NGKF5NTR.js → chunk-OXFU5HNU.js} +13 -5
  40. package/Build/Workers/{chunk-FA3SCJDX.js → chunk-P5CGIJUY.js} +2 -2
  41. package/Build/Workers/{chunk-W4PIP5PG.js → chunk-QEANVUGT.js} +2 -2
  42. package/Build/Workers/{chunk-AARZSH4V.js → chunk-QFBCIX7J.js} +8 -6
  43. package/Build/Workers/{chunk-JZFU2LEM.js → chunk-QUAH3XOT.js} +4 -4
  44. package/Build/Workers/{chunk-6HBKE43B.js → chunk-RXZDTDIY.js} +13 -9
  45. package/Build/Workers/{chunk-LEFQBK6H.js → chunk-SPA2KPH3.js} +14 -12
  46. package/Build/Workers/chunk-TDSVSW5A.js +1460 -0
  47. package/Build/Workers/{chunk-A6JAFSZT.js → chunk-UG2DPFOL.js} +8 -6
  48. package/Build/Workers/{chunk-U4XMLGSR.js → chunk-URGEDZBS.js} +7 -7
  49. package/Build/Workers/{chunk-A4DPJIWS.js → chunk-V35NQOJC.js} +8 -6
  50. package/Build/Workers/chunk-W4XUEDU5.js +2058 -0
  51. package/Build/Workers/{chunk-7XEJGXX2.js → chunk-WB4TSSBQ.js} +779 -24
  52. package/Build/Workers/{chunk-RCCYW6E7.js → chunk-WTLYD4FE.js} +19 -15
  53. package/Build/Workers/{chunk-5B7VZQZY.js → chunk-Y4ALZ4SS.js} +9 -7
  54. package/Build/Workers/{chunk-KGLDJRSO.js → chunk-YF2NVO5B.js} +19 -13
  55. package/Build/Workers/{chunk-IGX772ZQ.js → chunk-YSYSXSHF.js} +1 -1
  56. package/Build/Workers/{chunk-M7HRE4QR.js → chunk-YX562XOB.js} +15 -11
  57. package/Build/Workers/{chunk-QCMRUVVF.js → chunk-YZWA5B4R.js} +15 -13
  58. package/Build/Workers/{chunk-U7CX3HHE.js → chunk-Z6DFT4D3.js} +15 -11
  59. package/Build/Workers/combineGeometry.js +24 -21
  60. package/Build/Workers/createBoxGeometry.js +18 -15
  61. package/Build/Workers/createBoxOutlineGeometry.js +16 -13
  62. package/Build/Workers/createCircleGeometry.js +28 -24
  63. package/Build/Workers/createCircleOutlineGeometry.js +21 -17
  64. package/Build/Workers/createCoplanarPolygonGeometry.js +35 -31
  65. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +33 -29
  66. package/Build/Workers/createCorridorGeometry.js +32 -28
  67. package/Build/Workers/createCorridorOutlineGeometry.js +30 -26
  68. package/Build/Workers/createCylinderGeometry.js +20 -17
  69. package/Build/Workers/createCylinderOutlineGeometry.js +20 -16
  70. package/Build/Workers/createEllipseGeometry.js +28 -24
  71. package/Build/Workers/createEllipseOutlineGeometry.js +21 -17
  72. package/Build/Workers/createEllipsoidGeometry.js +19 -16
  73. package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -15
  74. package/Build/Workers/createFrustumGeometry.js +18 -15
  75. package/Build/Workers/createFrustumOutlineGeometry.js +18 -15
  76. package/Build/Workers/createGeometry.js +25 -21
  77. package/Build/Workers/createGroundPolylineGeometry.js +25 -21
  78. package/Build/Workers/createPlaneGeometry.js +16 -13
  79. package/Build/Workers/createPlaneOutlineGeometry.js +15 -12
  80. package/Build/Workers/createPolygonGeometry.js +35 -31
  81. package/Build/Workers/createPolygonOutlineGeometry.js +32 -28
  82. package/Build/Workers/createPolylineGeometry.js +27 -23
  83. package/Build/Workers/createPolylineVolumeGeometry.js +33 -29
  84. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +29 -25
  85. package/Build/Workers/createRectangleGeometry.js +30 -26
  86. package/Build/Workers/createRectangleOutlineGeometry.js +23 -19
  87. package/Build/Workers/createSimplePolylineGeometry.js +25 -21
  88. package/Build/Workers/createSphereGeometry.js +19 -16
  89. package/Build/Workers/createSphereOutlineGeometry.js +18 -15
  90. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  91. package/Build/Workers/createVectorTileClampedPolylines.js +16 -13
  92. package/Build/Workers/createVectorTileGeometries.js +24 -21
  93. package/Build/Workers/createVectorTilePoints.js +15 -12
  94. package/Build/Workers/createVectorTilePolygons.js +24 -20
  95. package/Build/Workers/createVectorTilePolylines.js +16 -13
  96. package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +25 -22
  97. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +26 -21
  98. package/Build/Workers/createVerticesFromHeightmap.js +26 -21
  99. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +24 -19
  100. package/Build/Workers/createWallGeometry.js +26 -22
  101. package/Build/Workers/createWallOutlineGeometry.js +25 -21
  102. package/Build/Workers/decodeDraco.js +10 -10
  103. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  104. package/Build/Workers/decodeI3S.js +13 -11
  105. package/Build/Workers/gaussianSplatSorter.js +4 -4
  106. package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
  107. package/Build/Workers/incrementallyBuildTerrainPicker.js +121 -0
  108. package/Build/Workers/transcodeKTX2.js +6 -6
  109. package/Build/Workers/transferTypedArrayTest.js +1 -1
  110. package/Build/Workers/upsampleQuantizedTerrainMesh.js +24 -20
  111. package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +25 -22
  112. package/Source/Core/AxisAlignedBoundingBox.js +36 -0
  113. package/Source/Core/Cesium3DTilesTerrainData.js +2 -0
  114. package/Source/Core/Cesium3DTilesTerrainGeometryProcessor.js +2 -0
  115. package/Source/Core/GoogleEarthEnterpriseTerrainData.js +1 -0
  116. package/Source/Core/HeightmapTerrainData.js +2 -0
  117. package/Source/Core/IntersectionTests.js +80 -0
  118. package/Source/Core/Ion.js +1 -1
  119. package/Source/Core/QuantizedMeshTerrainData.js +1 -0
  120. package/Source/Core/TerrainMesh.js +207 -0
  121. package/Source/Core/TerrainPicker.js +607 -0
  122. package/Source/Core/TexturePacker.js +27 -12
  123. package/Source/Core/Transforms.js +28 -19
  124. package/Source/DataSources/BillboardGraphics.js +1 -1
  125. package/Source/DataSources/BillboardVisualizer.js +7 -4
  126. package/Source/Renderer/Buffer.js +32 -0
  127. package/Source/Renderer/BufferUsage.js +3 -1
  128. package/Source/Renderer/Context.js +85 -7
  129. package/Source/Renderer/Sync.js +104 -0
  130. package/Source/Renderer/TextureAtlas.js +67 -27
  131. package/Source/Scene/ArcGisMapService.js +1 -1
  132. package/Source/Scene/Azure2DImageryProvider.js +96 -12
  133. package/Source/Scene/Billboard.js +75 -28
  134. package/Source/Scene/BillboardCollection.js +7 -2
  135. package/Source/Scene/BillboardTexture.js +56 -7
  136. package/Source/Scene/Globe.js +3 -1
  137. package/Source/Scene/GlobeSurfaceTile.js +18 -66
  138. package/Source/Scene/GlobeSurfaceTileProvider.js +11 -0
  139. package/Source/Scene/Google2DImageryProvider.js +10 -15
  140. package/Source/Scene/PickFramebuffer.js +124 -36
  141. package/Source/Scene/Picking.js +99 -17
  142. package/Source/Scene/Scene.js +36 -4
  143. package/Source/Scene/TerrainFillMesh.js +1 -0
  144. package/Source/Shaders/BillboardCollectionFS.glsl +22 -9
  145. package/Source/Shaders/BillboardCollectionFS.js +22 -9
  146. package/Source/ThirdParty/Workers/zip-web-worker.js +1 -1
  147. package/Source/ThirdParty/zip-module.wasm +0 -0
  148. package/Source/Workers/incrementallyBuildTerrainPicker.js +108 -0
  149. package/index.d.ts +207 -4
  150. package/index.js +28 -26
  151. package/package.json +2 -2
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @license
3
3
  * Cesium - https://github.com/CesiumGS/cesium
4
- * Version 1.135.0
4
+ * Version 1.136.0
5
5
  *
6
6
  * Copyright 2011-2022 Cesium Contributors
7
7
  *
@@ -25,49 +25,73 @@
25
25
 
26
26
  import {
27
27
  TerrainProvider_default
28
- } from "./chunk-34YXP222.js";
28
+ } from "./chunk-HXKUEOOD.js";
29
29
  import {
30
30
  EllipsoidalOccluder_default,
31
- TerrainEncoding_default
32
- } from "./chunk-P2H75UV5.js";
31
+ TerrainEncoding_default,
32
+ VerticalExaggeration_default
33
+ } from "./chunk-MKMZHRB3.js";
33
34
  import {
34
35
  WebMercatorProjection_default
35
- } from "./chunk-LWJXCI3F.js";
36
+ } from "./chunk-H6Q7E4BQ.js";
36
37
  import {
37
38
  OrientedBoundingBox_default
38
- } from "./chunk-KGLDJRSO.js";
39
+ } from "./chunk-YF2NVO5B.js";
39
40
  import {
40
41
  AttributeCompression_default
41
- } from "./chunk-6HBKE43B.js";
42
+ } from "./chunk-RXZDTDIY.js";
42
43
  import {
43
44
  AxisAlignedBoundingBox_default
44
- } from "./chunk-NGKF5NTR.js";
45
+ } from "./chunk-OXFU5HNU.js";
45
46
  import {
46
- BoundingSphere_default
47
- } from "./chunk-MXHRZHDF.js";
47
+ IntersectionTests_default,
48
+ Ray_default
49
+ } from "./chunk-DMEFNTUV.js";
48
50
  import {
49
- Matrix4_default,
51
+ BoundingSphere_default,
52
+ Interval_default
53
+ } from "./chunk-GDU4RZSZ.js";
54
+ import {
55
+ Event_default,
50
56
  Rectangle_default,
57
+ Resource_default,
51
58
  Transforms_default,
52
- binarySearch_default
53
- } from "./chunk-3GL53OCU.js";
59
+ binarySearch_default,
60
+ buildModuleUrl_default,
61
+ isCrossOriginUrl_default,
62
+ require_URI
63
+ } from "./chunk-AOIO5VUS.js";
64
+ import {
65
+ Matrix4_default
66
+ } from "./chunk-W4XUEDU5.js";
54
67
  import {
55
68
  ComponentDatatype_default
56
- } from "./chunk-EZ7NJXQN.js";
69
+ } from "./chunk-I4REFVXB.js";
70
+ import {
71
+ RuntimeError_default
72
+ } from "./chunk-5JKH4AMT.js";
57
73
  import {
58
74
  Cartesian2_default,
59
- Cartesian3_default,
60
75
  Cartographic_default,
61
76
  Ellipsoid_default,
77
+ FeatureDetection_default
78
+ } from "./chunk-TDSVSW5A.js";
79
+ import {
80
+ Cartesian3_default,
62
81
  Frozen_default,
63
82
  Matrix3_default
64
- } from "./chunk-RQRODXVN.js";
83
+ } from "./chunk-3YTMGEXW.js";
65
84
  import {
66
85
  Math_default
67
- } from "./chunk-OE22564R.js";
86
+ } from "./chunk-IL5F6WEE.js";
87
+ import {
88
+ Check_default,
89
+ DeveloperError_default
90
+ } from "./chunk-QEANVUGT.js";
68
91
  import {
69
- Check_default
70
- } from "./chunk-W4PIP5PG.js";
92
+ __toESM,
93
+ defined_default
94
+ } from "./chunk-2RCIRXNI.js";
71
95
 
72
96
  // node_modules/meshoptimizer/meshopt_encoder.module.js
73
97
  var MeshoptEncoder = (function() {
@@ -490,7 +514,7 @@ var MeshoptDecoder = (function() {
490
514
  };
491
515
  var workers = [];
492
516
  var requestId = 0;
493
- function createWorker(url) {
517
+ function createWorker2(url) {
494
518
  var worker = {
495
519
  object: new Worker(url),
496
520
  pending: 0,
@@ -509,7 +533,7 @@ var MeshoptDecoder = (function() {
509
533
  var blob = new Blob([source], { type: "text/javascript" });
510
534
  var url = URL.createObjectURL(blob);
511
535
  for (var i = workers.length; i < count; ++i) {
512
- workers[i] = createWorker(url);
536
+ workers[i] = createWorker2(url);
513
537
  }
514
538
  for (var i = count; i < workers.length; ++i) {
515
539
  workers[i].object.postMessage({});
@@ -1451,8 +1475,627 @@ Axis.fromName = function(name) {
1451
1475
  };
1452
1476
  var Axis_default = Object.freeze(Axis);
1453
1477
 
1478
+ // packages/engine/Source/Scene/SceneMode.js
1479
+ var SceneMode = {
1480
+ /**
1481
+ * Morphing between mode, e.g., 3D to 2D.
1482
+ *
1483
+ * @type {number}
1484
+ * @constant
1485
+ */
1486
+ MORPHING: 0,
1487
+ /**
1488
+ * Columbus View mode. A 2.5D perspective view where the map is laid out
1489
+ * flat and objects with non-zero height are drawn above it.
1490
+ *
1491
+ * @type {number}
1492
+ * @constant
1493
+ */
1494
+ COLUMBUS_VIEW: 1,
1495
+ /**
1496
+ * 2D mode. The map is viewed top-down with an orthographic projection.
1497
+ *
1498
+ * @type {number}
1499
+ * @constant
1500
+ */
1501
+ SCENE2D: 2,
1502
+ /**
1503
+ * 3D mode. A traditional 3D perspective view of the globe.
1504
+ *
1505
+ * @type {number}
1506
+ * @constant
1507
+ */
1508
+ SCENE3D: 3
1509
+ };
1510
+ SceneMode.getMorphTime = function(value) {
1511
+ if (value === SceneMode.SCENE3D) {
1512
+ return 1;
1513
+ } else if (value === SceneMode.MORPHING) {
1514
+ return void 0;
1515
+ }
1516
+ return 0;
1517
+ };
1518
+ var SceneMode_default = Object.freeze(SceneMode);
1519
+
1520
+ // packages/engine/Source/Core/TaskProcessor.js
1521
+ var import_urijs = __toESM(require_URI(), 1);
1522
+
1523
+ // packages/engine/Source/Core/destroyObject.js
1524
+ function returnTrue() {
1525
+ return true;
1526
+ }
1527
+ function destroyObject(object, message) {
1528
+ message = message ?? "This object was destroyed, i.e., destroy() was called.";
1529
+ function throwOnDestroyed() {
1530
+ throw new DeveloperError_default(message);
1531
+ }
1532
+ for (const key in object) {
1533
+ if (typeof object[key] === "function") {
1534
+ object[key] = throwOnDestroyed;
1535
+ }
1536
+ }
1537
+ object.isDestroyed = returnTrue;
1538
+ return void 0;
1539
+ }
1540
+ var destroyObject_default = destroyObject;
1541
+
1542
+ // packages/engine/Source/Core/TaskProcessor.js
1543
+ function canTransferArrayBuffer() {
1544
+ if (!defined_default(TaskProcessor._canTransferArrayBuffer)) {
1545
+ const worker = createWorker("transferTypedArrayTest");
1546
+ worker.postMessage = worker.webkitPostMessage ?? worker.postMessage;
1547
+ const value = 99;
1548
+ const array = new Int8Array([value]);
1549
+ try {
1550
+ worker.postMessage(
1551
+ {
1552
+ array
1553
+ },
1554
+ [array.buffer]
1555
+ );
1556
+ } catch (e) {
1557
+ TaskProcessor._canTransferArrayBuffer = false;
1558
+ return TaskProcessor._canTransferArrayBuffer;
1559
+ }
1560
+ TaskProcessor._canTransferArrayBuffer = new Promise((resolve) => {
1561
+ worker.onmessage = function(event) {
1562
+ const array2 = event.data.array;
1563
+ const result = defined_default(array2) && array2[0] === value;
1564
+ resolve(result);
1565
+ worker.terminate();
1566
+ TaskProcessor._canTransferArrayBuffer = result;
1567
+ };
1568
+ });
1569
+ }
1570
+ return TaskProcessor._canTransferArrayBuffer;
1571
+ }
1572
+ var taskCompletedEvent = new Event_default();
1573
+ function urlFromScript(script) {
1574
+ let blob;
1575
+ try {
1576
+ blob = new Blob([script], {
1577
+ type: "application/javascript"
1578
+ });
1579
+ } catch (e) {
1580
+ const BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder;
1581
+ const blobBuilder = new BlobBuilder();
1582
+ blobBuilder.append(script);
1583
+ blob = blobBuilder.getBlob("application/javascript");
1584
+ }
1585
+ const URL2 = window.URL || window.webkitURL;
1586
+ return URL2.createObjectURL(blob);
1587
+ }
1588
+ function createWorker(url) {
1589
+ const uri = new import_urijs.default(url);
1590
+ const isUri = uri.scheme().length !== 0 && uri.fragment().length === 0;
1591
+ const moduleID = url.replace(/\.js$/, "");
1592
+ const options = {};
1593
+ let workerPath;
1594
+ let crossOriginUrl;
1595
+ if (isCrossOriginUrl_default(url)) {
1596
+ crossOriginUrl = url;
1597
+ } else if (!isUri) {
1598
+ const moduleAbsoluteUrl = buildModuleUrl_default(
1599
+ `${TaskProcessor._workerModulePrefix}/${moduleID}.js`
1600
+ );
1601
+ if (isCrossOriginUrl_default(moduleAbsoluteUrl)) {
1602
+ crossOriginUrl = moduleAbsoluteUrl;
1603
+ }
1604
+ }
1605
+ if (crossOriginUrl) {
1606
+ const script = `import "${crossOriginUrl}";`;
1607
+ workerPath = urlFromScript(script);
1608
+ options.type = "module";
1609
+ return new Worker(workerPath, options);
1610
+ }
1611
+ if (!isUri && typeof CESIUM_WORKERS !== "undefined") {
1612
+ const script = `
1613
+ importScripts("${urlFromScript(CESIUM_WORKERS)}");
1614
+ CesiumWorkers["${moduleID}"]();
1615
+ `;
1616
+ workerPath = urlFromScript(script);
1617
+ return new Worker(workerPath, options);
1618
+ }
1619
+ workerPath = url;
1620
+ if (!isUri) {
1621
+ workerPath = buildModuleUrl_default(
1622
+ `${TaskProcessor._workerModulePrefix + moduleID}.js`
1623
+ );
1624
+ }
1625
+ if (!FeatureDetection_default.supportsEsmWebWorkers()) {
1626
+ throw new RuntimeError_default(
1627
+ "This browser is not supported. Please update your browser to continue."
1628
+ );
1629
+ }
1630
+ options.type = "module";
1631
+ return new Worker(workerPath, options);
1632
+ }
1633
+ async function getWebAssemblyLoaderConfig(processor, wasmOptions) {
1634
+ const config = {
1635
+ modulePath: void 0,
1636
+ wasmBinaryFile: void 0,
1637
+ wasmBinary: void 0
1638
+ };
1639
+ if (!FeatureDetection_default.supportsWebAssembly()) {
1640
+ if (!defined_default(wasmOptions.fallbackModulePath)) {
1641
+ throw new RuntimeError_default(
1642
+ `This browser does not support Web Assembly, and no backup module was provided for ${processor._workerPath}`
1643
+ );
1644
+ }
1645
+ config.modulePath = buildModuleUrl_default(wasmOptions.fallbackModulePath);
1646
+ return config;
1647
+ }
1648
+ config.wasmBinaryFile = buildModuleUrl_default(wasmOptions.wasmBinaryFile);
1649
+ const arrayBuffer = await Resource_default.fetchArrayBuffer({
1650
+ url: config.wasmBinaryFile
1651
+ });
1652
+ config.wasmBinary = arrayBuffer;
1653
+ return config;
1654
+ }
1655
+ function TaskProcessor(workerPath, maximumActiveTasks) {
1656
+ this._workerPath = workerPath;
1657
+ this._maximumActiveTasks = maximumActiveTasks ?? Number.POSITIVE_INFINITY;
1658
+ this._activeTasks = 0;
1659
+ this._nextID = 0;
1660
+ this._webAssemblyPromise = void 0;
1661
+ }
1662
+ var createOnmessageHandler = (worker, id, resolve, reject) => {
1663
+ const listener = ({ data }) => {
1664
+ if (data.id !== id) {
1665
+ return;
1666
+ }
1667
+ if (defined_default(data.error)) {
1668
+ let error = data.error;
1669
+ if (error.name === "RuntimeError") {
1670
+ error = new RuntimeError_default(data.error.message);
1671
+ error.stack = data.error.stack;
1672
+ } else if (error.name === "DeveloperError") {
1673
+ error = new DeveloperError_default(data.error.message);
1674
+ error.stack = data.error.stack;
1675
+ } else if (error.name === "Error") {
1676
+ error = new Error(data.error.message);
1677
+ error.stack = data.error.stack;
1678
+ }
1679
+ taskCompletedEvent.raiseEvent(error);
1680
+ reject(error);
1681
+ } else {
1682
+ taskCompletedEvent.raiseEvent();
1683
+ resolve(data.result);
1684
+ }
1685
+ worker.removeEventListener("message", listener);
1686
+ };
1687
+ return listener;
1688
+ };
1689
+ var emptyTransferableObjectArray = [];
1690
+ async function runTask(processor, parameters, transferableObjects) {
1691
+ const canTransfer = await Promise.resolve(canTransferArrayBuffer());
1692
+ if (!defined_default(transferableObjects)) {
1693
+ transferableObjects = emptyTransferableObjectArray;
1694
+ } else if (!canTransfer) {
1695
+ transferableObjects.length = 0;
1696
+ }
1697
+ const id = processor._nextID++;
1698
+ const promise = new Promise((resolve, reject) => {
1699
+ processor._worker.addEventListener(
1700
+ "message",
1701
+ createOnmessageHandler(processor._worker, id, resolve, reject)
1702
+ );
1703
+ });
1704
+ processor._worker.postMessage(
1705
+ {
1706
+ id,
1707
+ baseUrl: buildModuleUrl_default.getCesiumBaseUrl().url,
1708
+ parameters,
1709
+ canTransferArrayBuffer: canTransfer
1710
+ },
1711
+ transferableObjects
1712
+ );
1713
+ return promise;
1714
+ }
1715
+ async function scheduleTask(processor, parameters, transferableObjects) {
1716
+ ++processor._activeTasks;
1717
+ try {
1718
+ const result = await runTask(processor, parameters, transferableObjects);
1719
+ --processor._activeTasks;
1720
+ return result;
1721
+ } catch (error) {
1722
+ --processor._activeTasks;
1723
+ throw error;
1724
+ }
1725
+ }
1726
+ TaskProcessor.prototype.scheduleTask = function(parameters, transferableObjects) {
1727
+ if (!defined_default(this._worker)) {
1728
+ this._worker = createWorker(this._workerPath);
1729
+ }
1730
+ if (this._activeTasks >= this._maximumActiveTasks) {
1731
+ return void 0;
1732
+ }
1733
+ return scheduleTask(this, parameters, transferableObjects);
1734
+ };
1735
+ TaskProcessor.prototype.initWebAssemblyModule = async function(webAssemblyOptions) {
1736
+ if (defined_default(this._webAssemblyPromise)) {
1737
+ return this._webAssemblyPromise;
1738
+ }
1739
+ const init = async () => {
1740
+ const worker = this._worker = createWorker(this._workerPath);
1741
+ const wasmConfig = await getWebAssemblyLoaderConfig(
1742
+ this,
1743
+ webAssemblyOptions
1744
+ );
1745
+ const canTransfer = await Promise.resolve(canTransferArrayBuffer());
1746
+ let transferableObjects;
1747
+ const binary = wasmConfig.wasmBinary;
1748
+ if (defined_default(binary) && canTransfer) {
1749
+ transferableObjects = [binary];
1750
+ }
1751
+ const promise = new Promise((resolve, reject) => {
1752
+ worker.onmessage = function({ data }) {
1753
+ if (defined_default(data)) {
1754
+ resolve(data.result);
1755
+ } else {
1756
+ reject(new RuntimeError_default("Could not configure wasm module"));
1757
+ }
1758
+ };
1759
+ });
1760
+ worker.postMessage(
1761
+ {
1762
+ canTransferArrayBuffer: canTransfer,
1763
+ parameters: { webAssemblyConfig: wasmConfig }
1764
+ },
1765
+ transferableObjects
1766
+ );
1767
+ return promise;
1768
+ };
1769
+ this._webAssemblyPromise = init();
1770
+ return this._webAssemblyPromise;
1771
+ };
1772
+ TaskProcessor.prototype.isDestroyed = function() {
1773
+ return false;
1774
+ };
1775
+ TaskProcessor.prototype.destroy = function() {
1776
+ if (defined_default(this._worker)) {
1777
+ this._worker.terminate();
1778
+ }
1779
+ return destroyObject_default(this);
1780
+ };
1781
+ TaskProcessor.taskCompletedEvent = taskCompletedEvent;
1782
+ TaskProcessor._defaultWorkerModulePrefix = "Workers/";
1783
+ TaskProcessor._workerModulePrefix = TaskProcessor._defaultWorkerModulePrefix;
1784
+ TaskProcessor._canTransferArrayBuffer = void 0;
1785
+ var TaskProcessor_default = TaskProcessor;
1786
+
1787
+ // packages/engine/Source/Core/TerrainPicker.js
1788
+ var MAXIMUM_TERRAIN_PICKER_LEVEL = 3;
1789
+ function TerrainPicker(vertices, indices, encoding) {
1790
+ Check_default.defined("vertices", vertices);
1791
+ Check_default.defined("indices", indices);
1792
+ Check_default.defined("encoding", encoding);
1793
+ this._vertices = vertices;
1794
+ this._indices = indices;
1795
+ this._encoding = encoding;
1796
+ this._inverseTransform = new Matrix4_default();
1797
+ this._needsRebuild = true;
1798
+ this._rootNode = new TerrainPickerNode();
1799
+ }
1800
+ var incrementallyBuildTerrainPickerTaskProcessor = new TaskProcessor_default(
1801
+ "incrementallyBuildTerrainPicker"
1802
+ );
1803
+ Object.defineProperties(TerrainPicker.prototype, {
1804
+ /**
1805
+ * Indicates whether the terrain picker needs to be rebuilt due to changes in the underlying terrain mesh's vertices or indices.
1806
+ * @type {boolean}
1807
+ */
1808
+ needsRebuild: {
1809
+ get: function() {
1810
+ return this._needsRebuild;
1811
+ },
1812
+ set: function(value) {
1813
+ this._needsRebuild = value;
1814
+ }
1815
+ }
1816
+ });
1817
+ function TerrainPickerNode() {
1818
+ this.x = 0;
1819
+ this.y = 0;
1820
+ this.level = 0;
1821
+ this.aabb = createAABBForNode(this.x, this.y, this.level);
1822
+ this.intersectingTriangles = new Uint32Array(0);
1823
+ this.children = [];
1824
+ this.buildingChildren = false;
1825
+ }
1826
+ TerrainPickerNode.prototype.addChild = function(childIdx) {
1827
+ if (childIdx < 0 || childIdx > 3) {
1828
+ throw new DeveloperError_default(
1829
+ "TerrainPickerNode child index must be between 0 and 3, inclusive."
1830
+ );
1831
+ }
1832
+ const childNode = new TerrainPickerNode();
1833
+ childNode.x = this.x * 2 + (childIdx & 1);
1834
+ childNode.y = this.y * 2 + (childIdx >> 1 & 1);
1835
+ childNode.level = this.level + 1;
1836
+ childNode.aabb = createAABBForNode(childNode.x, childNode.y, childNode.level);
1837
+ this.children[childIdx] = childNode;
1838
+ };
1839
+ var scratchTransformedRay = new Ray_default();
1840
+ var scratchTrianglePoints = [
1841
+ new Cartesian3_default(),
1842
+ new Cartesian3_default(),
1843
+ new Cartesian3_default()
1844
+ ];
1845
+ TerrainPicker.prototype.rayIntersect = function(ray, tileTransform, cullBackFaces, mode, projection) {
1846
+ if (this._needsRebuild) {
1847
+ reset(this, tileTransform);
1848
+ }
1849
+ const invTransform = this._inverseTransform;
1850
+ const transformedRay = scratchTransformedRay;
1851
+ transformedRay.origin = Matrix4_default.multiplyByPoint(
1852
+ invTransform,
1853
+ ray.origin,
1854
+ transformedRay.origin
1855
+ );
1856
+ transformedRay.direction = Matrix4_default.multiplyByPointAsVector(
1857
+ invTransform,
1858
+ ray.direction,
1859
+ transformedRay.direction
1860
+ );
1861
+ const intersections = [];
1862
+ getNodesIntersectingRay(this._rootNode, transformedRay, intersections);
1863
+ return findClosestPointInClosestNode(
1864
+ this,
1865
+ intersections,
1866
+ ray,
1867
+ cullBackFaces,
1868
+ mode,
1869
+ projection
1870
+ );
1871
+ };
1872
+ function reset(terrainPicker, tileTransform) {
1873
+ Matrix4_default.inverse(tileTransform, terrainPicker._inverseTransform);
1874
+ terrainPicker._needsRebuild = false;
1875
+ const triangleCount = terrainPicker._indices.length / 3;
1876
+ const intersectingTriangles = new Uint32Array(triangleCount);
1877
+ for (let i = 0; i < triangleCount; ++i) {
1878
+ intersectingTriangles[i] = i;
1879
+ }
1880
+ terrainPicker._rootNode.intersectingTriangles = intersectingTriangles;
1881
+ terrainPicker._rootNode.children.length = 0;
1882
+ }
1883
+ var scratchAABBMin = new Cartesian3_default();
1884
+ var scratchAABBMax = new Cartesian3_default();
1885
+ function createAABBForNode(x, y, level) {
1886
+ const sizeAtLevel = 1 / Math.pow(2, level);
1887
+ const aabbMin = Cartesian3_default.fromElements(
1888
+ x * sizeAtLevel - 0.5,
1889
+ y * sizeAtLevel - 0.5,
1890
+ -0.5,
1891
+ scratchAABBMin
1892
+ );
1893
+ const aabbMax = Cartesian3_default.fromElements(
1894
+ (x + 1) * sizeAtLevel - 0.5,
1895
+ (y + 1) * sizeAtLevel - 0.5,
1896
+ 0.5,
1897
+ scratchAABBMax
1898
+ );
1899
+ return AxisAlignedBoundingBox_default.fromCorners(aabbMin, aabbMax);
1900
+ }
1901
+ function packTriangleBuffers(trianglePositionsBuffer, triangleIndicesBuffer, trianglePositions, triangleIndex, bufferIndex) {
1902
+ Cartesian3_default.pack(
1903
+ trianglePositions[0],
1904
+ trianglePositionsBuffer,
1905
+ 9 * bufferIndex
1906
+ );
1907
+ Cartesian3_default.pack(
1908
+ trianglePositions[1],
1909
+ trianglePositionsBuffer,
1910
+ 9 * bufferIndex + 3
1911
+ );
1912
+ Cartesian3_default.pack(
1913
+ trianglePositions[2],
1914
+ trianglePositionsBuffer,
1915
+ 9 * bufferIndex + 6
1916
+ );
1917
+ triangleIndicesBuffer[bufferIndex] = triangleIndex;
1918
+ }
1919
+ var scratchInterval = new Interval_default();
1920
+ function getNodesIntersectingRay(currentNode, ray, intersectingNodes) {
1921
+ const interval = IntersectionTests_default.rayAxisAlignedBoundingBox(
1922
+ ray,
1923
+ currentNode.aabb,
1924
+ scratchInterval
1925
+ );
1926
+ if (!defined_default(interval)) {
1927
+ return;
1928
+ }
1929
+ const isLeaf = !currentNode.children.length || currentNode.buildingChildren;
1930
+ if (isLeaf) {
1931
+ intersectingNodes.push({
1932
+ node: currentNode,
1933
+ interval: new Interval_default(interval.start, interval.stop)
1934
+ });
1935
+ return;
1936
+ }
1937
+ for (let i = 0; i < currentNode.children.length; i++) {
1938
+ getNodesIntersectingRay(currentNode.children[i], ray, intersectingNodes);
1939
+ }
1940
+ }
1941
+ function findClosestPointInClosestNode(terrainPicker, intersections, ray, cullBackFaces, mode, projection) {
1942
+ const sortedIntersections = intersections.sort(function(a, b) {
1943
+ return a.interval.start - b.interval.start;
1944
+ });
1945
+ let minT = Number.MAX_VALUE;
1946
+ for (let i = 0; i < sortedIntersections.length; i++) {
1947
+ const intersection = sortedIntersections[i];
1948
+ const intersectionResult = getClosestTriangleInNode(
1949
+ terrainPicker,
1950
+ ray,
1951
+ intersection.node,
1952
+ cullBackFaces,
1953
+ mode,
1954
+ projection
1955
+ );
1956
+ minT = Math.min(intersectionResult, minT);
1957
+ if (minT !== Number.MAX_VALUE) {
1958
+ break;
1959
+ }
1960
+ }
1961
+ if (minT !== Number.MAX_VALUE) {
1962
+ return Ray_default.getPoint(ray, minT);
1963
+ }
1964
+ return void 0;
1965
+ }
1966
+ function getClosestTriangleInNode(terrainPicker, ray, node, cullBackFaces, mode, projection) {
1967
+ let result = Number.MAX_VALUE;
1968
+ const encoding = terrainPicker._encoding;
1969
+ const indices = terrainPicker._indices;
1970
+ const vertices = terrainPicker._vertices;
1971
+ const triangleCount = node.intersectingTriangles.length;
1972
+ const isMaxLevel = node.level >= MAXIMUM_TERRAIN_PICKER_LEVEL;
1973
+ const shouldBuildChildren = !isMaxLevel && !node.buildingChildren;
1974
+ let trianglePositions;
1975
+ let triangleIndices;
1976
+ if (shouldBuildChildren) {
1977
+ trianglePositions = new Float32Array(triangleCount * 9);
1978
+ triangleIndices = new Uint32Array(triangleCount);
1979
+ }
1980
+ for (let i = 0; i < triangleCount; i++) {
1981
+ const triIndex = node.intersectingTriangles[i];
1982
+ const v0 = getVertexPosition(
1983
+ encoding,
1984
+ mode,
1985
+ projection,
1986
+ vertices,
1987
+ indices[3 * triIndex],
1988
+ scratchTrianglePoints[0]
1989
+ );
1990
+ const v1 = getVertexPosition(
1991
+ encoding,
1992
+ mode,
1993
+ projection,
1994
+ vertices,
1995
+ indices[3 * triIndex + 1],
1996
+ scratchTrianglePoints[1]
1997
+ );
1998
+ const v2 = getVertexPosition(
1999
+ encoding,
2000
+ mode,
2001
+ projection,
2002
+ vertices,
2003
+ indices[3 * triIndex + 2],
2004
+ scratchTrianglePoints[2]
2005
+ );
2006
+ const triT = IntersectionTests_default.rayTriangleParametric(
2007
+ ray,
2008
+ v0,
2009
+ v1,
2010
+ v2,
2011
+ cullBackFaces
2012
+ );
2013
+ if (defined_default(triT) && triT < result && triT >= 0) {
2014
+ result = triT;
2015
+ }
2016
+ if (shouldBuildChildren) {
2017
+ packTriangleBuffers(
2018
+ trianglePositions,
2019
+ triangleIndices,
2020
+ scratchTrianglePoints,
2021
+ triIndex,
2022
+ i
2023
+ );
2024
+ }
2025
+ }
2026
+ if (shouldBuildChildren) {
2027
+ for (let childIdx = 0; childIdx < 4; childIdx++) {
2028
+ node.addChild(childIdx);
2029
+ }
2030
+ addTrianglesToChildrenNodes(
2031
+ terrainPicker._inverseTransform,
2032
+ node,
2033
+ triangleIndices,
2034
+ trianglePositions
2035
+ );
2036
+ }
2037
+ return result;
2038
+ }
2039
+ var scratchCartographic = new Cartographic_default();
2040
+ function getVertexPosition(encoding, mode, projection, vertices, index, result) {
2041
+ let position = encoding.getExaggeratedPosition(vertices, index, result);
2042
+ if (mode === SceneMode_default.SCENE3D) {
2043
+ return position;
2044
+ }
2045
+ const ellipsoid = projection.ellipsoid;
2046
+ const positionCartographic = ellipsoid.cartesianToCartographic(
2047
+ position,
2048
+ scratchCartographic
2049
+ );
2050
+ position = projection.project(positionCartographic, result);
2051
+ position = Cartesian3_default.fromElements(
2052
+ position.z,
2053
+ position.x,
2054
+ position.y,
2055
+ result
2056
+ );
2057
+ return position;
2058
+ }
2059
+ async function addTrianglesToChildrenNodes(inverseTransform, node, triangleIndices, trianglePositions) {
2060
+ node.buildingChildren = true;
2061
+ const inverseTransformPacked = new Float64Array(16);
2062
+ Matrix4_default.pack(inverseTransform, inverseTransformPacked, 0);
2063
+ const aabbArray = new Float64Array(6 * 4);
2064
+ for (let i = 0; i < 4; i++) {
2065
+ Cartesian3_default.pack(node.children[i].aabb.minimum, aabbArray, i * 6);
2066
+ Cartesian3_default.pack(node.children[i].aabb.maximum, aabbArray, i * 6 + 3);
2067
+ }
2068
+ const parameters = {
2069
+ aabbs: aabbArray,
2070
+ inverseTransform: inverseTransformPacked,
2071
+ triangleIndices,
2072
+ trianglePositions
2073
+ };
2074
+ const transferableObjects = [
2075
+ aabbArray.buffer,
2076
+ inverseTransformPacked.buffer,
2077
+ triangleIndices.buffer,
2078
+ trianglePositions.buffer
2079
+ ];
2080
+ const incrementallyBuildTerrainPickerPromise = incrementallyBuildTerrainPickerTaskProcessor.scheduleTask(
2081
+ parameters,
2082
+ transferableObjects
2083
+ );
2084
+ if (!defined_default(incrementallyBuildTerrainPickerPromise)) {
2085
+ node.buildingChildren = false;
2086
+ return;
2087
+ }
2088
+ const result = await incrementallyBuildTerrainPickerPromise;
2089
+ result.intersectingTrianglesArrays.forEach((buffer, index) => {
2090
+ node.children[index].intersectingTriangles = new Uint32Array(buffer);
2091
+ });
2092
+ node.intersectingTriangles = new Uint32Array(0);
2093
+ node.buildingChildren = false;
2094
+ }
2095
+ var TerrainPicker_default = TerrainPicker;
2096
+
1454
2097
  // packages/engine/Source/Core/TerrainMesh.js
1455
- function TerrainMesh(center, vertices, indices, indexCountWithoutSkirts, vertexCountWithoutSkirts, minimumHeight, maximumHeight, boundingSphere3D, occludeePointInScaledSpace, vertexStride, orientedBoundingBox, encoding, westIndicesSouthToNorth, southIndicesEastToWest, eastIndicesNorthToSouth, northIndicesWestToEast) {
2098
+ function TerrainMesh(center, vertices, indices, indexCountWithoutSkirts, vertexCountWithoutSkirts, minimumHeight, maximumHeight, rectangle, boundingSphere3D, occludeePointInScaledSpace, vertexStride, orientedBoundingBox, encoding, westIndicesSouthToNorth, southIndicesEastToWest, eastIndicesNorthToSouth, northIndicesWestToEast) {
1456
2099
  this.center = center;
1457
2100
  this.vertices = vertices;
1458
2101
  this.stride = vertexStride ?? 6;
@@ -1461,6 +2104,7 @@ function TerrainMesh(center, vertices, indices, indexCountWithoutSkirts, vertexC
1461
2104
  this.vertexCountWithoutSkirts = vertexCountWithoutSkirts;
1462
2105
  this.minimumHeight = minimumHeight;
1463
2106
  this.maximumHeight = maximumHeight;
2107
+ this.rectangle = rectangle;
1464
2108
  this.boundingSphere3D = boundingSphere3D;
1465
2109
  this.occludeePointInScaledSpace = occludeePointInScaledSpace;
1466
2110
  this.orientedBoundingBox = orientedBoundingBox;
@@ -1469,7 +2113,116 @@ function TerrainMesh(center, vertices, indices, indexCountWithoutSkirts, vertexC
1469
2113
  this.southIndicesEastToWest = southIndicesEastToWest;
1470
2114
  this.eastIndicesNorthToSouth = eastIndicesNorthToSouth;
1471
2115
  this.northIndicesWestToEast = northIndicesWestToEast;
2116
+ this._transform = new Matrix4_default();
2117
+ this._recomputeTransform = true;
2118
+ this._terrainPicker = new TerrainPicker_default(vertices, indices, encoding);
1472
2119
  }
2120
+ TerrainMesh.prototype.getTransform = function(mode, projection) {
2121
+ if (!this._recomputeTransform) {
2122
+ return this._transform;
2123
+ }
2124
+ this._recomputeTransform = false;
2125
+ if (!defined_default(mode) || mode === SceneMode_default.SCENE3D) {
2126
+ return computeTransform(this, this._transform);
2127
+ }
2128
+ return computeTransform2D(this, projection, this._transform);
2129
+ };
2130
+ function computeTransform(mesh, result) {
2131
+ const exaggeration = mesh.encoding.exaggeration;
2132
+ const exaggerationRelativeHeight = mesh.encoding.exaggerationRelativeHeight;
2133
+ const exaggeratedMinHeight = VerticalExaggeration_default.getHeight(
2134
+ mesh.minimumHeight,
2135
+ exaggeration,
2136
+ exaggerationRelativeHeight
2137
+ );
2138
+ const exaggeratedMaxHeight = VerticalExaggeration_default.getHeight(
2139
+ mesh.maximumHeight,
2140
+ exaggeration,
2141
+ exaggerationRelativeHeight
2142
+ );
2143
+ const obb = OrientedBoundingBox_default.fromRectangle(
2144
+ mesh.rectangle,
2145
+ exaggeratedMinHeight,
2146
+ exaggeratedMaxHeight,
2147
+ Ellipsoid_default.default,
2148
+ mesh.orientedBoundingBox
2149
+ );
2150
+ return OrientedBoundingBox_default.computeTransformation(obb, result);
2151
+ }
2152
+ var scratchSWCartesian = new Cartesian3_default();
2153
+ var scratchNECartesian = new Cartesian3_default();
2154
+ var scratchSWCartographic = new Cartographic_default();
2155
+ var scratchNECartographic = new Cartographic_default();
2156
+ var scratchScale2D = new Cartesian3_default();
2157
+ var scratchCenter2D = new Cartesian3_default();
2158
+ function computeTransform2D(mesh, projection, result) {
2159
+ const exaggeration = mesh.encoding.exaggeration;
2160
+ const exaggerationRelativeHeight = mesh.encoding.exaggerationRelativeHeight;
2161
+ const exaggeratedMinHeight = VerticalExaggeration_default.getHeight(
2162
+ mesh.minimumHeight,
2163
+ exaggeration,
2164
+ exaggerationRelativeHeight
2165
+ );
2166
+ const exaggeratedMaxHeight = VerticalExaggeration_default.getHeight(
2167
+ mesh.maximumHeight,
2168
+ exaggeration,
2169
+ exaggerationRelativeHeight
2170
+ );
2171
+ const southwest = projection.project(
2172
+ Cartographic_default.fromRadians(
2173
+ mesh.rectangle.west,
2174
+ mesh.rectangle.south,
2175
+ 0,
2176
+ scratchSWCartographic
2177
+ ),
2178
+ scratchSWCartesian
2179
+ );
2180
+ const northeast = projection.project(
2181
+ Cartographic_default.fromRadians(
2182
+ mesh.rectangle.east,
2183
+ mesh.rectangle.north,
2184
+ 0,
2185
+ scratchNECartographic
2186
+ ),
2187
+ scratchNECartesian
2188
+ );
2189
+ const heightRange = exaggeratedMaxHeight - exaggeratedMinHeight;
2190
+ const scale = Cartesian3_default.fromElements(
2191
+ northeast.x - southwest.x,
2192
+ northeast.y - southwest.y,
2193
+ heightRange > 0 ? heightRange : 1,
2194
+ // Avoid zero scale
2195
+ scratchScale2D
2196
+ );
2197
+ const center = Cartesian3_default.fromElements(
2198
+ southwest.x + scale.x * 0.5,
2199
+ southwest.y + scale.y * 0.5,
2200
+ exaggeratedMinHeight + scale.z * 0.5,
2201
+ scratchCenter2D
2202
+ );
2203
+ Matrix4_default.fromTranslation(center, result);
2204
+ Matrix4_default.setScale(result, scale, result);
2205
+ Matrix4_default.multiply(Transforms_default.SWIZZLE_3D_TO_2D_MATRIX, result, result);
2206
+ return result;
2207
+ }
2208
+ TerrainMesh.prototype.pick = function(ray, cullBackFaces, mode, projection) {
2209
+ return this._terrainPicker.rayIntersect(
2210
+ ray,
2211
+ this.getTransform(mode, projection),
2212
+ cullBackFaces,
2213
+ mode,
2214
+ projection
2215
+ );
2216
+ };
2217
+ TerrainMesh.prototype.updateExaggeration = function(exaggeration, exaggerationRelativeHeight) {
2218
+ this._terrainPicker._vertices = this.vertices;
2219
+ this._terrainPicker.needsRebuild = true;
2220
+ this._recomputeTransform = true;
2221
+ };
2222
+ TerrainMesh.prototype.updateSceneMode = function(mode) {
2223
+ this._terrainPicker.needsRebuild = true;
2224
+ this._recomputeTransform = true;
2225
+ };
1473
2226
  var TerrainMesh_default = TerrainMesh;
1474
2227
 
1475
2228
  // packages/engine/Source/Core/Cesium3DTilesTerrainGeometryProcessor.js
@@ -1492,7 +2245,7 @@ var scratchMinimumPositionENU = new Cartesian3_default();
1492
2245
  var scratchMaximumPositionENU = new Cartesian3_default();
1493
2246
  var scratchPosLocal = new Cartesian3_default();
1494
2247
  var scratchPosEcef = new Cartesian3_default();
1495
- var scratchCartographic = new Cartographic_default();
2248
+ var scratchCartographic2 = new Cartographic_default();
1496
2249
  var scratchUV = new Cartesian2_default();
1497
2250
  var scratchNormal = new Cartesian3_default();
1498
2251
  var scratchNormalOct = new Cartesian2_default();
@@ -1651,7 +2404,7 @@ Cesium3DTilesTerrainGeometryProcessor.createMesh = async function(options) {
1651
2404
  const cartographic = Cartographic_default.fromCartesian(
1652
2405
  posECEF,
1653
2406
  ellipsoid,
1654
- scratchCartographic
2407
+ scratchCartographic2
1655
2408
  );
1656
2409
  const { longitude, latitude, height } = cartographic;
1657
2410
  let u = (longitude - tileMinLongitude) / tileLengthLongitude;
@@ -1718,6 +2471,7 @@ Cesium3DTilesTerrainGeometryProcessor.createMesh = async function(options) {
1718
2471
  vertexCountWithoutSkirts,
1719
2472
  minimumHeight,
1720
2473
  maximumHeight,
2474
+ rectangle,
1721
2475
  BoundingSphere_default.clone(boundingSphere, new BoundingSphere_default()),
1722
2476
  Cartesian3_default.clone(horizonOcclusionPoint, new Cartesian3_default()),
1723
2477
  tempBufferStride,
@@ -2218,6 +2972,7 @@ Cesium3DTilesTerrainGeometryProcessor.upsampleMesh = function(options) {
2218
2972
  upsampledVertexCountWithoutSkirts,
2219
2973
  minimumHeight,
2220
2974
  maximumHeight,
2975
+ upsampleRectangle,
2221
2976
  BoundingSphere_default.clone(boundingSphere),
2222
2977
  Cartesian3_default.clone(horizonOcclusionPoint),
2223
2978
  upsampledVertexBufferStride,