@cesium/engine 3.0.2 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (246) hide show
  1. package/Build/ThirdParty/Workers/pako_deflate.min.js +605 -0
  2. package/Build/ThirdParty/Workers/pako_inflate.min.js +800 -0
  3. package/Build/ThirdParty/Workers/z-worker-pako.js +502 -0
  4. package/Build/Workers/chunk-2U6EBIRX.js +757 -0
  5. package/Build/Workers/chunk-2ZI7FZ3Q.js +58 -0
  6. package/Build/Workers/chunk-3TSHZWOZ.js +1860 -0
  7. package/Build/Workers/chunk-44B6FQSJ.js +684 -0
  8. package/Build/Workers/chunk-4AJR66C5.js +368 -0
  9. package/Build/Workers/chunk-4HN3N5SE.js +501 -0
  10. package/Build/Workers/chunk-4QGPYV3W.js +102 -0
  11. package/Build/Workers/chunk-4RKE4B3G.js +476 -0
  12. package/Build/Workers/chunk-5E3V7Y4R.js +196 -0
  13. package/Build/Workers/chunk-6EHT6GS3.js +163 -0
  14. package/Build/Workers/chunk-6I22NWKQ.js +171 -0
  15. package/Build/Workers/chunk-7N67FBLW.js +1054 -0
  16. package/Build/Workers/chunk-AQQGAFKX.js +124 -0
  17. package/Build/Workers/chunk-CROU4RHL.js +138 -0
  18. package/Build/Workers/chunk-CTJCECTX.js +258 -0
  19. package/Build/Workers/chunk-DWJZFZ67.js +781 -0
  20. package/Build/Workers/chunk-EHJQEARC.js +59 -0
  21. package/Build/Workers/chunk-EVLKHUAE.js +1477 -0
  22. package/Build/Workers/chunk-FOOYJER7.js +834 -0
  23. package/Build/Workers/chunk-GLCRFDOB.js +73 -0
  24. package/Build/Workers/chunk-GPO47TW4.js +39 -0
  25. package/Build/Workers/chunk-H5Q2JKIA.js +1075 -0
  26. package/Build/Workers/chunk-HIDSEUWS.js +2041 -0
  27. package/Build/Workers/chunk-HV67ARO7.js +302 -0
  28. package/Build/Workers/chunk-IC7G4BX2.js +421 -0
  29. package/Build/Workers/chunk-IQN2LMGD.js +55 -0
  30. package/Build/Workers/chunk-J2FHYK2Z.js +55 -0
  31. package/Build/Workers/chunk-K3VEWONC.js +289 -0
  32. package/Build/Workers/chunk-KZFXE35V.js +117 -0
  33. package/Build/Workers/chunk-MG2TXIO5.js +400 -0
  34. package/Build/Workers/chunk-MRCFDEKH.js +138 -0
  35. package/Build/Workers/chunk-MYDS6HBL.js +3273 -0
  36. package/Build/Workers/chunk-OCIX2CQ7.js +305 -0
  37. package/Build/Workers/chunk-P32XMW4I.js +2716 -0
  38. package/Build/Workers/chunk-PEVZYZBQ.js +157 -0
  39. package/Build/Workers/chunk-PMDLIBEQ.js +218 -0
  40. package/Build/Workers/chunk-QDUOGCCO.js +1009 -0
  41. package/Build/Workers/chunk-QUCJGBCK.js +430 -0
  42. package/Build/Workers/chunk-RCI7BSOM.js +452 -0
  43. package/Build/Workers/chunk-SVTSC7FX.js +390 -0
  44. package/Build/Workers/chunk-TXOGSFHZ.js +77 -0
  45. package/Build/Workers/chunk-TXYJOVQK.js +629 -0
  46. package/Build/Workers/chunk-UFIT5XDI.js +1258 -0
  47. package/Build/Workers/chunk-ULLMQNFQ.js +73 -0
  48. package/Build/Workers/chunk-UM7FIUQW.js +101 -0
  49. package/Build/Workers/{package.js → chunk-UMLTOPAE.js} +13 -2
  50. package/Build/Workers/chunk-V5S5N2IS.js +8644 -0
  51. package/Build/Workers/chunk-VN2IHJKM.js +513 -0
  52. package/Build/Workers/chunk-VWSD2XV5.js +669 -0
  53. package/Build/Workers/chunk-X2KIWBTW.js +100 -0
  54. package/Build/Workers/chunk-Y24CDOJC.js +353 -0
  55. package/Build/Workers/chunk-YLMDWSXO.js +44 -0
  56. package/Build/Workers/chunk-YNZ4DMR7.js +634 -0
  57. package/Build/Workers/chunk-Z2MP3UBE.js +236 -0
  58. package/Build/Workers/combineGeometry.js +65 -15
  59. package/Build/Workers/createBoxGeometry.js +55 -10
  60. package/Build/Workers/createBoxOutlineGeometry.js +231 -310
  61. package/Build/Workers/createCircleGeometry.js +185 -202
  62. package/Build/Workers/createCircleOutlineGeometry.js +141 -155
  63. package/Build/Workers/createCoplanarPolygonGeometry.js +477 -557
  64. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +218 -230
  65. package/Build/Workers/createCorridorGeometry.js +1163 -1307
  66. package/Build/Workers/createCorridorOutlineGeometry.js +534 -569
  67. package/Build/Workers/createCylinderGeometry.js +57 -10
  68. package/Build/Workers/createCylinderOutlineGeometry.js +224 -258
  69. package/Build/Workers/createEllipseGeometry.js +68 -12
  70. package/Build/Workers/createEllipseOutlineGeometry.js +61 -12
  71. package/Build/Workers/createEllipsoidGeometry.js +56 -10
  72. package/Build/Workers/createEllipsoidOutlineGeometry.js +58 -13
  73. package/Build/Workers/createFrustumGeometry.js +55 -10
  74. package/Build/Workers/createFrustumOutlineGeometry.js +226 -243
  75. package/Build/Workers/createGeometry.js +143 -48
  76. package/Build/Workers/createGroundPolylineGeometry.js +1484 -2012
  77. package/Build/Workers/createPlaneGeometry.js +216 -243
  78. package/Build/Workers/createPlaneOutlineGeometry.js +121 -113
  79. package/Build/Workers/createPolygonGeometry.js +1437 -1314
  80. package/Build/Workers/createPolygonOutlineGeometry.js +516 -657
  81. package/Build/Workers/createPolylineGeometry.js +471 -547
  82. package/Build/Workers/createPolylineVolumeGeometry.js +354 -384
  83. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +272 -295
  84. package/Build/Workers/createRectangleGeometry.js +1128 -1331
  85. package/Build/Workers/createRectangleOutlineGeometry.js +445 -500
  86. package/Build/Workers/createSimplePolylineGeometry.js +381 -440
  87. package/Build/Workers/createSphereGeometry.js +112 -118
  88. package/Build/Workers/createSphereOutlineGeometry.js +112 -121
  89. package/Build/Workers/createTaskProcessorWorker.js +32 -127
  90. package/Build/Workers/createVectorTileClampedPolylines.js +462 -505
  91. package/Build/Workers/createVectorTileGeometries.js +377 -436
  92. package/Build/Workers/createVectorTilePoints.js +110 -77
  93. package/Build/Workers/createVectorTilePolygons.js +369 -391
  94. package/Build/Workers/createVectorTilePolylines.js +252 -244
  95. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +543 -615
  96. package/Build/Workers/createVerticesFromHeightmap.js +2244 -2677
  97. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +682 -904
  98. package/Build/Workers/createWallGeometry.js +459 -593
  99. package/Build/Workers/createWallOutlineGeometry.js +324 -419
  100. package/Build/Workers/decodeDraco.js +327 -347
  101. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +2530 -3567
  102. package/Build/Workers/decodeI3S.js +765 -970
  103. package/Build/Workers/transcodeKTX2.js +3351 -1473
  104. package/Build/Workers/transferTypedArrayTest.js +3 -4
  105. package/Build/Workers/upsampleQuantizedTerrainMesh.js +748 -953
  106. package/LICENSE.md +0 -12
  107. package/Source/Core/CesiumTerrainProvider.js +1 -2
  108. package/Source/Core/Credit.js +7 -1
  109. package/Source/Core/FeatureDetection.js +9 -0
  110. package/Source/Core/GoogleMaps.js +1 -2
  111. package/Source/Core/Ion.js +1 -2
  112. package/Source/Core/KTX2Transcoder.js +7 -3
  113. package/Source/Core/PolygonGeometry.js +340 -27
  114. package/Source/Core/PolygonGeometryLibrary.js +302 -1
  115. package/Source/Core/Stereographic.js +247 -0
  116. package/Source/Core/TaskProcessor.js +185 -168
  117. package/Source/Core/Transforms.js +2 -2
  118. package/Source/Core/buildModuleUrl.js +6 -5
  119. package/Source/Core/sampleTerrain.js +43 -10
  120. package/Source/Core/sampleTerrainMostDetailed.js +27 -3
  121. package/Source/Scene/ArcGisMapService.js +1 -2
  122. package/Source/Scene/Billboard.js +7 -0
  123. package/Source/Scene/Cesium3DTilePass.js +1 -1
  124. package/Source/Scene/Cesium3DTileset.js +38 -81
  125. package/Source/Scene/CreditDisplay.js +2 -2
  126. package/Source/Scene/DracoLoader.js +26 -3
  127. package/Source/Scene/I3SDataProvider.js +0 -27
  128. package/Source/Scene/I3SDecoder.js +127 -0
  129. package/Source/Scene/I3SNode.js +32 -110
  130. package/Source/Scene/Implicit3DTileContent.js +13 -0
  131. package/Source/Scene/ImplicitTileset.js +5 -0
  132. package/Source/Scene/LabelCollection.js +3 -1
  133. package/Source/Scene/Model/I3dmLoader.js +5 -1
  134. package/Source/Scene/Model/Model.js +20 -23
  135. package/Source/Scene/OpenStreetMapImageryProvider.js +4 -1
  136. package/Source/Scene/PostProcessStageLibrary.js +3 -3
  137. package/Source/Scene/PrimitiveCollection.js +39 -0
  138. package/Source/Scene/Scene.js +3 -0
  139. package/Source/Scene/SingleTileImageryProvider.js +4 -2
  140. package/Source/ThirdParty/Workers/basis_transcoder.js +1 -1
  141. package/Source/Widget/CesiumWidget.js +2 -1
  142. package/Source/{WorkersES6 → Workers}/createGeometry.js +11 -12
  143. package/Source/{WorkersES6 → Workers}/createTaskProcessorWorker.js +43 -59
  144. package/Source/{WorkersES6 → Workers}/decodeDraco.js +19 -25
  145. package/Source/{WorkersES6 → Workers}/decodeI3S.js +18 -32
  146. package/Source/{WorkersES6 → Workers}/transcodeKTX2.js +19 -26
  147. package/Source/Workers/transferTypedArrayTest.js +0 -6
  148. package/index.d.ts +69 -35
  149. package/index.js +189 -187
  150. package/package.json +2 -1
  151. package/Build/Workers/ArcType-2d9abbbc.js +0 -37
  152. package/Build/Workers/AttributeCompression-f9f6c717.js +0 -716
  153. package/Build/Workers/AxisAlignedBoundingBox-a03420b1.js +0 -258
  154. package/Build/Workers/BoundingRectangle-32fa8a4a.js +0 -369
  155. package/Build/Workers/BoxGeometry-cd550612.js +0 -884
  156. package/Build/Workers/Check-6ede7e26.js +0 -290
  157. package/Build/Workers/Color-571a6085.js +0 -2262
  158. package/Build/Workers/ComponentDatatype-cf1fa08e.js +0 -341
  159. package/Build/Workers/CoplanarPolygonGeometryLibrary-488b1a9f.js +0 -132
  160. package/Build/Workers/CorridorGeometryLibrary-fc4ff147.js +0 -498
  161. package/Build/Workers/CylinderGeometry-bc26926d.js +0 -467
  162. package/Build/Workers/CylinderGeometryLibrary-7bf291b4.js +0 -63
  163. package/Build/Workers/EllipseGeometry-89533a10.js +0 -1304
  164. package/Build/Workers/EllipseGeometryLibrary-b0d7df17.js +0 -366
  165. package/Build/Workers/EllipseOutlineGeometry-63ff7a87.js +0 -443
  166. package/Build/Workers/EllipsoidGeodesic-5b3623dc.js +0 -520
  167. package/Build/Workers/EllipsoidGeometry-07e99d2d.js +0 -637
  168. package/Build/Workers/EllipsoidOutlineGeometry-ba5c7ee2.js +0 -454
  169. package/Build/Workers/EllipsoidRhumbLine-ef872433.js +0 -741
  170. package/Build/Workers/EllipsoidTangentPlane-65d41b3e.js +0 -373
  171. package/Build/Workers/EncodedCartesian3-57415c8a.js +0 -171
  172. package/Build/Workers/FrustumGeometry-4a7589ed.js +0 -2540
  173. package/Build/Workers/GeometryAttribute-a5b6275b.js +0 -619
  174. package/Build/Workers/GeometryAttributes-ad136444.js +0 -91
  175. package/Build/Workers/GeometryInstance-34d9e21e.js +0 -121
  176. package/Build/Workers/GeometryOffsetAttribute-9ad0019c.js +0 -16
  177. package/Build/Workers/GeometryPipeline-fa9e6ffc.js +0 -3690
  178. package/Build/Workers/IndexDatatype-2643aa47.js +0 -200
  179. package/Build/Workers/IntersectionTests-feace3da.js +0 -1836
  180. package/Build/Workers/Math-0a2ac845.js +0 -1340
  181. package/Build/Workers/Matrix2-e1298525.js +0 -7086
  182. package/Build/Workers/Matrix3-41c58dde.js +0 -4283
  183. package/Build/Workers/OrientedBoundingBox-6b94d955.js +0 -1259
  184. package/Build/Workers/Plane-4c3d403b.js +0 -309
  185. package/Build/Workers/PolygonGeometryLibrary-4ffc457d.js +0 -1074
  186. package/Build/Workers/PolygonPipeline-d5e66350.js +0 -1344
  187. package/Build/Workers/PolylinePipeline-83410f0c.js +0 -573
  188. package/Build/Workers/PolylineVolumeGeometryLibrary-290e7aec.js +0 -781
  189. package/Build/Workers/PrimitivePipeline-6081d138.js +0 -966
  190. package/Build/Workers/RectangleGeometryLibrary-986710d8.js +0 -280
  191. package/Build/Workers/RuntimeError-ef395448.js +0 -68
  192. package/Build/Workers/TerrainEncoding-528e1d68.js +0 -1227
  193. package/Build/Workers/Transforms-b527bb09.js +0 -14714
  194. package/Build/Workers/VertexFormat-030f11ff.js +0 -312
  195. package/Build/Workers/WallGeometryLibrary-faf583f8.js +0 -211
  196. package/Build/Workers/WebGLConstants-0b1ce7ba.js +0 -620
  197. package/Build/Workers/WebMercatorProjection-13ed1a6e.js +0 -151
  198. package/Build/Workers/arrayRemoveDuplicates-d2061e85.js +0 -129
  199. package/Build/Workers/cesiumWorkerBootstrapper.js +0 -1363
  200. package/Build/Workers/combine-d9581036.js +0 -82
  201. package/Build/Workers/defaultValue-fe22d8c0.js +0 -51
  202. package/Source/ThirdParty/Workers/draco_decoder_nodejs.js +0 -117
  203. package/Source/Workers/cesiumWorkerBootstrapper.js +0 -2290
  204. package/Source/Workers/package.json +0 -1
  205. /package/Source/{WorkersES6 → Workers}/combineGeometry.js +0 -0
  206. /package/Source/{WorkersES6 → Workers}/createBoxGeometry.js +0 -0
  207. /package/Source/{WorkersES6 → Workers}/createBoxOutlineGeometry.js +0 -0
  208. /package/Source/{WorkersES6 → Workers}/createCircleGeometry.js +0 -0
  209. /package/Source/{WorkersES6 → Workers}/createCircleOutlineGeometry.js +0 -0
  210. /package/Source/{WorkersES6 → Workers}/createCoplanarPolygonGeometry.js +0 -0
  211. /package/Source/{WorkersES6 → Workers}/createCoplanarPolygonOutlineGeometry.js +0 -0
  212. /package/Source/{WorkersES6 → Workers}/createCorridorGeometry.js +0 -0
  213. /package/Source/{WorkersES6 → Workers}/createCorridorOutlineGeometry.js +0 -0
  214. /package/Source/{WorkersES6 → Workers}/createCylinderGeometry.js +0 -0
  215. /package/Source/{WorkersES6 → Workers}/createCylinderOutlineGeometry.js +0 -0
  216. /package/Source/{WorkersES6 → Workers}/createEllipseGeometry.js +0 -0
  217. /package/Source/{WorkersES6 → Workers}/createEllipseOutlineGeometry.js +0 -0
  218. /package/Source/{WorkersES6 → Workers}/createEllipsoidGeometry.js +0 -0
  219. /package/Source/{WorkersES6 → Workers}/createEllipsoidOutlineGeometry.js +0 -0
  220. /package/Source/{WorkersES6 → Workers}/createFrustumGeometry.js +0 -0
  221. /package/Source/{WorkersES6 → Workers}/createFrustumOutlineGeometry.js +0 -0
  222. /package/Source/{WorkersES6 → Workers}/createGroundPolylineGeometry.js +0 -0
  223. /package/Source/{WorkersES6 → Workers}/createPlaneGeometry.js +0 -0
  224. /package/Source/{WorkersES6 → Workers}/createPlaneOutlineGeometry.js +0 -0
  225. /package/Source/{WorkersES6 → Workers}/createPolygonGeometry.js +0 -0
  226. /package/Source/{WorkersES6 → Workers}/createPolygonOutlineGeometry.js +0 -0
  227. /package/Source/{WorkersES6 → Workers}/createPolylineGeometry.js +0 -0
  228. /package/Source/{WorkersES6 → Workers}/createPolylineVolumeGeometry.js +0 -0
  229. /package/Source/{WorkersES6 → Workers}/createPolylineVolumeOutlineGeometry.js +0 -0
  230. /package/Source/{WorkersES6 → Workers}/createRectangleGeometry.js +0 -0
  231. /package/Source/{WorkersES6 → Workers}/createRectangleOutlineGeometry.js +0 -0
  232. /package/Source/{WorkersES6 → Workers}/createSimplePolylineGeometry.js +0 -0
  233. /package/Source/{WorkersES6 → Workers}/createSphereGeometry.js +0 -0
  234. /package/Source/{WorkersES6 → Workers}/createSphereOutlineGeometry.js +0 -0
  235. /package/Source/{WorkersES6 → Workers}/createVectorTileClampedPolylines.js +0 -0
  236. /package/Source/{WorkersES6 → Workers}/createVectorTileGeometries.js +0 -0
  237. /package/Source/{WorkersES6 → Workers}/createVectorTilePoints.js +0 -0
  238. /package/Source/{WorkersES6 → Workers}/createVectorTilePolygons.js +0 -0
  239. /package/Source/{WorkersES6 → Workers}/createVectorTilePolylines.js +0 -0
  240. /package/Source/{WorkersES6 → Workers}/createVerticesFromGoogleEarthEnterpriseBuffer.js +0 -0
  241. /package/Source/{WorkersES6 → Workers}/createVerticesFromHeightmap.js +0 -0
  242. /package/Source/{WorkersES6 → Workers}/createVerticesFromQuantizedTerrainMesh.js +0 -0
  243. /package/Source/{WorkersES6 → Workers}/createWallGeometry.js +0 -0
  244. /package/Source/{WorkersES6 → Workers}/createWallOutlineGeometry.js +0 -0
  245. /package/Source/{WorkersES6 → Workers}/decodeGoogleEarthEnterprisePacket.js +0 -0
  246. /package/Source/{WorkersES6 → Workers}/upsampleQuantizedTerrainMesh.js +0 -0
@@ -1,967 +1,745 @@
1
- define(['./AxisAlignedBoundingBox-a03420b1', './Matrix2-e1298525', './Matrix3-41c58dde', './defaultValue-fe22d8c0', './TerrainEncoding-528e1d68', './IndexDatatype-2643aa47', './Math-0a2ac845', './Check-6ede7e26', './Transforms-b527bb09', './WebMercatorProjection-13ed1a6e', './createTaskProcessorWorker', './RuntimeError-ef395448', './AttributeCompression-f9f6c717', './ComponentDatatype-cf1fa08e', './WebGLConstants-0b1ce7ba', './combine-d9581036'], (function (AxisAlignedBoundingBox, Matrix2, Matrix3, defaultValue, TerrainEncoding, IndexDatatype, Math$1, Check, Transforms, WebMercatorProjection, createTaskProcessorWorker, RuntimeError, AttributeCompression, ComponentDatatype, WebGLConstants, combine) { 'use strict';
2
-
1
+ /**
2
+ * @license
3
+ * Cesium - https://github.com/CesiumGS/cesium
4
+ * Version 1.110
5
+ *
6
+ * Copyright 2011-2022 Cesium Contributors
7
+ *
8
+ * Licensed under the Apache License, Version 2.0 (the "License");
9
+ * you may not use this file except in compliance with the License.
10
+ * You may obtain a copy of the License at
11
+ *
12
+ * http://www.apache.org/licenses/LICENSE-2.0
13
+ *
14
+ * Unless required by applicable law or agreed to in writing, software
15
+ * distributed under the License is distributed on an "AS IS" BASIS,
16
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ * See the License for the specific language governing permissions and
18
+ * limitations under the License.
19
+ *
20
+ * Columbus View (Pat. Pend.)
21
+ *
22
+ * Portions licensed separately.
23
+ * See https://github.com/CesiumGS/cesium/blob/main/LICENSE.md for full licensing details.
24
+ */
25
+
26
+ import {
27
+ EllipsoidalOccluder_default,
28
+ TerrainEncoding_default
29
+ } from "./chunk-2U6EBIRX.js";
30
+ import {
31
+ createTaskProcessorWorker_default
32
+ } from "./chunk-UM7FIUQW.js";
33
+ import {
34
+ WebMercatorProjection_default
35
+ } from "./chunk-KZFXE35V.js";
36
+ import "./chunk-QUCJGBCK.js";
37
+ import {
38
+ AxisAlignedBoundingBox_default
39
+ } from "./chunk-PEVZYZBQ.js";
40
+ import {
41
+ IndexDatatype_default
42
+ } from "./chunk-CROU4RHL.js";
43
+ import {
44
+ Transforms_default
45
+ } from "./chunk-V5S5N2IS.js";
46
+ import "./chunk-ULLMQNFQ.js";
47
+ import {
48
+ Cartesian2_default,
49
+ Matrix4_default,
50
+ Rectangle_default
51
+ } from "./chunk-MYDS6HBL.js";
52
+ import "./chunk-CTJCECTX.js";
53
+ import {
54
+ Cartesian3_default,
55
+ Cartographic_default,
56
+ Ellipsoid_default
57
+ } from "./chunk-HIDSEUWS.js";
58
+ import {
59
+ Math_default
60
+ } from "./chunk-4HN3N5SE.js";
61
+ import "./chunk-TXYJOVQK.js";
62
+ import "./chunk-2ZI7FZ3Q.js";
63
+ import "./chunk-GPO47TW4.js";
64
+ import {
65
+ DeveloperError_default
66
+ } from "./chunk-6EHT6GS3.js";
67
+ import {
68
+ defined_default
69
+ } from "./chunk-TXOGSFHZ.js";
70
+
71
+ // packages/engine/Source/Core/TerrainProvider.js
72
+ function TerrainProvider() {
73
+ DeveloperError_default.throwInstantiationError();
74
+ }
75
+ Object.defineProperties(TerrainProvider.prototype, {
3
76
  /**
4
- * Provides terrain or other geometry for the surface of an ellipsoid. The surface geometry is
5
- * organized into a pyramid of tiles according to a {@link TilingScheme}. This type describes an
6
- * interface and is not intended to be instantiated directly.
7
- *
8
- * @alias TerrainProvider
9
- * @constructor
10
- *
11
- * @see EllipsoidTerrainProvider
12
- * @see CesiumTerrainProvider
13
- * @see VRTheWorldTerrainProvider
14
- * @see GoogleEarthEnterpriseTerrainProvider
77
+ * Gets an event that is raised when the terrain provider encounters an asynchronous error. By subscribing
78
+ * to the event, you will be notified of the error and can potentially recover from it. Event listeners
79
+ * are passed an instance of {@link TileProviderError}.
80
+ * @memberof TerrainProvider.prototype
81
+ * @type {Event<TerrainProvider.ErrorEvent>}
82
+ * @readonly
15
83
  */
16
- function TerrainProvider() {
17
- Check.DeveloperError.throwInstantiationError();
18
- }
19
-
20
- Object.defineProperties(TerrainProvider.prototype, {
21
- /**
22
- * Gets an event that is raised when the terrain provider encounters an asynchronous error. By subscribing
23
- * to the event, you will be notified of the error and can potentially recover from it. Event listeners
24
- * are passed an instance of {@link TileProviderError}.
25
- * @memberof TerrainProvider.prototype
26
- * @type {Event<TerrainProvider.ErrorEvent>}
27
- * @readonly
28
- */
29
- errorEvent: {
30
- get: Check.DeveloperError.throwInstantiationError,
31
- },
32
-
33
- /**
34
- * Gets the credit to display when this terrain provider is active. Typically this is used to credit
35
- * the source of the terrain.
36
- * @memberof TerrainProvider.prototype
37
- * @type {Credit}
38
- * @readonly
39
- */
40
- credit: {
41
- get: Check.DeveloperError.throwInstantiationError,
42
- },
43
-
44
- /**
45
- * Gets the tiling scheme used by the provider.
46
- * @memberof TerrainProvider.prototype
47
- * @type {TilingScheme}
48
- * @readonly
49
- */
50
- tilingScheme: {
51
- get: Check.DeveloperError.throwInstantiationError,
52
- },
53
-
54
- /**
55
- * Gets a value indicating whether or not the provider includes a water mask. The water mask
56
- * indicates which areas of the globe are water rather than land, so they can be rendered
57
- * as a reflective surface with animated waves.
58
- * @memberof TerrainProvider.prototype
59
- * @type {boolean}
60
- * @readonly
61
- */
62
- hasWaterMask: {
63
- get: Check.DeveloperError.throwInstantiationError,
64
- },
65
-
66
- /**
67
- * Gets a value indicating whether or not the requested tiles include vertex normals.
68
- * @memberof TerrainProvider.prototype
69
- * @type {boolean}
70
- * @readonly
71
- */
72
- hasVertexNormals: {
73
- get: Check.DeveloperError.throwInstantiationError,
74
- },
75
-
76
- /**
77
- * Gets an object that can be used to determine availability of terrain from this provider, such as
78
- * at points and in rectangles. This property may be undefined if availability
79
- * information is not available.
80
- * @memberof TerrainProvider.prototype
81
- * @type {TileAvailability}
82
- * @readonly
83
- */
84
- availability: {
85
- get: Check.DeveloperError.throwInstantiationError,
86
- },
87
- });
88
-
89
- const regularGridIndicesCache = [];
90
-
84
+ errorEvent: {
85
+ get: DeveloperError_default.throwInstantiationError
86
+ },
91
87
  /**
92
- * Gets a list of indices for a triangle mesh representing a regular grid. Calling
93
- * this function multiple times with the same grid width and height returns the
94
- * same list of indices. The total number of vertices must be less than or equal
95
- * to 65536.
96
- *
97
- * @param {number} width The number of vertices in the regular grid in the horizontal direction.
98
- * @param {number} height The number of vertices in the regular grid in the vertical direction.
99
- * @returns {Uint16Array|Uint32Array} The list of indices. Uint16Array gets returned for 64KB or less and Uint32Array for 4GB or less.
88
+ * Gets the credit to display when this terrain provider is active. Typically this is used to credit
89
+ * the source of the terrain.
90
+ * @memberof TerrainProvider.prototype
91
+ * @type {Credit}
92
+ * @readonly
100
93
  */
101
- TerrainProvider.getRegularGridIndices = function (width, height) {
102
- //>>includeStart('debug', pragmas.debug);
103
- if (width * height >= Math$1.CesiumMath.FOUR_GIGABYTES) {
104
- throw new Check.DeveloperError(
105
- "The total number of vertices (width * height) must be less than 4,294,967,296."
106
- );
107
- }
108
- //>>includeEnd('debug');
109
-
110
- let byWidth = regularGridIndicesCache[width];
111
- if (!defaultValue.defined(byWidth)) {
112
- regularGridIndicesCache[width] = byWidth = [];
113
- }
114
-
115
- let indices = byWidth[height];
116
- if (!defaultValue.defined(indices)) {
117
- if (width * height < Math$1.CesiumMath.SIXTY_FOUR_KILOBYTES) {
118
- indices = byWidth[height] = new Uint16Array(
119
- (width - 1) * (height - 1) * 6
120
- );
121
- } else {
122
- indices = byWidth[height] = new Uint32Array(
123
- (width - 1) * (height - 1) * 6
124
- );
125
- }
126
- addRegularGridIndices(width, height, indices, 0);
127
- }
128
-
129
- return indices;
130
- };
131
-
132
- const regularGridAndEdgeIndicesCache = [];
133
-
94
+ credit: {
95
+ get: DeveloperError_default.throwInstantiationError
96
+ },
134
97
  /**
135
- * @private
98
+ * Gets the tiling scheme used by the provider.
99
+ * @memberof TerrainProvider.prototype
100
+ * @type {TilingScheme}
101
+ * @readonly
136
102
  */
137
- TerrainProvider.getRegularGridIndicesAndEdgeIndices = function (width, height) {
138
- //>>includeStart('debug', pragmas.debug);
139
- if (width * height >= Math$1.CesiumMath.FOUR_GIGABYTES) {
140
- throw new Check.DeveloperError(
141
- "The total number of vertices (width * height) must be less than 4,294,967,296."
142
- );
143
- }
144
- //>>includeEnd('debug');
145
-
146
- let byWidth = regularGridAndEdgeIndicesCache[width];
147
- if (!defaultValue.defined(byWidth)) {
148
- regularGridAndEdgeIndicesCache[width] = byWidth = [];
149
- }
150
-
151
- let indicesAndEdges = byWidth[height];
152
- if (!defaultValue.defined(indicesAndEdges)) {
153
- const indices = TerrainProvider.getRegularGridIndices(width, height);
154
-
155
- const edgeIndices = getEdgeIndices(width, height);
156
- const westIndicesSouthToNorth = edgeIndices.westIndicesSouthToNorth;
157
- const southIndicesEastToWest = edgeIndices.southIndicesEastToWest;
158
- const eastIndicesNorthToSouth = edgeIndices.eastIndicesNorthToSouth;
159
- const northIndicesWestToEast = edgeIndices.northIndicesWestToEast;
160
-
161
- indicesAndEdges = byWidth[height] = {
162
- indices: indices,
163
- westIndicesSouthToNorth: westIndicesSouthToNorth,
164
- southIndicesEastToWest: southIndicesEastToWest,
165
- eastIndicesNorthToSouth: eastIndicesNorthToSouth,
166
- northIndicesWestToEast: northIndicesWestToEast,
167
- };
168
- }
169
-
170
- return indicesAndEdges;
171
- };
172
-
173
- const regularGridAndSkirtAndEdgeIndicesCache = [];
174
-
103
+ tilingScheme: {
104
+ get: DeveloperError_default.throwInstantiationError
105
+ },
106
+ /**
107
+ * Gets a value indicating whether or not the provider includes a water mask. The water mask
108
+ * indicates which areas of the globe are water rather than land, so they can be rendered
109
+ * as a reflective surface with animated waves.
110
+ * @memberof TerrainProvider.prototype
111
+ * @type {boolean}
112
+ * @readonly
113
+ */
114
+ hasWaterMask: {
115
+ get: DeveloperError_default.throwInstantiationError
116
+ },
117
+ /**
118
+ * Gets a value indicating whether or not the requested tiles include vertex normals.
119
+ * @memberof TerrainProvider.prototype
120
+ * @type {boolean}
121
+ * @readonly
122
+ */
123
+ hasVertexNormals: {
124
+ get: DeveloperError_default.throwInstantiationError
125
+ },
175
126
  /**
176
- * @private
127
+ * Gets an object that can be used to determine availability of terrain from this provider, such as
128
+ * at points and in rectangles. This property may be undefined if availability
129
+ * information is not available.
130
+ * @memberof TerrainProvider.prototype
131
+ * @type {TileAvailability}
132
+ * @readonly
177
133
  */
178
- TerrainProvider.getRegularGridAndSkirtIndicesAndEdgeIndices = function (
179
- width,
180
- height
181
- ) {
182
- //>>includeStart('debug', pragmas.debug);
183
- if (width * height >= Math$1.CesiumMath.FOUR_GIGABYTES) {
184
- throw new Check.DeveloperError(
185
- "The total number of vertices (width * height) must be less than 4,294,967,296."
134
+ availability: {
135
+ get: DeveloperError_default.throwInstantiationError
136
+ }
137
+ });
138
+ var regularGridIndicesCache = [];
139
+ TerrainProvider.getRegularGridIndices = function(width, height) {
140
+ if (width * height >= Math_default.FOUR_GIGABYTES) {
141
+ throw new DeveloperError_default(
142
+ "The total number of vertices (width * height) must be less than 4,294,967,296."
143
+ );
144
+ }
145
+ let byWidth = regularGridIndicesCache[width];
146
+ if (!defined_default(byWidth)) {
147
+ regularGridIndicesCache[width] = byWidth = [];
148
+ }
149
+ let indices = byWidth[height];
150
+ if (!defined_default(indices)) {
151
+ if (width * height < Math_default.SIXTY_FOUR_KILOBYTES) {
152
+ indices = byWidth[height] = new Uint16Array(
153
+ (width - 1) * (height - 1) * 6
186
154
  );
187
- }
188
- //>>includeEnd('debug');
189
-
190
- let byWidth = regularGridAndSkirtAndEdgeIndicesCache[width];
191
- if (!defaultValue.defined(byWidth)) {
192
- regularGridAndSkirtAndEdgeIndicesCache[width] = byWidth = [];
193
- }
194
-
195
- let indicesAndEdges = byWidth[height];
196
- if (!defaultValue.defined(indicesAndEdges)) {
197
- const gridVertexCount = width * height;
198
- const gridIndexCount = (width - 1) * (height - 1) * 6;
199
- const edgeVertexCount = width * 2 + height * 2;
200
- const edgeIndexCount = Math.max(0, edgeVertexCount - 4) * 6;
201
- const vertexCount = gridVertexCount + edgeVertexCount;
202
- const indexCount = gridIndexCount + edgeIndexCount;
203
-
204
- const edgeIndices = getEdgeIndices(width, height);
205
- const westIndicesSouthToNorth = edgeIndices.westIndicesSouthToNorth;
206
- const southIndicesEastToWest = edgeIndices.southIndicesEastToWest;
207
- const eastIndicesNorthToSouth = edgeIndices.eastIndicesNorthToSouth;
208
- const northIndicesWestToEast = edgeIndices.northIndicesWestToEast;
209
-
210
- const indices = IndexDatatype.IndexDatatype.createTypedArray(vertexCount, indexCount);
211
- addRegularGridIndices(width, height, indices, 0);
212
- TerrainProvider.addSkirtIndices(
213
- westIndicesSouthToNorth,
214
- southIndicesEastToWest,
215
- eastIndicesNorthToSouth,
216
- northIndicesWestToEast,
217
- gridVertexCount,
218
- indices,
219
- gridIndexCount
155
+ } else {
156
+ indices = byWidth[height] = new Uint32Array(
157
+ (width - 1) * (height - 1) * 6
220
158
  );
221
-
222
- indicesAndEdges = byWidth[height] = {
223
- indices: indices,
224
- westIndicesSouthToNorth: westIndicesSouthToNorth,
225
- southIndicesEastToWest: southIndicesEastToWest,
226
- eastIndicesNorthToSouth: eastIndicesNorthToSouth,
227
- northIndicesWestToEast: northIndicesWestToEast,
228
- indexCountWithoutSkirts: gridIndexCount,
229
- };
230
159
  }
231
-
232
- return indicesAndEdges;
233
- };
234
-
235
- /**
236
- * @private
237
- */
238
- TerrainProvider.addSkirtIndices = function (
239
- westIndicesSouthToNorth,
240
- southIndicesEastToWest,
241
- eastIndicesNorthToSouth,
242
- northIndicesWestToEast,
243
- vertexCount,
244
- indices,
245
- offset
246
- ) {
247
- let vertexIndex = vertexCount;
248
- offset = addSkirtIndices(
249
- westIndicesSouthToNorth,
250
- vertexIndex,
251
- indices,
252
- offset
160
+ addRegularGridIndices(width, height, indices, 0);
161
+ }
162
+ return indices;
163
+ };
164
+ var regularGridAndEdgeIndicesCache = [];
165
+ TerrainProvider.getRegularGridIndicesAndEdgeIndices = function(width, height) {
166
+ if (width * height >= Math_default.FOUR_GIGABYTES) {
167
+ throw new DeveloperError_default(
168
+ "The total number of vertices (width * height) must be less than 4,294,967,296."
253
169
  );
254
- vertexIndex += westIndicesSouthToNorth.length;
255
- offset = addSkirtIndices(
256
- southIndicesEastToWest,
257
- vertexIndex,
170
+ }
171
+ let byWidth = regularGridAndEdgeIndicesCache[width];
172
+ if (!defined_default(byWidth)) {
173
+ regularGridAndEdgeIndicesCache[width] = byWidth = [];
174
+ }
175
+ let indicesAndEdges = byWidth[height];
176
+ if (!defined_default(indicesAndEdges)) {
177
+ const indices = TerrainProvider.getRegularGridIndices(width, height);
178
+ const edgeIndices = getEdgeIndices(width, height);
179
+ const westIndicesSouthToNorth = edgeIndices.westIndicesSouthToNorth;
180
+ const southIndicesEastToWest = edgeIndices.southIndicesEastToWest;
181
+ const eastIndicesNorthToSouth = edgeIndices.eastIndicesNorthToSouth;
182
+ const northIndicesWestToEast = edgeIndices.northIndicesWestToEast;
183
+ indicesAndEdges = byWidth[height] = {
258
184
  indices,
259
- offset
185
+ westIndicesSouthToNorth,
186
+ southIndicesEastToWest,
187
+ eastIndicesNorthToSouth,
188
+ northIndicesWestToEast
189
+ };
190
+ }
191
+ return indicesAndEdges;
192
+ };
193
+ var regularGridAndSkirtAndEdgeIndicesCache = [];
194
+ TerrainProvider.getRegularGridAndSkirtIndicesAndEdgeIndices = function(width, height) {
195
+ if (width * height >= Math_default.FOUR_GIGABYTES) {
196
+ throw new DeveloperError_default(
197
+ "The total number of vertices (width * height) must be less than 4,294,967,296."
260
198
  );
261
- vertexIndex += southIndicesEastToWest.length;
262
- offset = addSkirtIndices(
199
+ }
200
+ let byWidth = regularGridAndSkirtAndEdgeIndicesCache[width];
201
+ if (!defined_default(byWidth)) {
202
+ regularGridAndSkirtAndEdgeIndicesCache[width] = byWidth = [];
203
+ }
204
+ let indicesAndEdges = byWidth[height];
205
+ if (!defined_default(indicesAndEdges)) {
206
+ const gridVertexCount = width * height;
207
+ const gridIndexCount = (width - 1) * (height - 1) * 6;
208
+ const edgeVertexCount = width * 2 + height * 2;
209
+ const edgeIndexCount = Math.max(0, edgeVertexCount - 4) * 6;
210
+ const vertexCount = gridVertexCount + edgeVertexCount;
211
+ const indexCount = gridIndexCount + edgeIndexCount;
212
+ const edgeIndices = getEdgeIndices(width, height);
213
+ const westIndicesSouthToNorth = edgeIndices.westIndicesSouthToNorth;
214
+ const southIndicesEastToWest = edgeIndices.southIndicesEastToWest;
215
+ const eastIndicesNorthToSouth = edgeIndices.eastIndicesNorthToSouth;
216
+ const northIndicesWestToEast = edgeIndices.northIndicesWestToEast;
217
+ const indices = IndexDatatype_default.createTypedArray(vertexCount, indexCount);
218
+ addRegularGridIndices(width, height, indices, 0);
219
+ TerrainProvider.addSkirtIndices(
220
+ westIndicesSouthToNorth,
221
+ southIndicesEastToWest,
263
222
  eastIndicesNorthToSouth,
264
- vertexIndex,
223
+ northIndicesWestToEast,
224
+ gridVertexCount,
265
225
  indices,
266
- offset
226
+ gridIndexCount
267
227
  );
268
- vertexIndex += eastIndicesNorthToSouth.length;
269
- addSkirtIndices(northIndicesWestToEast, vertexIndex, indices, offset);
270
- };
271
-
272
- function getEdgeIndices(width, height) {
273
- const westIndicesSouthToNorth = new Array(height);
274
- const southIndicesEastToWest = new Array(width);
275
- const eastIndicesNorthToSouth = new Array(height);
276
- const northIndicesWestToEast = new Array(width);
277
-
278
- let i;
279
- for (i = 0; i < width; ++i) {
280
- northIndicesWestToEast[i] = i;
281
- southIndicesEastToWest[i] = width * height - 1 - i;
282
- }
283
-
284
- for (i = 0; i < height; ++i) {
285
- eastIndicesNorthToSouth[i] = (i + 1) * width - 1;
286
- westIndicesSouthToNorth[i] = (height - i - 1) * width;
287
- }
288
-
289
- return {
290
- westIndicesSouthToNorth: westIndicesSouthToNorth,
291
- southIndicesEastToWest: southIndicesEastToWest,
292
- eastIndicesNorthToSouth: eastIndicesNorthToSouth,
293
- northIndicesWestToEast: northIndicesWestToEast,
228
+ indicesAndEdges = byWidth[height] = {
229
+ indices,
230
+ westIndicesSouthToNorth,
231
+ southIndicesEastToWest,
232
+ eastIndicesNorthToSouth,
233
+ northIndicesWestToEast,
234
+ indexCountWithoutSkirts: gridIndexCount
294
235
  };
295
236
  }
296
-
297
- function addRegularGridIndices(width, height, indices, offset) {
298
- let index = 0;
299
- for (let j = 0; j < height - 1; ++j) {
300
- for (let i = 0; i < width - 1; ++i) {
301
- const upperLeft = index;
302
- const lowerLeft = upperLeft + width;
303
- const lowerRight = lowerLeft + 1;
304
- const upperRight = upperLeft + 1;
305
-
306
- indices[offset++] = upperLeft;
307
- indices[offset++] = lowerLeft;
308
- indices[offset++] = upperRight;
309
- indices[offset++] = upperRight;
310
- indices[offset++] = lowerLeft;
311
- indices[offset++] = lowerRight;
312
-
313
- ++index;
314
- }
315
- ++index;
316
- }
237
+ return indicesAndEdges;
238
+ };
239
+ TerrainProvider.addSkirtIndices = function(westIndicesSouthToNorth, southIndicesEastToWest, eastIndicesNorthToSouth, northIndicesWestToEast, vertexCount, indices, offset) {
240
+ let vertexIndex = vertexCount;
241
+ offset = addSkirtIndices(
242
+ westIndicesSouthToNorth,
243
+ vertexIndex,
244
+ indices,
245
+ offset
246
+ );
247
+ vertexIndex += westIndicesSouthToNorth.length;
248
+ offset = addSkirtIndices(
249
+ southIndicesEastToWest,
250
+ vertexIndex,
251
+ indices,
252
+ offset
253
+ );
254
+ vertexIndex += southIndicesEastToWest.length;
255
+ offset = addSkirtIndices(
256
+ eastIndicesNorthToSouth,
257
+ vertexIndex,
258
+ indices,
259
+ offset
260
+ );
261
+ vertexIndex += eastIndicesNorthToSouth.length;
262
+ addSkirtIndices(northIndicesWestToEast, vertexIndex, indices, offset);
263
+ };
264
+ function getEdgeIndices(width, height) {
265
+ const westIndicesSouthToNorth = new Array(height);
266
+ const southIndicesEastToWest = new Array(width);
267
+ const eastIndicesNorthToSouth = new Array(height);
268
+ const northIndicesWestToEast = new Array(width);
269
+ let i;
270
+ for (i = 0; i < width; ++i) {
271
+ northIndicesWestToEast[i] = i;
272
+ southIndicesEastToWest[i] = width * height - 1 - i;
317
273
  }
318
-
319
- function addSkirtIndices(edgeIndices, vertexIndex, indices, offset) {
320
- let previousIndex = edgeIndices[0];
321
-
322
- const length = edgeIndices.length;
323
- for (let i = 1; i < length; ++i) {
324
- const index = edgeIndices[i];
325
-
326
- indices[offset++] = previousIndex;
327
- indices[offset++] = index;
328
- indices[offset++] = vertexIndex;
329
-
330
- indices[offset++] = vertexIndex;
331
- indices[offset++] = index;
332
- indices[offset++] = vertexIndex + 1;
333
-
334
- previousIndex = index;
335
- ++vertexIndex;
336
- }
337
-
338
- return offset;
274
+ for (i = 0; i < height; ++i) {
275
+ eastIndicesNorthToSouth[i] = (i + 1) * width - 1;
276
+ westIndicesSouthToNorth[i] = (height - i - 1) * width;
339
277
  }
340
-
341
- /**
342
- * Specifies the quality of terrain created from heightmaps. A value of 1.0 will
343
- * ensure that adjacent heightmap vertices are separated by no more than
344
- * {@link Globe.maximumScreenSpaceError} screen pixels and will probably go very slowly.
345
- * A value of 0.5 will cut the estimated level zero geometric error in half, allowing twice the
346
- * screen pixels between adjacent heightmap vertices and thus rendering more quickly.
347
- * @type {number}
348
- */
349
- TerrainProvider.heightmapTerrainQuality = 0.25;
350
-
351
- /**
352
- * Determines an appropriate geometric error estimate when the geometry comes from a heightmap.
353
- *
354
- * @param {Ellipsoid} ellipsoid The ellipsoid to which the terrain is attached.
355
- * @param {number} tileImageWidth The width, in pixels, of the heightmap associated with a single tile.
356
- * @param {number} numberOfTilesAtLevelZero The number of tiles in the horizontal direction at tile level zero.
357
- * @returns {number} An estimated geometric error.
358
- */
359
- TerrainProvider.getEstimatedLevelZeroGeometricErrorForAHeightmap = function (
360
- ellipsoid,
361
- tileImageWidth,
362
- numberOfTilesAtLevelZero
363
- ) {
364
- return (
365
- (ellipsoid.maximumRadius *
366
- 2 *
367
- Math.PI *
368
- TerrainProvider.heightmapTerrainQuality) /
369
- (tileImageWidth * numberOfTilesAtLevelZero)
370
- );
278
+ return {
279
+ westIndicesSouthToNorth,
280
+ southIndicesEastToWest,
281
+ eastIndicesNorthToSouth,
282
+ northIndicesWestToEast
371
283
  };
372
-
373
- /**
374
- * Requests the geometry for a given tile. The result must include terrain data and
375
- * may optionally include a water mask and an indication of which child tiles are available.
376
- * @function
377
- *
378
- * @param {number} x The X coordinate of the tile for which to request geometry.
379
- * @param {number} y The Y coordinate of the tile for which to request geometry.
380
- * @param {number} level The level of the tile for which to request geometry.
381
- * @param {Request} [request] The request object. Intended for internal use only.
382
- *
383
- * @returns {Promise<TerrainData>|undefined} A promise for the requested geometry. If this method
384
- * returns undefined instead of a promise, it is an indication that too many requests are already
385
- * pending and the request will be retried later.
386
- */
387
- TerrainProvider.prototype.requestTileGeometry =
388
- Check.DeveloperError.throwInstantiationError;
389
-
390
- /**
391
- * Gets the maximum geometric error allowed in a tile at a given level.
392
- * @function
393
- *
394
- * @param {number} level The tile level for which to get the maximum geometric error.
395
- * @returns {number} The maximum geometric error.
396
- */
397
- TerrainProvider.prototype.getLevelMaximumGeometricError =
398
- Check.DeveloperError.throwInstantiationError;
399
-
400
- /**
401
- * Determines whether data for a tile is available to be loaded.
402
- * @function
403
- *
404
- * @param {number} x The X coordinate of the tile for which to request geometry.
405
- * @param {number} y The Y coordinate of the tile for which to request geometry.
406
- * @param {number} level The level of the tile for which to request geometry.
407
- * @returns {boolean|undefined} Undefined if not supported by the terrain provider, otherwise true or false.
408
- */
409
- TerrainProvider.prototype.getTileDataAvailable =
410
- Check.DeveloperError.throwInstantiationError;
411
-
412
- /**
413
- * Makes sure we load availability data for a tile
414
- * @function
415
- *
416
- * @param {number} x The X coordinate of the tile for which to request geometry.
417
- * @param {number} y The Y coordinate of the tile for which to request geometry.
418
- * @param {number} level The level of the tile for which to request geometry.
419
- * @returns {undefined|Promise<void>} Undefined if nothing need to be loaded or a Promise that resolves when all required tiles are loaded
420
- */
421
- TerrainProvider.prototype.loadTileDataAvailability =
422
- Check.DeveloperError.throwInstantiationError;
423
-
424
- /**
425
- * A function that is called when an error occurs.
426
- * @callback TerrainProvider.ErrorEvent
427
- *
428
- * @this TerrainProvider
429
- * @param {TileProviderError} err An object holding details about the error that occurred.
430
- */
431
-
432
- const maxShort = 32767;
433
-
434
- const cartesian3Scratch = new Matrix3.Cartesian3();
435
- const scratchMinimum = new Matrix3.Cartesian3();
436
- const scratchMaximum = new Matrix3.Cartesian3();
437
- const cartographicScratch = new Matrix3.Cartographic();
438
- const toPack = new Matrix2.Cartesian2();
439
-
440
- function createVerticesFromQuantizedTerrainMesh(
441
- parameters,
442
- transferableObjects
443
- ) {
444
- const quantizedVertices = parameters.quantizedVertices;
445
- const quantizedVertexCount = quantizedVertices.length / 3;
446
- const octEncodedNormals = parameters.octEncodedNormals;
447
- const edgeVertexCount =
448
- parameters.westIndices.length +
449
- parameters.eastIndices.length +
450
- parameters.southIndices.length +
451
- parameters.northIndices.length;
452
- const includeWebMercatorT = parameters.includeWebMercatorT;
453
-
454
- const exaggeration = parameters.exaggeration;
455
- const exaggerationRelativeHeight = parameters.exaggerationRelativeHeight;
456
- const hasExaggeration = exaggeration !== 1.0;
457
- const includeGeodeticSurfaceNormals = hasExaggeration;
458
-
459
- const rectangle = Matrix2.Rectangle.clone(parameters.rectangle);
460
- const west = rectangle.west;
461
- const south = rectangle.south;
462
- const east = rectangle.east;
463
- const north = rectangle.north;
464
-
465
- const ellipsoid = Matrix3.Ellipsoid.clone(parameters.ellipsoid);
466
-
467
- const minimumHeight = parameters.minimumHeight;
468
- const maximumHeight = parameters.maximumHeight;
469
-
470
- const center = parameters.relativeToCenter;
471
- const fromENU = Transforms.Transforms.eastNorthUpToFixedFrame(center, ellipsoid);
472
- const toENU = Matrix2.Matrix4.inverseTransformation(fromENU, new Matrix2.Matrix4());
473
-
474
- let southMercatorY;
475
- let oneOverMercatorHeight;
476
- if (includeWebMercatorT) {
477
- southMercatorY = WebMercatorProjection.WebMercatorProjection.geodeticLatitudeToMercatorAngle(
478
- south
479
- );
480
- oneOverMercatorHeight =
481
- 1.0 /
482
- (WebMercatorProjection.WebMercatorProjection.geodeticLatitudeToMercatorAngle(north) -
483
- southMercatorY);
284
+ }
285
+ function addRegularGridIndices(width, height, indices, offset) {
286
+ let index = 0;
287
+ for (let j = 0; j < height - 1; ++j) {
288
+ for (let i = 0; i < width - 1; ++i) {
289
+ const upperLeft = index;
290
+ const lowerLeft = upperLeft + width;
291
+ const lowerRight = lowerLeft + 1;
292
+ const upperRight = upperLeft + 1;
293
+ indices[offset++] = upperLeft;
294
+ indices[offset++] = lowerLeft;
295
+ indices[offset++] = upperRight;
296
+ indices[offset++] = upperRight;
297
+ indices[offset++] = lowerLeft;
298
+ indices[offset++] = lowerRight;
299
+ ++index;
484
300
  }
485
-
486
- const uBuffer = quantizedVertices.subarray(0, quantizedVertexCount);
487
- const vBuffer = quantizedVertices.subarray(
488
- quantizedVertexCount,
489
- 2 * quantizedVertexCount
301
+ ++index;
302
+ }
303
+ }
304
+ function addSkirtIndices(edgeIndices, vertexIndex, indices, offset) {
305
+ let previousIndex = edgeIndices[0];
306
+ const length = edgeIndices.length;
307
+ for (let i = 1; i < length; ++i) {
308
+ const index = edgeIndices[i];
309
+ indices[offset++] = previousIndex;
310
+ indices[offset++] = index;
311
+ indices[offset++] = vertexIndex;
312
+ indices[offset++] = vertexIndex;
313
+ indices[offset++] = index;
314
+ indices[offset++] = vertexIndex + 1;
315
+ previousIndex = index;
316
+ ++vertexIndex;
317
+ }
318
+ return offset;
319
+ }
320
+ TerrainProvider.heightmapTerrainQuality = 0.25;
321
+ TerrainProvider.getEstimatedLevelZeroGeometricErrorForAHeightmap = function(ellipsoid, tileImageWidth, numberOfTilesAtLevelZero) {
322
+ return ellipsoid.maximumRadius * 2 * Math.PI * TerrainProvider.heightmapTerrainQuality / (tileImageWidth * numberOfTilesAtLevelZero);
323
+ };
324
+ TerrainProvider.prototype.requestTileGeometry = DeveloperError_default.throwInstantiationError;
325
+ TerrainProvider.prototype.getLevelMaximumGeometricError = DeveloperError_default.throwInstantiationError;
326
+ TerrainProvider.prototype.getTileDataAvailable = DeveloperError_default.throwInstantiationError;
327
+ TerrainProvider.prototype.loadTileDataAvailability = DeveloperError_default.throwInstantiationError;
328
+ var TerrainProvider_default = TerrainProvider;
329
+
330
+ // packages/engine/Source/Workers/createVerticesFromQuantizedTerrainMesh.js
331
+ var maxShort = 32767;
332
+ var cartesian3Scratch = new Cartesian3_default();
333
+ var scratchMinimum = new Cartesian3_default();
334
+ var scratchMaximum = new Cartesian3_default();
335
+ var cartographicScratch = new Cartographic_default();
336
+ var toPack = new Cartesian2_default();
337
+ function createVerticesFromQuantizedTerrainMesh(parameters, transferableObjects) {
338
+ const quantizedVertices = parameters.quantizedVertices;
339
+ const quantizedVertexCount = quantizedVertices.length / 3;
340
+ const octEncodedNormals = parameters.octEncodedNormals;
341
+ const edgeVertexCount = parameters.westIndices.length + parameters.eastIndices.length + parameters.southIndices.length + parameters.northIndices.length;
342
+ const includeWebMercatorT = parameters.includeWebMercatorT;
343
+ const exaggeration = parameters.exaggeration;
344
+ const exaggerationRelativeHeight = parameters.exaggerationRelativeHeight;
345
+ const hasExaggeration = exaggeration !== 1;
346
+ const includeGeodeticSurfaceNormals = hasExaggeration;
347
+ const rectangle = Rectangle_default.clone(parameters.rectangle);
348
+ const west = rectangle.west;
349
+ const south = rectangle.south;
350
+ const east = rectangle.east;
351
+ const north = rectangle.north;
352
+ const ellipsoid = Ellipsoid_default.clone(parameters.ellipsoid);
353
+ const minimumHeight = parameters.minimumHeight;
354
+ const maximumHeight = parameters.maximumHeight;
355
+ const center = parameters.relativeToCenter;
356
+ const fromENU = Transforms_default.eastNorthUpToFixedFrame(center, ellipsoid);
357
+ const toENU = Matrix4_default.inverseTransformation(fromENU, new Matrix4_default());
358
+ let southMercatorY;
359
+ let oneOverMercatorHeight;
360
+ if (includeWebMercatorT) {
361
+ southMercatorY = WebMercatorProjection_default.geodeticLatitudeToMercatorAngle(
362
+ south
490
363
  );
491
- const heightBuffer = quantizedVertices.subarray(
492
- quantizedVertexCount * 2,
493
- 3 * quantizedVertexCount
364
+ oneOverMercatorHeight = 1 / (WebMercatorProjection_default.geodeticLatitudeToMercatorAngle(north) - southMercatorY);
365
+ }
366
+ const uBuffer = quantizedVertices.subarray(0, quantizedVertexCount);
367
+ const vBuffer = quantizedVertices.subarray(
368
+ quantizedVertexCount,
369
+ 2 * quantizedVertexCount
370
+ );
371
+ const heightBuffer = quantizedVertices.subarray(
372
+ quantizedVertexCount * 2,
373
+ 3 * quantizedVertexCount
374
+ );
375
+ const hasVertexNormals = defined_default(octEncodedNormals);
376
+ const uvs = new Array(quantizedVertexCount);
377
+ const heights = new Array(quantizedVertexCount);
378
+ const positions = new Array(quantizedVertexCount);
379
+ const webMercatorTs = includeWebMercatorT ? new Array(quantizedVertexCount) : [];
380
+ const geodeticSurfaceNormals = includeGeodeticSurfaceNormals ? new Array(quantizedVertexCount) : [];
381
+ const minimum = scratchMinimum;
382
+ minimum.x = Number.POSITIVE_INFINITY;
383
+ minimum.y = Number.POSITIVE_INFINITY;
384
+ minimum.z = Number.POSITIVE_INFINITY;
385
+ const maximum = scratchMaximum;
386
+ maximum.x = Number.NEGATIVE_INFINITY;
387
+ maximum.y = Number.NEGATIVE_INFINITY;
388
+ maximum.z = Number.NEGATIVE_INFINITY;
389
+ let minLongitude = Number.POSITIVE_INFINITY;
390
+ let maxLongitude = Number.NEGATIVE_INFINITY;
391
+ let minLatitude = Number.POSITIVE_INFINITY;
392
+ let maxLatitude = Number.NEGATIVE_INFINITY;
393
+ for (let i = 0; i < quantizedVertexCount; ++i) {
394
+ const rawU = uBuffer[i];
395
+ const rawV = vBuffer[i];
396
+ const u = rawU / maxShort;
397
+ const v = rawV / maxShort;
398
+ const height = Math_default.lerp(
399
+ minimumHeight,
400
+ maximumHeight,
401
+ heightBuffer[i] / maxShort
494
402
  );
495
- const hasVertexNormals = defaultValue.defined(octEncodedNormals);
496
-
497
- const uvs = new Array(quantizedVertexCount);
498
- const heights = new Array(quantizedVertexCount);
499
- const positions = new Array(quantizedVertexCount);
500
- const webMercatorTs = includeWebMercatorT
501
- ? new Array(quantizedVertexCount)
502
- : [];
503
- const geodeticSurfaceNormals = includeGeodeticSurfaceNormals
504
- ? new Array(quantizedVertexCount)
505
- : [];
506
-
507
- const minimum = scratchMinimum;
508
- minimum.x = Number.POSITIVE_INFINITY;
509
- minimum.y = Number.POSITIVE_INFINITY;
510
- minimum.z = Number.POSITIVE_INFINITY;
511
-
512
- const maximum = scratchMaximum;
513
- maximum.x = Number.NEGATIVE_INFINITY;
514
- maximum.y = Number.NEGATIVE_INFINITY;
515
- maximum.z = Number.NEGATIVE_INFINITY;
516
-
517
- let minLongitude = Number.POSITIVE_INFINITY;
518
- let maxLongitude = Number.NEGATIVE_INFINITY;
519
- let minLatitude = Number.POSITIVE_INFINITY;
520
- let maxLatitude = Number.NEGATIVE_INFINITY;
521
-
522
- for (let i = 0; i < quantizedVertexCount; ++i) {
523
- const rawU = uBuffer[i];
524
- const rawV = vBuffer[i];
525
-
526
- const u = rawU / maxShort;
527
- const v = rawV / maxShort;
528
- const height = Math$1.CesiumMath.lerp(
529
- minimumHeight,
530
- maximumHeight,
531
- heightBuffer[i] / maxShort
532
- );
533
-
534
- cartographicScratch.longitude = Math$1.CesiumMath.lerp(west, east, u);
535
- cartographicScratch.latitude = Math$1.CesiumMath.lerp(south, north, v);
536
- cartographicScratch.height = height;
537
-
538
- minLongitude = Math.min(cartographicScratch.longitude, minLongitude);
539
- maxLongitude = Math.max(cartographicScratch.longitude, maxLongitude);
540
- minLatitude = Math.min(cartographicScratch.latitude, minLatitude);
541
- maxLatitude = Math.max(cartographicScratch.latitude, maxLatitude);
542
-
543
- const position = ellipsoid.cartographicToCartesian(cartographicScratch);
544
-
545
- uvs[i] = new Matrix2.Cartesian2(u, v);
546
- heights[i] = height;
547
- positions[i] = position;
548
-
549
- if (includeWebMercatorT) {
550
- webMercatorTs[i] =
551
- (WebMercatorProjection.WebMercatorProjection.geodeticLatitudeToMercatorAngle(
552
- cartographicScratch.latitude
553
- ) -
554
- southMercatorY) *
555
- oneOverMercatorHeight;
556
- }
557
-
558
- if (includeGeodeticSurfaceNormals) {
559
- geodeticSurfaceNormals[i] = ellipsoid.geodeticSurfaceNormal(position);
560
- }
561
-
562
- Matrix2.Matrix4.multiplyByPoint(toENU, position, cartesian3Scratch);
563
-
564
- Matrix3.Cartesian3.minimumByComponent(cartesian3Scratch, minimum, minimum);
565
- Matrix3.Cartesian3.maximumByComponent(cartesian3Scratch, maximum, maximum);
403
+ cartographicScratch.longitude = Math_default.lerp(west, east, u);
404
+ cartographicScratch.latitude = Math_default.lerp(south, north, v);
405
+ cartographicScratch.height = height;
406
+ minLongitude = Math.min(cartographicScratch.longitude, minLongitude);
407
+ maxLongitude = Math.max(cartographicScratch.longitude, maxLongitude);
408
+ minLatitude = Math.min(cartographicScratch.latitude, minLatitude);
409
+ maxLatitude = Math.max(cartographicScratch.latitude, maxLatitude);
410
+ const position = ellipsoid.cartographicToCartesian(cartographicScratch);
411
+ uvs[i] = new Cartesian2_default(u, v);
412
+ heights[i] = height;
413
+ positions[i] = position;
414
+ if (includeWebMercatorT) {
415
+ webMercatorTs[i] = (WebMercatorProjection_default.geodeticLatitudeToMercatorAngle(
416
+ cartographicScratch.latitude
417
+ ) - southMercatorY) * oneOverMercatorHeight;
566
418
  }
567
-
568
- const westIndicesSouthToNorth = copyAndSort(parameters.westIndices, function (
569
- a,
570
- b
571
- ) {
572
- return uvs[a].y - uvs[b].y;
573
- });
574
- const eastIndicesNorthToSouth = copyAndSort(parameters.eastIndices, function (
575
- a,
576
- b
577
- ) {
578
- return uvs[b].y - uvs[a].y;
579
- });
580
- const southIndicesEastToWest = copyAndSort(parameters.southIndices, function (
581
- a,
582
- b
583
- ) {
584
- return uvs[b].x - uvs[a].x;
585
- });
586
- const northIndicesWestToEast = copyAndSort(parameters.northIndices, function (
587
- a,
588
- b
589
- ) {
590
- return uvs[a].x - uvs[b].x;
591
- });
592
-
593
- let occludeePointInScaledSpace;
594
- if (minimumHeight < 0.0) {
595
- // Horizon culling point needs to be recomputed since the tile is at least partly under the ellipsoid.
596
- const occluder = new TerrainEncoding.EllipsoidalOccluder(ellipsoid);
597
- occludeePointInScaledSpace = occluder.computeHorizonCullingPointPossiblyUnderEllipsoid(
598
- center,
599
- positions,
600
- minimumHeight
601
- );
419
+ if (includeGeodeticSurfaceNormals) {
420
+ geodeticSurfaceNormals[i] = ellipsoid.geodeticSurfaceNormal(position);
602
421
  }
603
-
604
- let hMin = minimumHeight;
605
- hMin = Math.min(
606
- hMin,
607
- findMinMaxSkirts(
608
- parameters.westIndices,
609
- parameters.westSkirtHeight,
610
- heights,
611
- uvs,
612
- rectangle,
613
- ellipsoid,
614
- toENU,
615
- minimum,
616
- maximum
617
- )
618
- );
619
- hMin = Math.min(
620
- hMin,
621
- findMinMaxSkirts(
622
- parameters.southIndices,
623
- parameters.southSkirtHeight,
624
- heights,
625
- uvs,
626
- rectangle,
627
- ellipsoid,
628
- toENU,
629
- minimum,
630
- maximum
631
- )
632
- );
633
- hMin = Math.min(
634
- hMin,
635
- findMinMaxSkirts(
636
- parameters.eastIndices,
637
- parameters.eastSkirtHeight,
638
- heights,
639
- uvs,
640
- rectangle,
641
- ellipsoid,
642
- toENU,
643
- minimum,
644
- maximum
645
- )
646
- );
647
- hMin = Math.min(
648
- hMin,
649
- findMinMaxSkirts(
650
- parameters.northIndices,
651
- parameters.northSkirtHeight,
652
- heights,
653
- uvs,
654
- rectangle,
655
- ellipsoid,
656
- toENU,
657
- minimum,
658
- maximum
659
- )
660
- );
661
-
662
- const aaBox = new AxisAlignedBoundingBox.AxisAlignedBoundingBox(minimum, maximum, center);
663
- const encoding = new TerrainEncoding.TerrainEncoding(
422
+ Matrix4_default.multiplyByPoint(toENU, position, cartesian3Scratch);
423
+ Cartesian3_default.minimumByComponent(cartesian3Scratch, minimum, minimum);
424
+ Cartesian3_default.maximumByComponent(cartesian3Scratch, maximum, maximum);
425
+ }
426
+ const westIndicesSouthToNorth = copyAndSort(parameters.westIndices, function(a, b) {
427
+ return uvs[a].y - uvs[b].y;
428
+ });
429
+ const eastIndicesNorthToSouth = copyAndSort(parameters.eastIndices, function(a, b) {
430
+ return uvs[b].y - uvs[a].y;
431
+ });
432
+ const southIndicesEastToWest = copyAndSort(parameters.southIndices, function(a, b) {
433
+ return uvs[b].x - uvs[a].x;
434
+ });
435
+ const northIndicesWestToEast = copyAndSort(parameters.northIndices, function(a, b) {
436
+ return uvs[a].x - uvs[b].x;
437
+ });
438
+ let occludeePointInScaledSpace;
439
+ if (minimumHeight < 0) {
440
+ const occluder = new EllipsoidalOccluder_default(ellipsoid);
441
+ occludeePointInScaledSpace = occluder.computeHorizonCullingPointPossiblyUnderEllipsoid(
664
442
  center,
665
- aaBox,
666
- hMin,
667
- maximumHeight,
668
- fromENU,
669
- hasVertexNormals,
670
- includeWebMercatorT,
671
- includeGeodeticSurfaceNormals,
672
- exaggeration,
673
- exaggerationRelativeHeight
443
+ positions,
444
+ minimumHeight
674
445
  );
675
- const vertexStride = encoding.stride;
676
- const size =
677
- quantizedVertexCount * vertexStride + edgeVertexCount * vertexStride;
678
- const vertexBuffer = new Float32Array(size);
679
-
680
- let bufferIndex = 0;
681
- for (let j = 0; j < quantizedVertexCount; ++j) {
682
- if (hasVertexNormals) {
683
- const n = j * 2.0;
684
- toPack.x = octEncodedNormals[n];
685
- toPack.y = octEncodedNormals[n + 1];
686
- }
687
-
688
- bufferIndex = encoding.encode(
689
- vertexBuffer,
690
- bufferIndex,
691
- positions[j],
692
- uvs[j],
693
- heights[j],
694
- toPack,
695
- webMercatorTs[j],
696
- geodeticSurfaceNormals[j]
697
- );
698
- }
699
-
700
- const edgeTriangleCount = Math.max(0, (edgeVertexCount - 4) * 2);
701
- const indexBufferLength = parameters.indices.length + edgeTriangleCount * 3;
702
- const indexBuffer = IndexDatatype.IndexDatatype.createTypedArray(
703
- quantizedVertexCount + edgeVertexCount,
704
- indexBufferLength
705
- );
706
- indexBuffer.set(parameters.indices, 0);
707
-
708
- const percentage = 0.0001;
709
- const lonOffset = (maxLongitude - minLongitude) * percentage;
710
- const latOffset = (maxLatitude - minLatitude) * percentage;
711
- const westLongitudeOffset = -lonOffset;
712
- const westLatitudeOffset = 0.0;
713
- const eastLongitudeOffset = lonOffset;
714
- const eastLatitudeOffset = 0.0;
715
- const northLongitudeOffset = 0.0;
716
- const northLatitudeOffset = latOffset;
717
- const southLongitudeOffset = 0.0;
718
- const southLatitudeOffset = -latOffset;
719
-
720
- // Add skirts.
721
- let vertexBufferIndex = quantizedVertexCount * vertexStride;
722
- addSkirt(
723
- vertexBuffer,
724
- vertexBufferIndex,
725
- westIndicesSouthToNorth,
726
- encoding,
727
- heights,
728
- uvs,
729
- octEncodedNormals,
730
- ellipsoid,
731
- rectangle,
446
+ }
447
+ let hMin = minimumHeight;
448
+ hMin = Math.min(
449
+ hMin,
450
+ findMinMaxSkirts(
451
+ parameters.westIndices,
732
452
  parameters.westSkirtHeight,
733
- southMercatorY,
734
- oneOverMercatorHeight,
735
- westLongitudeOffset,
736
- westLatitudeOffset
737
- );
738
- vertexBufferIndex += parameters.westIndices.length * vertexStride;
739
- addSkirt(
740
- vertexBuffer,
741
- vertexBufferIndex,
742
- southIndicesEastToWest,
743
- encoding,
744
453
  heights,
745
454
  uvs,
746
- octEncodedNormals,
747
- ellipsoid,
748
455
  rectangle,
456
+ ellipsoid,
457
+ toENU,
458
+ minimum,
459
+ maximum
460
+ )
461
+ );
462
+ hMin = Math.min(
463
+ hMin,
464
+ findMinMaxSkirts(
465
+ parameters.southIndices,
749
466
  parameters.southSkirtHeight,
750
- southMercatorY,
751
- oneOverMercatorHeight,
752
- southLongitudeOffset,
753
- southLatitudeOffset
754
- );
755
- vertexBufferIndex += parameters.southIndices.length * vertexStride;
756
- addSkirt(
757
- vertexBuffer,
758
- vertexBufferIndex,
759
- eastIndicesNorthToSouth,
760
- encoding,
761
467
  heights,
762
468
  uvs,
763
- octEncodedNormals,
764
- ellipsoid,
765
469
  rectangle,
470
+ ellipsoid,
471
+ toENU,
472
+ minimum,
473
+ maximum
474
+ )
475
+ );
476
+ hMin = Math.min(
477
+ hMin,
478
+ findMinMaxSkirts(
479
+ parameters.eastIndices,
766
480
  parameters.eastSkirtHeight,
767
- southMercatorY,
768
- oneOverMercatorHeight,
769
- eastLongitudeOffset,
770
- eastLatitudeOffset
771
- );
772
- vertexBufferIndex += parameters.eastIndices.length * vertexStride;
773
- addSkirt(
774
- vertexBuffer,
775
- vertexBufferIndex,
776
- northIndicesWestToEast,
777
- encoding,
778
481
  heights,
779
482
  uvs,
780
- octEncodedNormals,
781
- ellipsoid,
782
483
  rectangle,
484
+ ellipsoid,
485
+ toENU,
486
+ minimum,
487
+ maximum
488
+ )
489
+ );
490
+ hMin = Math.min(
491
+ hMin,
492
+ findMinMaxSkirts(
493
+ parameters.northIndices,
783
494
  parameters.northSkirtHeight,
784
- southMercatorY,
785
- oneOverMercatorHeight,
786
- northLongitudeOffset,
787
- northLatitudeOffset
788
- );
789
-
790
- TerrainProvider.addSkirtIndices(
791
- westIndicesSouthToNorth,
792
- southIndicesEastToWest,
793
- eastIndicesNorthToSouth,
794
- northIndicesWestToEast,
795
- quantizedVertexCount,
796
- indexBuffer,
797
- parameters.indices.length
495
+ heights,
496
+ uvs,
497
+ rectangle,
498
+ ellipsoid,
499
+ toENU,
500
+ minimum,
501
+ maximum
502
+ )
503
+ );
504
+ const aaBox = new AxisAlignedBoundingBox_default(minimum, maximum, center);
505
+ const encoding = new TerrainEncoding_default(
506
+ center,
507
+ aaBox,
508
+ hMin,
509
+ maximumHeight,
510
+ fromENU,
511
+ hasVertexNormals,
512
+ includeWebMercatorT,
513
+ includeGeodeticSurfaceNormals,
514
+ exaggeration,
515
+ exaggerationRelativeHeight
516
+ );
517
+ const vertexStride = encoding.stride;
518
+ const size = quantizedVertexCount * vertexStride + edgeVertexCount * vertexStride;
519
+ const vertexBuffer = new Float32Array(size);
520
+ let bufferIndex = 0;
521
+ for (let j = 0; j < quantizedVertexCount; ++j) {
522
+ if (hasVertexNormals) {
523
+ const n = j * 2;
524
+ toPack.x = octEncodedNormals[n];
525
+ toPack.y = octEncodedNormals[n + 1];
526
+ }
527
+ bufferIndex = encoding.encode(
528
+ vertexBuffer,
529
+ bufferIndex,
530
+ positions[j],
531
+ uvs[j],
532
+ heights[j],
533
+ toPack,
534
+ webMercatorTs[j],
535
+ geodeticSurfaceNormals[j]
798
536
  );
799
-
800
- transferableObjects.push(vertexBuffer.buffer, indexBuffer.buffer);
801
-
802
- return {
803
- vertices: vertexBuffer.buffer,
804
- indices: indexBuffer.buffer,
805
- westIndicesSouthToNorth: westIndicesSouthToNorth,
806
- southIndicesEastToWest: southIndicesEastToWest,
807
- eastIndicesNorthToSouth: eastIndicesNorthToSouth,
808
- northIndicesWestToEast: northIndicesWestToEast,
809
- vertexStride: vertexStride,
810
- center: center,
811
- minimumHeight: minimumHeight,
812
- maximumHeight: maximumHeight,
813
- occludeePointInScaledSpace: occludeePointInScaledSpace,
814
- encoding: encoding,
815
- indexCountWithoutSkirts: parameters.indices.length,
816
- };
817
537
  }
818
-
819
- function findMinMaxSkirts(
820
- edgeIndices,
821
- edgeHeight,
538
+ const edgeTriangleCount = Math.max(0, (edgeVertexCount - 4) * 2);
539
+ const indexBufferLength = parameters.indices.length + edgeTriangleCount * 3;
540
+ const indexBuffer = IndexDatatype_default.createTypedArray(
541
+ quantizedVertexCount + edgeVertexCount,
542
+ indexBufferLength
543
+ );
544
+ indexBuffer.set(parameters.indices, 0);
545
+ const percentage = 1e-4;
546
+ const lonOffset = (maxLongitude - minLongitude) * percentage;
547
+ const latOffset = (maxLatitude - minLatitude) * percentage;
548
+ const westLongitudeOffset = -lonOffset;
549
+ const westLatitudeOffset = 0;
550
+ const eastLongitudeOffset = lonOffset;
551
+ const eastLatitudeOffset = 0;
552
+ const northLongitudeOffset = 0;
553
+ const northLatitudeOffset = latOffset;
554
+ const southLongitudeOffset = 0;
555
+ const southLatitudeOffset = -latOffset;
556
+ let vertexBufferIndex = quantizedVertexCount * vertexStride;
557
+ addSkirt(
558
+ vertexBuffer,
559
+ vertexBufferIndex,
560
+ westIndicesSouthToNorth,
561
+ encoding,
822
562
  heights,
823
563
  uvs,
564
+ octEncodedNormals,
565
+ ellipsoid,
824
566
  rectangle,
567
+ parameters.westSkirtHeight,
568
+ southMercatorY,
569
+ oneOverMercatorHeight,
570
+ westLongitudeOffset,
571
+ westLatitudeOffset
572
+ );
573
+ vertexBufferIndex += parameters.westIndices.length * vertexStride;
574
+ addSkirt(
575
+ vertexBuffer,
576
+ vertexBufferIndex,
577
+ southIndicesEastToWest,
578
+ encoding,
579
+ heights,
580
+ uvs,
581
+ octEncodedNormals,
825
582
  ellipsoid,
826
- toENU,
827
- minimum,
828
- maximum
829
- ) {
830
- let hMin = Number.POSITIVE_INFINITY;
831
-
832
- const north = rectangle.north;
833
- const south = rectangle.south;
834
- let east = rectangle.east;
835
- const west = rectangle.west;
836
-
837
- if (east < west) {
838
- east += Math$1.CesiumMath.TWO_PI;
839
- }
840
-
841
- const length = edgeIndices.length;
842
- for (let i = 0; i < length; ++i) {
843
- const index = edgeIndices[i];
844
- const h = heights[index];
845
- const uv = uvs[index];
846
-
847
- cartographicScratch.longitude = Math$1.CesiumMath.lerp(west, east, uv.x);
848
- cartographicScratch.latitude = Math$1.CesiumMath.lerp(south, north, uv.y);
849
- cartographicScratch.height = h - edgeHeight;
850
-
851
- const position = ellipsoid.cartographicToCartesian(
852
- cartographicScratch,
853
- cartesian3Scratch
854
- );
855
- Matrix2.Matrix4.multiplyByPoint(toENU, position, position);
856
-
857
- Matrix3.Cartesian3.minimumByComponent(position, minimum, minimum);
858
- Matrix3.Cartesian3.maximumByComponent(position, maximum, maximum);
859
-
860
- hMin = Math.min(hMin, cartographicScratch.height);
861
- }
862
- return hMin;
863
- }
864
-
865
- function addSkirt(
583
+ rectangle,
584
+ parameters.southSkirtHeight,
585
+ southMercatorY,
586
+ oneOverMercatorHeight,
587
+ southLongitudeOffset,
588
+ southLatitudeOffset
589
+ );
590
+ vertexBufferIndex += parameters.southIndices.length * vertexStride;
591
+ addSkirt(
866
592
  vertexBuffer,
867
593
  vertexBufferIndex,
868
- edgeVertices,
594
+ eastIndicesNorthToSouth,
869
595
  encoding,
870
596
  heights,
871
597
  uvs,
872
598
  octEncodedNormals,
873
599
  ellipsoid,
874
600
  rectangle,
875
- skirtLength,
601
+ parameters.eastSkirtHeight,
876
602
  southMercatorY,
877
603
  oneOverMercatorHeight,
878
- longitudeOffset,
879
- latitudeOffset
880
- ) {
881
- const hasVertexNormals = defaultValue.defined(octEncodedNormals);
882
-
883
- const north = rectangle.north;
884
- const south = rectangle.south;
885
- let east = rectangle.east;
886
- const west = rectangle.west;
887
-
888
- if (east < west) {
889
- east += Math$1.CesiumMath.TWO_PI;
604
+ eastLongitudeOffset,
605
+ eastLatitudeOffset
606
+ );
607
+ vertexBufferIndex += parameters.eastIndices.length * vertexStride;
608
+ addSkirt(
609
+ vertexBuffer,
610
+ vertexBufferIndex,
611
+ northIndicesWestToEast,
612
+ encoding,
613
+ heights,
614
+ uvs,
615
+ octEncodedNormals,
616
+ ellipsoid,
617
+ rectangle,
618
+ parameters.northSkirtHeight,
619
+ southMercatorY,
620
+ oneOverMercatorHeight,
621
+ northLongitudeOffset,
622
+ northLatitudeOffset
623
+ );
624
+ TerrainProvider_default.addSkirtIndices(
625
+ westIndicesSouthToNorth,
626
+ southIndicesEastToWest,
627
+ eastIndicesNorthToSouth,
628
+ northIndicesWestToEast,
629
+ quantizedVertexCount,
630
+ indexBuffer,
631
+ parameters.indices.length
632
+ );
633
+ transferableObjects.push(vertexBuffer.buffer, indexBuffer.buffer);
634
+ return {
635
+ vertices: vertexBuffer.buffer,
636
+ indices: indexBuffer.buffer,
637
+ westIndicesSouthToNorth,
638
+ southIndicesEastToWest,
639
+ eastIndicesNorthToSouth,
640
+ northIndicesWestToEast,
641
+ vertexStride,
642
+ center,
643
+ minimumHeight,
644
+ maximumHeight,
645
+ occludeePointInScaledSpace,
646
+ encoding,
647
+ indexCountWithoutSkirts: parameters.indices.length
648
+ };
649
+ }
650
+ function findMinMaxSkirts(edgeIndices, edgeHeight, heights, uvs, rectangle, ellipsoid, toENU, minimum, maximum) {
651
+ let hMin = Number.POSITIVE_INFINITY;
652
+ const north = rectangle.north;
653
+ const south = rectangle.south;
654
+ let east = rectangle.east;
655
+ const west = rectangle.west;
656
+ if (east < west) {
657
+ east += Math_default.TWO_PI;
658
+ }
659
+ const length = edgeIndices.length;
660
+ for (let i = 0; i < length; ++i) {
661
+ const index = edgeIndices[i];
662
+ const h = heights[index];
663
+ const uv = uvs[index];
664
+ cartographicScratch.longitude = Math_default.lerp(west, east, uv.x);
665
+ cartographicScratch.latitude = Math_default.lerp(south, north, uv.y);
666
+ cartographicScratch.height = h - edgeHeight;
667
+ const position = ellipsoid.cartographicToCartesian(
668
+ cartographicScratch,
669
+ cartesian3Scratch
670
+ );
671
+ Matrix4_default.multiplyByPoint(toENU, position, position);
672
+ Cartesian3_default.minimumByComponent(position, minimum, minimum);
673
+ Cartesian3_default.maximumByComponent(position, maximum, maximum);
674
+ hMin = Math.min(hMin, cartographicScratch.height);
675
+ }
676
+ return hMin;
677
+ }
678
+ function addSkirt(vertexBuffer, vertexBufferIndex, edgeVertices, encoding, heights, uvs, octEncodedNormals, ellipsoid, rectangle, skirtLength, southMercatorY, oneOverMercatorHeight, longitudeOffset, latitudeOffset) {
679
+ const hasVertexNormals = defined_default(octEncodedNormals);
680
+ const north = rectangle.north;
681
+ const south = rectangle.south;
682
+ let east = rectangle.east;
683
+ const west = rectangle.west;
684
+ if (east < west) {
685
+ east += Math_default.TWO_PI;
686
+ }
687
+ const length = edgeVertices.length;
688
+ for (let i = 0; i < length; ++i) {
689
+ const index = edgeVertices[i];
690
+ const h = heights[index];
691
+ const uv = uvs[index];
692
+ cartographicScratch.longitude = Math_default.lerp(west, east, uv.x) + longitudeOffset;
693
+ cartographicScratch.latitude = Math_default.lerp(south, north, uv.y) + latitudeOffset;
694
+ cartographicScratch.height = h - skirtLength;
695
+ const position = ellipsoid.cartographicToCartesian(
696
+ cartographicScratch,
697
+ cartesian3Scratch
698
+ );
699
+ if (hasVertexNormals) {
700
+ const n = index * 2;
701
+ toPack.x = octEncodedNormals[n];
702
+ toPack.y = octEncodedNormals[n + 1];
890
703
  }
891
-
892
- const length = edgeVertices.length;
893
- for (let i = 0; i < length; ++i) {
894
- const index = edgeVertices[i];
895
- const h = heights[index];
896
- const uv = uvs[index];
897
-
898
- cartographicScratch.longitude =
899
- Math$1.CesiumMath.lerp(west, east, uv.x) + longitudeOffset;
900
- cartographicScratch.latitude =
901
- Math$1.CesiumMath.lerp(south, north, uv.y) + latitudeOffset;
902
- cartographicScratch.height = h - skirtLength;
903
-
904
- const position = ellipsoid.cartographicToCartesian(
905
- cartographicScratch,
906
- cartesian3Scratch
907
- );
908
-
909
- if (hasVertexNormals) {
910
- const n = index * 2.0;
911
- toPack.x = octEncodedNormals[n];
912
- toPack.y = octEncodedNormals[n + 1];
913
- }
914
-
915
- let webMercatorT;
916
- if (encoding.hasWebMercatorT) {
917
- webMercatorT =
918
- (WebMercatorProjection.WebMercatorProjection.geodeticLatitudeToMercatorAngle(
919
- cartographicScratch.latitude
920
- ) -
921
- southMercatorY) *
922
- oneOverMercatorHeight;
923
- }
924
-
925
- let geodeticSurfaceNormal;
926
- if (encoding.hasGeodeticSurfaceNormals) {
927
- geodeticSurfaceNormal = ellipsoid.geodeticSurfaceNormal(position);
928
- }
929
-
930
- vertexBufferIndex = encoding.encode(
931
- vertexBuffer,
932
- vertexBufferIndex,
933
- position,
934
- uv,
935
- cartographicScratch.height,
936
- toPack,
937
- webMercatorT,
938
- geodeticSurfaceNormal
939
- );
704
+ let webMercatorT;
705
+ if (encoding.hasWebMercatorT) {
706
+ webMercatorT = (WebMercatorProjection_default.geodeticLatitudeToMercatorAngle(
707
+ cartographicScratch.latitude
708
+ ) - southMercatorY) * oneOverMercatorHeight;
940
709
  }
941
- }
942
-
943
- function copyAndSort(typedArray, comparator) {
944
- let copy;
945
- if (typeof typedArray.slice === "function") {
946
- copy = typedArray.slice();
947
- if (typeof copy.sort !== "function") {
948
- // Sliced typed array isn't sortable, so we can't use it.
949
- copy = undefined;
950
- }
710
+ let geodeticSurfaceNormal;
711
+ if (encoding.hasGeodeticSurfaceNormals) {
712
+ geodeticSurfaceNormal = ellipsoid.geodeticSurfaceNormal(position);
951
713
  }
952
-
953
- if (!defaultValue.defined(copy)) {
954
- copy = Array.prototype.slice.call(typedArray);
714
+ vertexBufferIndex = encoding.encode(
715
+ vertexBuffer,
716
+ vertexBufferIndex,
717
+ position,
718
+ uv,
719
+ cartographicScratch.height,
720
+ toPack,
721
+ webMercatorT,
722
+ geodeticSurfaceNormal
723
+ );
724
+ }
725
+ }
726
+ function copyAndSort(typedArray, comparator) {
727
+ let copy;
728
+ if (typeof typedArray.slice === "function") {
729
+ copy = typedArray.slice();
730
+ if (typeof copy.sort !== "function") {
731
+ copy = void 0;
955
732
  }
956
-
957
- copy.sort(comparator);
958
-
959
- return copy;
960
733
  }
961
- var createVerticesFromQuantizedTerrainMesh$1 = createTaskProcessorWorker(
962
- createVerticesFromQuantizedTerrainMesh
963
- );
964
-
965
- return createVerticesFromQuantizedTerrainMesh$1;
966
-
967
- }));
734
+ if (!defined_default(copy)) {
735
+ copy = Array.prototype.slice.call(typedArray);
736
+ }
737
+ copy.sort(comparator);
738
+ return copy;
739
+ }
740
+ var createVerticesFromQuantizedTerrainMesh_default = createTaskProcessorWorker_default(
741
+ createVerticesFromQuantizedTerrainMesh
742
+ );
743
+ export {
744
+ createVerticesFromQuantizedTerrainMesh_default as default
745
+ };