@pggis/pg-sdk 3.3.10 → 4.3.3

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