@gmgis/gm-sdk 1.12.5 → 2.0.2

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 (159) hide show
  1. package/dist/dist/index.js +1848 -0
  2. package/dist/gm.min.js +16983 -16483
  3. package/dist/index.js +1436 -1434
  4. package/dist/resources/ThirdParty/Workers/pako_deflate.min.js +1 -2
  5. package/dist/resources/ThirdParty/Workers/pako_inflate.min.js +1 -2
  6. package/dist/resources/ThirdParty/Workers/z-worker-pako.js +1 -1
  7. package/dist/resources/ThirdParty/google-earth-dbroot-parser.js +1 -8337
  8. package/dist/resources/ThirdParty/wasm_splats_bg.wasm +0 -0
  9. package/dist/resources/Workers/chunk-35SHYARM.js +26 -0
  10. package/dist/resources/Workers/chunk-37F5JSTI.js +26 -0
  11. package/dist/resources/Workers/chunk-3SSKC3VN.js +26 -0
  12. package/dist/resources/Workers/chunk-3W4GT7KQ.js +26 -0
  13. package/dist/resources/Workers/chunk-4IW2T6GF.js +26 -0
  14. package/dist/resources/Workers/chunk-5YEWO3HT.js +26 -0
  15. package/dist/resources/Workers/chunk-64RSHJUE.js +28 -0
  16. package/dist/resources/Workers/chunk-77IHZJJ3.js +26 -0
  17. package/dist/resources/Workers/chunk-7HTKERZY.js +26 -0
  18. package/dist/resources/Workers/{chunk-I2ITFFPX.js → chunk-A56XVLQR.js} +2 -13
  19. package/dist/resources/Workers/chunk-AJYK4IVJ.js +26 -0
  20. package/dist/resources/Workers/{chunk-PRGYLLJT.js → chunk-ARG42DC4.js} +2 -31
  21. package/dist/resources/Workers/chunk-AU7IKHOH.js +26 -0
  22. package/dist/resources/Workers/chunk-B4AA3ARO.js +26 -0
  23. package/dist/resources/Workers/chunk-CNCV5UL7.js +26 -0
  24. package/dist/resources/Workers/chunk-CYCB63OH.js +26 -0
  25. package/dist/resources/Workers/{chunk-DI5NGJUP.js → chunk-D6AA5QVT.js} +2 -20
  26. package/dist/resources/Workers/chunk-D6C66QON.js +26 -0
  27. package/dist/resources/Workers/chunk-DEPHB2WM.js +26 -0
  28. package/dist/resources/Workers/chunk-DMEY62ID.js +26 -0
  29. package/dist/resources/Workers/chunk-DQQ63PYM.js +26 -0
  30. package/dist/resources/Workers/chunk-ED5JPB3S.js +27 -0
  31. package/dist/resources/Workers/chunk-EZUYS2JF.js +26 -0
  32. package/dist/resources/Workers/chunk-FEVXJ54I.js +26 -0
  33. package/dist/resources/Workers/chunk-G5AGHVVC.js +26 -0
  34. package/dist/resources/Workers/{chunk-7JO7GPJN.js → chunk-GBYLG25F.js} +2 -15
  35. package/dist/resources/Workers/chunk-GILIDQNQ.js +26 -0
  36. package/dist/resources/Workers/chunk-HMIYSTF6.js +26 -0
  37. package/dist/resources/Workers/chunk-HTFSEEMT.js +26 -0
  38. package/dist/resources/Workers/chunk-HWXX4CWK.js +26 -0
  39. package/dist/resources/Workers/chunk-IYTZ52EY.js +26 -0
  40. package/dist/resources/Workers/chunk-J6UP6FLE.js +26 -0
  41. package/dist/resources/Workers/chunk-LEYMRMBK.js +27 -0
  42. package/dist/resources/Workers/chunk-M3MGYQSL.js +26 -0
  43. package/dist/resources/Workers/chunk-N4VJKXZS.js +26 -0
  44. package/dist/resources/Workers/chunk-NB3ML6JO.js +26 -0
  45. package/dist/resources/Workers/chunk-OFUUQVMR.js +26 -0
  46. package/dist/resources/Workers/chunk-OSW76XDF.js +26 -0
  47. package/dist/resources/Workers/chunk-PSPPBZWI.js +66 -0
  48. package/dist/resources/Workers/chunk-QN3VOORQ.js +26 -0
  49. package/dist/resources/Workers/chunk-QOUAJ6TL.js +26 -0
  50. package/dist/resources/Workers/chunk-RCV6KWXS.js +26 -0
  51. package/dist/resources/Workers/chunk-TCGIRNHN.js +26 -0
  52. package/dist/resources/Workers/chunk-U4IEOH5K.js +26 -0
  53. package/dist/resources/Workers/chunk-UP6I5URU.js +26 -0
  54. package/dist/resources/Workers/chunk-VTAIKJXX.js +26 -0
  55. package/dist/resources/Workers/chunk-VTBDSFTG.js +26 -0
  56. package/dist/resources/Workers/chunk-VW6VD53G.js +26 -0
  57. package/dist/resources/Workers/chunk-WGGIH7QW.js +26 -0
  58. package/dist/resources/Workers/chunk-WWA5PL4H.js +26 -0
  59. package/dist/resources/Workers/{chunk-6CHGCNMW.js → chunk-WZDE3RYP.js} +4 -34
  60. package/dist/resources/Workers/chunk-XRL4AVS5.js +26 -0
  61. package/dist/resources/Workers/combineGeometry.js +2 -40
  62. package/dist/resources/Workers/createBoxGeometry.js +2 -32
  63. package/dist/resources/Workers/createBoxOutlineGeometry.js +2 -209
  64. package/dist/resources/Workers/createCircleGeometry.js +2 -175
  65. package/dist/resources/Workers/createCircleOutlineGeometry.js +2 -121
  66. package/dist/resources/Workers/createCoplanarPolygonGeometry.js +2 -481
  67. package/dist/resources/Workers/createCoplanarPolygonOutlineGeometry.js +2 -199
  68. package/dist/resources/Workers/createCorridorGeometry.js +2 -1237
  69. package/dist/resources/Workers/createCorridorOutlineGeometry.js +2 -542
  70. package/dist/resources/Workers/createCylinderGeometry.js +2 -34
  71. package/dist/resources/Workers/createCylinderOutlineGeometry.js +2 -205
  72. package/dist/resources/Workers/createEllipseGeometry.js +2 -45
  73. package/dist/resources/Workers/createEllipseOutlineGeometry.js +2 -38
  74. package/dist/resources/Workers/createEllipsoidGeometry.js +2 -33
  75. package/dist/resources/Workers/createEllipsoidOutlineGeometry.js +2 -35
  76. package/dist/resources/Workers/createFrustumGeometry.js +2 -32
  77. package/dist/resources/Workers/createFrustumOutlineGeometry.js +2 -210
  78. package/dist/resources/Workers/createGeometry.js +2 -144
  79. package/dist/resources/Workers/createGroundPolylineGeometry.js +2 -1582
  80. package/dist/resources/Workers/createPlaneGeometry.js +2 -198
  81. package/dist/resources/Workers/createPlaneOutlineGeometry.js +2 -98
  82. package/dist/resources/Workers/createPolygonGeometry.js +2 -1381
  83. package/dist/resources/Workers/createPolygonOutlineGeometry.js +2 -509
  84. package/dist/resources/Workers/createPolylineGeometry.js +2 -470
  85. package/dist/resources/Workers/createPolylineVolumeGeometry.js +2 -354
  86. package/dist/resources/Workers/createPolylineVolumeOutlineGeometry.js +2 -251
  87. package/dist/resources/Workers/createRectangleGeometry.js +2 -1246
  88. package/dist/resources/Workers/createRectangleOutlineGeometry.js +2 -453
  89. package/dist/resources/Workers/createSimplePolylineGeometry.js +2 -374
  90. package/dist/resources/Workers/createSphereGeometry.js +2 -92
  91. package/dist/resources/Workers/createSphereOutlineGeometry.js +2 -92
  92. package/dist/resources/Workers/createTaskProcessorWorker.js +2 -8
  93. package/dist/resources/Workers/createVectorTileClampedPolylines.js +2 -466
  94. package/dist/resources/Workers/createVectorTileGeometries.js +2 -361
  95. package/dist/resources/Workers/createVectorTilePoints.js +2 -88
  96. package/dist/resources/Workers/createVectorTilePolygons.js +2 -359
  97. package/dist/resources/Workers/createVectorTilePolylines.js +2 -236
  98. package/dist/resources/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +2 -539
  99. package/dist/resources/Workers/createVerticesFromHeightmap.js +2 -2252
  100. package/dist/resources/Workers/createVerticesFromQuantizedTerrainMesh.js +2 -729
  101. package/dist/resources/Workers/createWallGeometry.js +2 -464
  102. package/dist/resources/Workers/createWallOutlineGeometry.js +2 -312
  103. package/dist/resources/Workers/decodeDraco.js +2 -345
  104. package/dist/resources/Workers/decodeGoogleEarthEnterprisePacket.js +2 -2642
  105. package/dist/resources/Workers/decodeI3S.js +2 -1319
  106. package/dist/resources/Workers/gaussianSplatSorter.js +26 -0
  107. package/dist/resources/Workers/gaussianSplatTextureGenerator.js +26 -0
  108. package/dist/resources/Workers/transcodeKTX2.js +29 -3360
  109. package/dist/resources/Workers/transferTypedArrayTest.js +2 -17
  110. package/dist/resources/Workers/upsampleQuantizedTerrainMesh.js +2 -793
  111. package/package.json +74 -74
  112. package/dist/resources/ThirdParty/Workers/basis_transcoder.js +0 -21
  113. package/dist/resources/Workers/chunk-26GA3JAM.js +0 -139
  114. package/dist/resources/Workers/chunk-27HUZ7SA.js +0 -305
  115. package/dist/resources/Workers/chunk-2ZGOQXYU.js +0 -171
  116. package/dist/resources/Workers/chunk-3Q2L65QU.js +0 -1258
  117. package/dist/resources/Workers/chunk-472HQ3EH.js +0 -100
  118. package/dist/resources/Workers/chunk-5ODQSF26.js +0 -101
  119. package/dist/resources/Workers/chunk-5OOFQLKF.js +0 -634
  120. package/dist/resources/Workers/chunk-5PTXS2GO.js +0 -10390
  121. package/dist/resources/Workers/chunk-76BYBWHP.js +0 -122
  122. package/dist/resources/Workers/chunk-7BMOHCPM.js +0 -390
  123. package/dist/resources/Workers/chunk-7KTQP4VB.js +0 -59
  124. package/dist/resources/Workers/chunk-7O373FFS.js +0 -665
  125. package/dist/resources/Workers/chunk-AD63PIY6.js +0 -163
  126. package/dist/resources/Workers/chunk-BHQJ2NT7.js +0 -353
  127. package/dist/resources/Workers/chunk-C6YYBQXW.js +0 -102
  128. package/dist/resources/Workers/chunk-CKY7HOHV.js +0 -287
  129. package/dist/resources/Workers/chunk-DHYHSFFJ.js +0 -73
  130. package/dist/resources/Workers/chunk-E27BLMDD.js +0 -115
  131. package/dist/resources/Workers/chunk-E63IIM5T.js +0 -75
  132. package/dist/resources/Workers/chunk-E6V6SQZW.js +0 -456
  133. package/dist/resources/Workers/chunk-EJZTDTUH.js +0 -138
  134. package/dist/resources/Workers/chunk-FDOV2LBJ.js +0 -220
  135. package/dist/resources/Workers/chunk-FIGIZHAQ.js +0 -684
  136. package/dist/resources/Workers/chunk-GESF4OXQ.js +0 -1800
  137. package/dist/resources/Workers/chunk-GGZJN2TI.js +0 -2717
  138. package/dist/resources/Workers/chunk-GNBFYG7F.js +0 -1481
  139. package/dist/resources/Workers/chunk-GWCFU2SA.js +0 -300
  140. package/dist/resources/Workers/chunk-IBLIYJZR.js +0 -196
  141. package/dist/resources/Workers/chunk-JW4FOI6M.js +0 -476
  142. package/dist/resources/Workers/chunk-K4GQUNB5.js +0 -262
  143. package/dist/resources/Workers/chunk-M3GMB5OP.js +0 -834
  144. package/dist/resources/Workers/chunk-MXIZJAPH.js +0 -629
  145. package/dist/resources/Workers/chunk-N5KJGGCM.js +0 -1073
  146. package/dist/resources/Workers/chunk-NGPPMXRM.js +0 -435
  147. package/dist/resources/Workers/chunk-O3E4OAOE.js +0 -511
  148. package/dist/resources/Workers/chunk-PGRPDNHG.js +0 -1048
  149. package/dist/resources/Workers/chunk-S6MRMMQU.js +0 -157
  150. package/dist/resources/Workers/chunk-SMDOP47J.js +0 -945
  151. package/dist/resources/Workers/chunk-TGONEMZO.js +0 -421
  152. package/dist/resources/Workers/chunk-TKVT5GQM.js +0 -781
  153. package/dist/resources/Workers/chunk-U72QNFOJ.js +0 -758
  154. package/dist/resources/Workers/chunk-VJZB3WAV.js +0 -963
  155. package/dist/resources/Workers/chunk-VU2MNO7L.js +0 -239
  156. package/dist/resources/Workers/chunk-XY4BATBS.js +0 -500
  157. package/dist/resources/Workers/chunk-YFXQECWV.js +0 -2857
  158. package/dist/resources/Workers/chunk-YSGTGQQO.js +0 -398
  159. package/dist/resources/Workers/chunk-YZ733KKS.js +0 -368
@@ -1,758 +0,0 @@
1
- /**
2
- * @license
3
- * Cesium - https://github.com/CesiumGS/cesium
4
- * Version 1.122
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
- AttributeCompression_default
28
- } from "./chunk-NGPPMXRM.js";
29
- import {
30
- BoundingSphere_default
31
- } from "./chunk-VJZB3WAV.js";
32
- import {
33
- Matrix4_default,
34
- Rectangle_default
35
- } from "./chunk-5PTXS2GO.js";
36
- import {
37
- ComponentDatatype_default
38
- } from "./chunk-K4GQUNB5.js";
39
- import {
40
- Cartesian2_default,
41
- Cartesian3_default,
42
- Cartographic_default,
43
- Ellipsoid_default
44
- } from "./chunk-YFXQECWV.js";
45
- import {
46
- Math_default
47
- } from "./chunk-XY4BATBS.js";
48
- import {
49
- defaultValue_default
50
- } from "./chunk-7JO7GPJN.js";
51
- import {
52
- Check_default,
53
- DeveloperError_default
54
- } from "./chunk-AD63PIY6.js";
55
- import {
56
- defined_default
57
- } from "./chunk-E63IIM5T.js";
58
-
59
- // packages/engine/Source/Core/EllipsoidalOccluder.js
60
- function EllipsoidalOccluder(ellipsoid, cameraPosition) {
61
- Check_default.typeOf.object("ellipsoid", ellipsoid);
62
- this._ellipsoid = ellipsoid;
63
- this._cameraPosition = new Cartesian3_default();
64
- this._cameraPositionInScaledSpace = new Cartesian3_default();
65
- this._distanceToLimbInScaledSpaceSquared = 0;
66
- if (defined_default(cameraPosition)) {
67
- this.cameraPosition = cameraPosition;
68
- }
69
- }
70
- Object.defineProperties(EllipsoidalOccluder.prototype, {
71
- /**
72
- * Gets the occluding ellipsoid.
73
- * @memberof EllipsoidalOccluder.prototype
74
- * @type {Ellipsoid}
75
- */
76
- ellipsoid: {
77
- get: function() {
78
- return this._ellipsoid;
79
- }
80
- },
81
- /**
82
- * Gets or sets the position of the camera.
83
- * @memberof EllipsoidalOccluder.prototype
84
- * @type {Cartesian3}
85
- */
86
- cameraPosition: {
87
- get: function() {
88
- return this._cameraPosition;
89
- },
90
- set: function(cameraPosition) {
91
- const ellipsoid = this._ellipsoid;
92
- const cv = ellipsoid.transformPositionToScaledSpace(
93
- cameraPosition,
94
- this._cameraPositionInScaledSpace
95
- );
96
- const vhMagnitudeSquared = Cartesian3_default.magnitudeSquared(cv) - 1;
97
- Cartesian3_default.clone(cameraPosition, this._cameraPosition);
98
- this._cameraPositionInScaledSpace = cv;
99
- this._distanceToLimbInScaledSpaceSquared = vhMagnitudeSquared;
100
- }
101
- }
102
- });
103
- var scratchCartesian = new Cartesian3_default();
104
- EllipsoidalOccluder.prototype.isPointVisible = function(occludee) {
105
- const ellipsoid = this._ellipsoid;
106
- const occludeeScaledSpacePosition = ellipsoid.transformPositionToScaledSpace(
107
- occludee,
108
- scratchCartesian
109
- );
110
- return isScaledSpacePointVisible(
111
- occludeeScaledSpacePosition,
112
- this._cameraPositionInScaledSpace,
113
- this._distanceToLimbInScaledSpaceSquared
114
- );
115
- };
116
- EllipsoidalOccluder.prototype.isScaledSpacePointVisible = function(occludeeScaledSpacePosition) {
117
- return isScaledSpacePointVisible(
118
- occludeeScaledSpacePosition,
119
- this._cameraPositionInScaledSpace,
120
- this._distanceToLimbInScaledSpaceSquared
121
- );
122
- };
123
- var scratchCameraPositionInScaledSpaceShrunk = new Cartesian3_default();
124
- EllipsoidalOccluder.prototype.isScaledSpacePointVisiblePossiblyUnderEllipsoid = function(occludeeScaledSpacePosition, minimumHeight) {
125
- const ellipsoid = this._ellipsoid;
126
- let vhMagnitudeSquared;
127
- let cv;
128
- if (defined_default(minimumHeight) && minimumHeight < 0 && ellipsoid.minimumRadius > -minimumHeight) {
129
- cv = scratchCameraPositionInScaledSpaceShrunk;
130
- cv.x = this._cameraPosition.x / (ellipsoid.radii.x + minimumHeight);
131
- cv.y = this._cameraPosition.y / (ellipsoid.radii.y + minimumHeight);
132
- cv.z = this._cameraPosition.z / (ellipsoid.radii.z + minimumHeight);
133
- vhMagnitudeSquared = cv.x * cv.x + cv.y * cv.y + cv.z * cv.z - 1;
134
- } else {
135
- cv = this._cameraPositionInScaledSpace;
136
- vhMagnitudeSquared = this._distanceToLimbInScaledSpaceSquared;
137
- }
138
- return isScaledSpacePointVisible(
139
- occludeeScaledSpacePosition,
140
- cv,
141
- vhMagnitudeSquared
142
- );
143
- };
144
- EllipsoidalOccluder.prototype.computeHorizonCullingPoint = function(directionToPoint, positions, result) {
145
- return computeHorizonCullingPointFromPositions(
146
- this._ellipsoid,
147
- directionToPoint,
148
- positions,
149
- result
150
- );
151
- };
152
- var scratchEllipsoidShrunk = Ellipsoid_default.clone(Ellipsoid_default.UNIT_SPHERE);
153
- EllipsoidalOccluder.prototype.computeHorizonCullingPointPossiblyUnderEllipsoid = function(directionToPoint, positions, minimumHeight, result) {
154
- const possiblyShrunkEllipsoid = getPossiblyShrunkEllipsoid(
155
- this._ellipsoid,
156
- minimumHeight,
157
- scratchEllipsoidShrunk
158
- );
159
- return computeHorizonCullingPointFromPositions(
160
- possiblyShrunkEllipsoid,
161
- directionToPoint,
162
- positions,
163
- result
164
- );
165
- };
166
- EllipsoidalOccluder.prototype.computeHorizonCullingPointFromVertices = function(directionToPoint, vertices, stride, center, result) {
167
- return computeHorizonCullingPointFromVertices(
168
- this._ellipsoid,
169
- directionToPoint,
170
- vertices,
171
- stride,
172
- center,
173
- result
174
- );
175
- };
176
- EllipsoidalOccluder.prototype.computeHorizonCullingPointFromVerticesPossiblyUnderEllipsoid = function(directionToPoint, vertices, stride, center, minimumHeight, result) {
177
- const possiblyShrunkEllipsoid = getPossiblyShrunkEllipsoid(
178
- this._ellipsoid,
179
- minimumHeight,
180
- scratchEllipsoidShrunk
181
- );
182
- return computeHorizonCullingPointFromVertices(
183
- possiblyShrunkEllipsoid,
184
- directionToPoint,
185
- vertices,
186
- stride,
187
- center,
188
- result
189
- );
190
- };
191
- var subsampleScratch = [];
192
- EllipsoidalOccluder.prototype.computeHorizonCullingPointFromRectangle = function(rectangle, ellipsoid, result) {
193
- Check_default.typeOf.object("rectangle", rectangle);
194
- const positions = Rectangle_default.subsample(
195
- rectangle,
196
- ellipsoid,
197
- 0,
198
- subsampleScratch
199
- );
200
- const bs = BoundingSphere_default.fromPoints(positions);
201
- if (Cartesian3_default.magnitude(bs.center) < 0.1 * ellipsoid.minimumRadius) {
202
- return void 0;
203
- }
204
- return this.computeHorizonCullingPoint(bs.center, positions, result);
205
- };
206
- var scratchEllipsoidShrunkRadii = new Cartesian3_default();
207
- function getPossiblyShrunkEllipsoid(ellipsoid, minimumHeight, result) {
208
- if (defined_default(minimumHeight) && minimumHeight < 0 && ellipsoid.minimumRadius > -minimumHeight) {
209
- const ellipsoidShrunkRadii = Cartesian3_default.fromElements(
210
- ellipsoid.radii.x + minimumHeight,
211
- ellipsoid.radii.y + minimumHeight,
212
- ellipsoid.radii.z + minimumHeight,
213
- scratchEllipsoidShrunkRadii
214
- );
215
- ellipsoid = Ellipsoid_default.fromCartesian3(ellipsoidShrunkRadii, result);
216
- }
217
- return ellipsoid;
218
- }
219
- function computeHorizonCullingPointFromPositions(ellipsoid, directionToPoint, positions, result) {
220
- Check_default.typeOf.object("directionToPoint", directionToPoint);
221
- Check_default.defined("positions", positions);
222
- if (!defined_default(result)) {
223
- result = new Cartesian3_default();
224
- }
225
- const scaledSpaceDirectionToPoint = computeScaledSpaceDirectionToPoint(
226
- ellipsoid,
227
- directionToPoint
228
- );
229
- let resultMagnitude = 0;
230
- for (let i = 0, len = positions.length; i < len; ++i) {
231
- const position = positions[i];
232
- const candidateMagnitude = computeMagnitude(
233
- ellipsoid,
234
- position,
235
- scaledSpaceDirectionToPoint
236
- );
237
- if (candidateMagnitude < 0) {
238
- return void 0;
239
- }
240
- resultMagnitude = Math.max(resultMagnitude, candidateMagnitude);
241
- }
242
- return magnitudeToPoint(scaledSpaceDirectionToPoint, resultMagnitude, result);
243
- }
244
- var positionScratch = new Cartesian3_default();
245
- function computeHorizonCullingPointFromVertices(ellipsoid, directionToPoint, vertices, stride, center, result) {
246
- Check_default.typeOf.object("directionToPoint", directionToPoint);
247
- Check_default.defined("vertices", vertices);
248
- Check_default.typeOf.number("stride", stride);
249
- if (!defined_default(result)) {
250
- result = new Cartesian3_default();
251
- }
252
- stride = defaultValue_default(stride, 3);
253
- center = defaultValue_default(center, Cartesian3_default.ZERO);
254
- const scaledSpaceDirectionToPoint = computeScaledSpaceDirectionToPoint(
255
- ellipsoid,
256
- directionToPoint
257
- );
258
- let resultMagnitude = 0;
259
- for (let i = 0, len = vertices.length; i < len; i += stride) {
260
- positionScratch.x = vertices[i] + center.x;
261
- positionScratch.y = vertices[i + 1] + center.y;
262
- positionScratch.z = vertices[i + 2] + center.z;
263
- const candidateMagnitude = computeMagnitude(
264
- ellipsoid,
265
- positionScratch,
266
- scaledSpaceDirectionToPoint
267
- );
268
- if (candidateMagnitude < 0) {
269
- return void 0;
270
- }
271
- resultMagnitude = Math.max(resultMagnitude, candidateMagnitude);
272
- }
273
- return magnitudeToPoint(scaledSpaceDirectionToPoint, resultMagnitude, result);
274
- }
275
- function isScaledSpacePointVisible(occludeeScaledSpacePosition, cameraPositionInScaledSpace, distanceToLimbInScaledSpaceSquared) {
276
- const cv = cameraPositionInScaledSpace;
277
- const vhMagnitudeSquared = distanceToLimbInScaledSpaceSquared;
278
- const vt = Cartesian3_default.subtract(
279
- occludeeScaledSpacePosition,
280
- cv,
281
- scratchCartesian
282
- );
283
- const vtDotVc = -Cartesian3_default.dot(vt, cv);
284
- const isOccluded = vhMagnitudeSquared < 0 ? vtDotVc > 0 : vtDotVc > vhMagnitudeSquared && vtDotVc * vtDotVc / Cartesian3_default.magnitudeSquared(vt) > vhMagnitudeSquared;
285
- return !isOccluded;
286
- }
287
- var scaledSpaceScratch = new Cartesian3_default();
288
- var directionScratch = new Cartesian3_default();
289
- function computeMagnitude(ellipsoid, position, scaledSpaceDirectionToPoint) {
290
- const scaledSpacePosition = ellipsoid.transformPositionToScaledSpace(
291
- position,
292
- scaledSpaceScratch
293
- );
294
- let magnitudeSquared = Cartesian3_default.magnitudeSquared(scaledSpacePosition);
295
- let magnitude = Math.sqrt(magnitudeSquared);
296
- const direction = Cartesian3_default.divideByScalar(
297
- scaledSpacePosition,
298
- magnitude,
299
- directionScratch
300
- );
301
- magnitudeSquared = Math.max(1, magnitudeSquared);
302
- magnitude = Math.max(1, magnitude);
303
- const cosAlpha = Cartesian3_default.dot(direction, scaledSpaceDirectionToPoint);
304
- const sinAlpha = Cartesian3_default.magnitude(
305
- Cartesian3_default.cross(direction, scaledSpaceDirectionToPoint, direction)
306
- );
307
- const cosBeta = 1 / magnitude;
308
- const sinBeta = Math.sqrt(magnitudeSquared - 1) * cosBeta;
309
- return 1 / (cosAlpha * cosBeta - sinAlpha * sinBeta);
310
- }
311
- function magnitudeToPoint(scaledSpaceDirectionToPoint, resultMagnitude, result) {
312
- if (resultMagnitude <= 0 || resultMagnitude === 1 / 0 || resultMagnitude !== resultMagnitude) {
313
- return void 0;
314
- }
315
- return Cartesian3_default.multiplyByScalar(
316
- scaledSpaceDirectionToPoint,
317
- resultMagnitude,
318
- result
319
- );
320
- }
321
- var directionToPointScratch = new Cartesian3_default();
322
- function computeScaledSpaceDirectionToPoint(ellipsoid, directionToPoint) {
323
- if (Cartesian3_default.equals(directionToPoint, Cartesian3_default.ZERO)) {
324
- return directionToPoint;
325
- }
326
- ellipsoid.transformPositionToScaledSpace(
327
- directionToPoint,
328
- directionToPointScratch
329
- );
330
- return Cartesian3_default.normalize(directionToPointScratch, directionToPointScratch);
331
- }
332
- var EllipsoidalOccluder_default = EllipsoidalOccluder;
333
-
334
- // packages/engine/Source/Core/VerticalExaggeration.js
335
- var VerticalExaggeration = {};
336
- VerticalExaggeration.getHeight = function(height, scale, relativeHeight) {
337
- if (!Number.isFinite(scale)) {
338
- throw new DeveloperError_default("scale must be a finite number.");
339
- }
340
- if (!Number.isFinite(relativeHeight)) {
341
- throw new DeveloperError_default("relativeHeight must be a finite number.");
342
- }
343
- return (height - relativeHeight) * scale + relativeHeight;
344
- };
345
- var scratchCartographic = new Cartographic_default();
346
- VerticalExaggeration.getPosition = function(position, ellipsoid, verticalExaggeration, verticalExaggerationRelativeHeight, result) {
347
- const cartographic = ellipsoid.cartesianToCartographic(
348
- position,
349
- scratchCartographic
350
- );
351
- if (!defined_default(cartographic)) {
352
- return Cartesian3_default.clone(position, result);
353
- }
354
- const newHeight = VerticalExaggeration.getHeight(
355
- cartographic.height,
356
- verticalExaggeration,
357
- verticalExaggerationRelativeHeight
358
- );
359
- return Cartesian3_default.fromRadians(
360
- cartographic.longitude,
361
- cartographic.latitude,
362
- newHeight,
363
- ellipsoid,
364
- result
365
- );
366
- };
367
- var VerticalExaggeration_default = VerticalExaggeration;
368
-
369
- // packages/engine/Source/Core/TerrainQuantization.js
370
- var TerrainQuantization = {
371
- /**
372
- * The vertices are not compressed.
373
- *
374
- * @type {number}
375
- * @constant
376
- */
377
- NONE: 0,
378
- /**
379
- * The vertices are compressed to 12 bits.
380
- *
381
- * @type {number}
382
- * @constant
383
- */
384
- BITS12: 1
385
- };
386
- var TerrainQuantization_default = Object.freeze(TerrainQuantization);
387
-
388
- // packages/engine/Source/Core/TerrainEncoding.js
389
- var cartesian3Scratch = new Cartesian3_default();
390
- var cartesian3DimScratch = new Cartesian3_default();
391
- var cartesian2Scratch = new Cartesian2_default();
392
- var matrix4Scratch = new Matrix4_default();
393
- var matrix4Scratch2 = new Matrix4_default();
394
- var SHIFT_LEFT_12 = Math.pow(2, 12);
395
- function TerrainEncoding(center, axisAlignedBoundingBox, minimumHeight, maximumHeight, fromENU, hasVertexNormals, hasWebMercatorT, hasGeodeticSurfaceNormals, exaggeration, exaggerationRelativeHeight) {
396
- let quantization = TerrainQuantization_default.NONE;
397
- let toENU;
398
- let matrix;
399
- if (defined_default(axisAlignedBoundingBox) && defined_default(minimumHeight) && defined_default(maximumHeight) && defined_default(fromENU)) {
400
- const minimum = axisAlignedBoundingBox.minimum;
401
- const maximum = axisAlignedBoundingBox.maximum;
402
- const dimensions = Cartesian3_default.subtract(
403
- maximum,
404
- minimum,
405
- cartesian3DimScratch
406
- );
407
- const hDim = maximumHeight - minimumHeight;
408
- const maxDim = Math.max(Cartesian3_default.maximumComponent(dimensions), hDim);
409
- if (maxDim < SHIFT_LEFT_12 - 1) {
410
- quantization = TerrainQuantization_default.BITS12;
411
- } else {
412
- quantization = TerrainQuantization_default.NONE;
413
- }
414
- toENU = Matrix4_default.inverseTransformation(fromENU, new Matrix4_default());
415
- const translation = Cartesian3_default.negate(minimum, cartesian3Scratch);
416
- Matrix4_default.multiply(
417
- Matrix4_default.fromTranslation(translation, matrix4Scratch),
418
- toENU,
419
- toENU
420
- );
421
- const scale = cartesian3Scratch;
422
- scale.x = 1 / dimensions.x;
423
- scale.y = 1 / dimensions.y;
424
- scale.z = 1 / dimensions.z;
425
- Matrix4_default.multiply(Matrix4_default.fromScale(scale, matrix4Scratch), toENU, toENU);
426
- matrix = Matrix4_default.clone(fromENU);
427
- Matrix4_default.setTranslation(matrix, Cartesian3_default.ZERO, matrix);
428
- fromENU = Matrix4_default.clone(fromENU, new Matrix4_default());
429
- const translationMatrix = Matrix4_default.fromTranslation(minimum, matrix4Scratch);
430
- const scaleMatrix = Matrix4_default.fromScale(dimensions, matrix4Scratch2);
431
- const st = Matrix4_default.multiply(translationMatrix, scaleMatrix, matrix4Scratch);
432
- Matrix4_default.multiply(fromENU, st, fromENU);
433
- Matrix4_default.multiply(matrix, st, matrix);
434
- }
435
- this.quantization = quantization;
436
- this.minimumHeight = minimumHeight;
437
- this.maximumHeight = maximumHeight;
438
- this.center = Cartesian3_default.clone(center);
439
- this.toScaledENU = toENU;
440
- this.fromScaledENU = fromENU;
441
- this.matrix = matrix;
442
- this.hasVertexNormals = hasVertexNormals;
443
- this.hasWebMercatorT = defaultValue_default(hasWebMercatorT, false);
444
- this.hasGeodeticSurfaceNormals = defaultValue_default(
445
- hasGeodeticSurfaceNormals,
446
- false
447
- );
448
- this.exaggeration = defaultValue_default(exaggeration, 1);
449
- this.exaggerationRelativeHeight = defaultValue_default(
450
- exaggerationRelativeHeight,
451
- 0
452
- );
453
- this.stride = 0;
454
- this._offsetGeodeticSurfaceNormal = 0;
455
- this._offsetVertexNormal = 0;
456
- this._calculateStrideAndOffsets();
457
- }
458
- TerrainEncoding.prototype.encode = function(vertexBuffer, bufferIndex, position, uv, height, normalToPack, webMercatorT, geodeticSurfaceNormal) {
459
- const u = uv.x;
460
- const v = uv.y;
461
- if (this.quantization === TerrainQuantization_default.BITS12) {
462
- position = Matrix4_default.multiplyByPoint(
463
- this.toScaledENU,
464
- position,
465
- cartesian3Scratch
466
- );
467
- position.x = Math_default.clamp(position.x, 0, 1);
468
- position.y = Math_default.clamp(position.y, 0, 1);
469
- position.z = Math_default.clamp(position.z, 0, 1);
470
- const hDim = this.maximumHeight - this.minimumHeight;
471
- const h = Math_default.clamp((height - this.minimumHeight) / hDim, 0, 1);
472
- Cartesian2_default.fromElements(position.x, position.y, cartesian2Scratch);
473
- const compressed0 = AttributeCompression_default.compressTextureCoordinates(cartesian2Scratch);
474
- Cartesian2_default.fromElements(position.z, h, cartesian2Scratch);
475
- const compressed1 = AttributeCompression_default.compressTextureCoordinates(cartesian2Scratch);
476
- Cartesian2_default.fromElements(u, v, cartesian2Scratch);
477
- const compressed2 = AttributeCompression_default.compressTextureCoordinates(cartesian2Scratch);
478
- vertexBuffer[bufferIndex++] = compressed0;
479
- vertexBuffer[bufferIndex++] = compressed1;
480
- vertexBuffer[bufferIndex++] = compressed2;
481
- if (this.hasWebMercatorT) {
482
- Cartesian2_default.fromElements(webMercatorT, 0, cartesian2Scratch);
483
- const compressed3 = AttributeCompression_default.compressTextureCoordinates(cartesian2Scratch);
484
- vertexBuffer[bufferIndex++] = compressed3;
485
- }
486
- } else {
487
- Cartesian3_default.subtract(position, this.center, cartesian3Scratch);
488
- vertexBuffer[bufferIndex++] = cartesian3Scratch.x;
489
- vertexBuffer[bufferIndex++] = cartesian3Scratch.y;
490
- vertexBuffer[bufferIndex++] = cartesian3Scratch.z;
491
- vertexBuffer[bufferIndex++] = height;
492
- vertexBuffer[bufferIndex++] = u;
493
- vertexBuffer[bufferIndex++] = v;
494
- if (this.hasWebMercatorT) {
495
- vertexBuffer[bufferIndex++] = webMercatorT;
496
- }
497
- }
498
- if (this.hasVertexNormals) {
499
- vertexBuffer[bufferIndex++] = AttributeCompression_default.octPackFloat(normalToPack);
500
- }
501
- if (this.hasGeodeticSurfaceNormals) {
502
- vertexBuffer[bufferIndex++] = geodeticSurfaceNormal.x;
503
- vertexBuffer[bufferIndex++] = geodeticSurfaceNormal.y;
504
- vertexBuffer[bufferIndex++] = geodeticSurfaceNormal.z;
505
- }
506
- return bufferIndex;
507
- };
508
- var scratchPosition = new Cartesian3_default();
509
- var scratchGeodeticSurfaceNormal = new Cartesian3_default();
510
- TerrainEncoding.prototype.addGeodeticSurfaceNormals = function(oldBuffer, newBuffer, ellipsoid) {
511
- if (this.hasGeodeticSurfaceNormals) {
512
- return;
513
- }
514
- const oldStride = this.stride;
515
- const vertexCount = oldBuffer.length / oldStride;
516
- this.hasGeodeticSurfaceNormals = true;
517
- this._calculateStrideAndOffsets();
518
- const newStride = this.stride;
519
- for (let index = 0; index < vertexCount; index++) {
520
- for (let offset = 0; offset < oldStride; offset++) {
521
- const oldIndex = index * oldStride + offset;
522
- const newIndex = index * newStride + offset;
523
- newBuffer[newIndex] = oldBuffer[oldIndex];
524
- }
525
- const position = this.decodePosition(newBuffer, index, scratchPosition);
526
- const geodeticSurfaceNormal = ellipsoid.geodeticSurfaceNormal(
527
- position,
528
- scratchGeodeticSurfaceNormal
529
- );
530
- const bufferIndex = index * newStride + this._offsetGeodeticSurfaceNormal;
531
- newBuffer[bufferIndex] = geodeticSurfaceNormal.x;
532
- newBuffer[bufferIndex + 1] = geodeticSurfaceNormal.y;
533
- newBuffer[bufferIndex + 2] = geodeticSurfaceNormal.z;
534
- }
535
- };
536
- TerrainEncoding.prototype.removeGeodeticSurfaceNormals = function(oldBuffer, newBuffer) {
537
- if (!this.hasGeodeticSurfaceNormals) {
538
- return;
539
- }
540
- const oldStride = this.stride;
541
- const vertexCount = oldBuffer.length / oldStride;
542
- this.hasGeodeticSurfaceNormals = false;
543
- this._calculateStrideAndOffsets();
544
- const newStride = this.stride;
545
- for (let index = 0; index < vertexCount; index++) {
546
- for (let offset = 0; offset < newStride; offset++) {
547
- const oldIndex = index * oldStride + offset;
548
- const newIndex = index * newStride + offset;
549
- newBuffer[newIndex] = oldBuffer[oldIndex];
550
- }
551
- }
552
- };
553
- TerrainEncoding.prototype.decodePosition = function(buffer, index, result) {
554
- if (!defined_default(result)) {
555
- result = new Cartesian3_default();
556
- }
557
- index *= this.stride;
558
- if (this.quantization === TerrainQuantization_default.BITS12) {
559
- const xy = AttributeCompression_default.decompressTextureCoordinates(
560
- buffer[index],
561
- cartesian2Scratch
562
- );
563
- result.x = xy.x;
564
- result.y = xy.y;
565
- const zh = AttributeCompression_default.decompressTextureCoordinates(
566
- buffer[index + 1],
567
- cartesian2Scratch
568
- );
569
- result.z = zh.x;
570
- return Matrix4_default.multiplyByPoint(this.fromScaledENU, result, result);
571
- }
572
- result.x = buffer[index];
573
- result.y = buffer[index + 1];
574
- result.z = buffer[index + 2];
575
- return Cartesian3_default.add(result, this.center, result);
576
- };
577
- TerrainEncoding.prototype.getExaggeratedPosition = function(buffer, index, result) {
578
- result = this.decodePosition(buffer, index, result);
579
- const exaggeration = this.exaggeration;
580
- const exaggerationRelativeHeight = this.exaggerationRelativeHeight;
581
- const hasExaggeration = exaggeration !== 1;
582
- if (hasExaggeration && this.hasGeodeticSurfaceNormals) {
583
- const geodeticSurfaceNormal = this.decodeGeodeticSurfaceNormal(
584
- buffer,
585
- index,
586
- scratchGeodeticSurfaceNormal
587
- );
588
- const rawHeight = this.decodeHeight(buffer, index);
589
- const heightDifference = VerticalExaggeration_default.getHeight(
590
- rawHeight,
591
- exaggeration,
592
- exaggerationRelativeHeight
593
- ) - rawHeight;
594
- result.x += geodeticSurfaceNormal.x * heightDifference;
595
- result.y += geodeticSurfaceNormal.y * heightDifference;
596
- result.z += geodeticSurfaceNormal.z * heightDifference;
597
- }
598
- return result;
599
- };
600
- TerrainEncoding.prototype.decodeTextureCoordinates = function(buffer, index, result) {
601
- if (!defined_default(result)) {
602
- result = new Cartesian2_default();
603
- }
604
- index *= this.stride;
605
- if (this.quantization === TerrainQuantization_default.BITS12) {
606
- return AttributeCompression_default.decompressTextureCoordinates(
607
- buffer[index + 2],
608
- result
609
- );
610
- }
611
- return Cartesian2_default.fromElements(buffer[index + 4], buffer[index + 5], result);
612
- };
613
- TerrainEncoding.prototype.decodeHeight = function(buffer, index) {
614
- index *= this.stride;
615
- if (this.quantization === TerrainQuantization_default.BITS12) {
616
- const zh = AttributeCompression_default.decompressTextureCoordinates(
617
- buffer[index + 1],
618
- cartesian2Scratch
619
- );
620
- return zh.y * (this.maximumHeight - this.minimumHeight) + this.minimumHeight;
621
- }
622
- return buffer[index + 3];
623
- };
624
- TerrainEncoding.prototype.decodeWebMercatorT = function(buffer, index) {
625
- index *= this.stride;
626
- if (this.quantization === TerrainQuantization_default.BITS12) {
627
- return AttributeCompression_default.decompressTextureCoordinates(
628
- buffer[index + 3],
629
- cartesian2Scratch
630
- ).x;
631
- }
632
- return buffer[index + 6];
633
- };
634
- TerrainEncoding.prototype.getOctEncodedNormal = function(buffer, index, result) {
635
- index = index * this.stride + this._offsetVertexNormal;
636
- const temp = buffer[index] / 256;
637
- const x = Math.floor(temp);
638
- const y = (temp - x) * 256;
639
- return Cartesian2_default.fromElements(x, y, result);
640
- };
641
- TerrainEncoding.prototype.decodeGeodeticSurfaceNormal = function(buffer, index, result) {
642
- index = index * this.stride + this._offsetGeodeticSurfaceNormal;
643
- result.x = buffer[index];
644
- result.y = buffer[index + 1];
645
- result.z = buffer[index + 2];
646
- return result;
647
- };
648
- TerrainEncoding.prototype._calculateStrideAndOffsets = function() {
649
- let vertexStride = 0;
650
- switch (this.quantization) {
651
- case TerrainQuantization_default.BITS12:
652
- vertexStride += 3;
653
- break;
654
- default:
655
- vertexStride += 6;
656
- }
657
- if (this.hasWebMercatorT) {
658
- vertexStride += 1;
659
- }
660
- if (this.hasVertexNormals) {
661
- this._offsetVertexNormal = vertexStride;
662
- vertexStride += 1;
663
- }
664
- if (this.hasGeodeticSurfaceNormals) {
665
- this._offsetGeodeticSurfaceNormal = vertexStride;
666
- vertexStride += 3;
667
- }
668
- this.stride = vertexStride;
669
- };
670
- var attributesIndicesNone = {
671
- position3DAndHeight: 0,
672
- textureCoordAndEncodedNormals: 1,
673
- geodeticSurfaceNormal: 2
674
- };
675
- var attributesIndicesBits12 = {
676
- compressed0: 0,
677
- compressed1: 1,
678
- geodeticSurfaceNormal: 2
679
- };
680
- TerrainEncoding.prototype.getAttributes = function(buffer) {
681
- const datatype = ComponentDatatype_default.FLOAT;
682
- const sizeInBytes = ComponentDatatype_default.getSizeInBytes(datatype);
683
- const strideInBytes = this.stride * sizeInBytes;
684
- let offsetInBytes = 0;
685
- const attributes = [];
686
- function addAttribute(index, componentsPerAttribute) {
687
- attributes.push({
688
- index,
689
- vertexBuffer: buffer,
690
- componentDatatype: datatype,
691
- componentsPerAttribute,
692
- offsetInBytes,
693
- strideInBytes
694
- });
695
- offsetInBytes += componentsPerAttribute * sizeInBytes;
696
- }
697
- if (this.quantization === TerrainQuantization_default.NONE) {
698
- addAttribute(attributesIndicesNone.position3DAndHeight, 4);
699
- let componentsTexCoordAndNormals = 2;
700
- componentsTexCoordAndNormals += this.hasWebMercatorT ? 1 : 0;
701
- componentsTexCoordAndNormals += this.hasVertexNormals ? 1 : 0;
702
- addAttribute(
703
- attributesIndicesNone.textureCoordAndEncodedNormals,
704
- componentsTexCoordAndNormals
705
- );
706
- if (this.hasGeodeticSurfaceNormals) {
707
- addAttribute(attributesIndicesNone.geodeticSurfaceNormal, 3);
708
- }
709
- } else {
710
- const usingAttribute0Component4 = this.hasWebMercatorT || this.hasVertexNormals;
711
- const usingAttribute1Component1 = this.hasWebMercatorT && this.hasVertexNormals;
712
- addAttribute(
713
- attributesIndicesBits12.compressed0,
714
- usingAttribute0Component4 ? 4 : 3
715
- );
716
- if (usingAttribute1Component1) {
717
- addAttribute(attributesIndicesBits12.compressed1, 1);
718
- }
719
- if (this.hasGeodeticSurfaceNormals) {
720
- addAttribute(attributesIndicesBits12.geodeticSurfaceNormal, 3);
721
- }
722
- }
723
- return attributes;
724
- };
725
- TerrainEncoding.prototype.getAttributeLocations = function() {
726
- if (this.quantization === TerrainQuantization_default.NONE) {
727
- return attributesIndicesNone;
728
- }
729
- return attributesIndicesBits12;
730
- };
731
- TerrainEncoding.clone = function(encoding, result) {
732
- if (!defined_default(encoding)) {
733
- return void 0;
734
- }
735
- if (!defined_default(result)) {
736
- result = new TerrainEncoding();
737
- }
738
- result.quantization = encoding.quantization;
739
- result.minimumHeight = encoding.minimumHeight;
740
- result.maximumHeight = encoding.maximumHeight;
741
- result.center = Cartesian3_default.clone(encoding.center);
742
- result.toScaledENU = Matrix4_default.clone(encoding.toScaledENU);
743
- result.fromScaledENU = Matrix4_default.clone(encoding.fromScaledENU);
744
- result.matrix = Matrix4_default.clone(encoding.matrix);
745
- result.hasVertexNormals = encoding.hasVertexNormals;
746
- result.hasWebMercatorT = encoding.hasWebMercatorT;
747
- result.hasGeodeticSurfaceNormals = encoding.hasGeodeticSurfaceNormals;
748
- result.exaggeration = encoding.exaggeration;
749
- result.exaggerationRelativeHeight = encoding.exaggerationRelativeHeight;
750
- result._calculateStrideAndOffsets();
751
- return result;
752
- };
753
- var TerrainEncoding_default = TerrainEncoding;
754
-
755
- export {
756
- EllipsoidalOccluder_default,
757
- TerrainEncoding_default
758
- };