@hztxi/cesium-engine 25.0.4 → 25.0.7

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 (202) hide show
  1. package/Build/Workers/chunk-247MLVK2.js +124 -0
  2. package/Build/Workers/chunk-26I7TIAE.js +58 -0
  3. package/Build/Workers/chunk-26OYTC24.js +38 -0
  4. package/Build/Workers/chunk-2GJAWJJT.js +1344 -0
  5. package/Build/Workers/chunk-2IMOZG7R.js +973 -0
  6. package/Build/Workers/chunk-2J2VS5RI.js +288 -0
  7. package/Build/Workers/chunk-2L6JGSYJ.js +57 -0
  8. package/Build/Workers/chunk-32N2SB76.js +56 -0
  9. package/Build/Workers/chunk-375SHKGW.js +44 -0
  10. package/Build/Workers/chunk-37WL527K.js +1287 -0
  11. package/Build/Workers/chunk-3IGH46TC.js +1054 -0
  12. package/Build/Workers/chunk-47BSFGJC.js +837 -0
  13. package/Build/Workers/chunk-4J7PL5AM.js +454 -0
  14. package/Build/Workers/chunk-4UMO63VY.js +76 -0
  15. package/Build/Workers/chunk-5FYUSABU.js +945 -0
  16. package/Build/Workers/chunk-5WU37CUJ.js +630 -0
  17. package/Build/Workers/chunk-5YI3TQQC.js +778 -0
  18. package/Build/Workers/chunk-6EBDN5WS.js +97 -0
  19. package/Build/Workers/chunk-75HIWCEV.js +301 -0
  20. package/Build/Workers/chunk-7AMVPXZY.js +1992 -0
  21. package/Build/Workers/chunk-7BMDD6SM.js +124 -0
  22. package/Build/Workers/chunk-7OME2OKM.js +171 -0
  23. package/Build/Workers/chunk-A2BROW3D.js +352 -0
  24. package/Build/Workers/chunk-AEZQ2UWS.js +288 -0
  25. package/Build/Workers/chunk-AXE2ZIEG.js +219 -0
  26. package/Build/Workers/chunk-B4XOVZGA.js +476 -0
  27. package/Build/Workers/chunk-BDR7GL3E.js +1067 -0
  28. package/Build/Workers/chunk-C342XITR.js +44 -0
  29. package/Build/Workers/chunk-CDLPLYLV.js +1287 -0
  30. package/Build/Workers/chunk-CEKCKPFN.js +368 -0
  31. package/Build/Workers/chunk-CHMDKP5L.js +2342 -0
  32. package/Build/Workers/chunk-CWAUXQRF.js +754 -0
  33. package/Build/Workers/chunk-CWGB3D4Z.js +257 -0
  34. package/Build/Workers/chunk-DQEUGBGA.js +2719 -0
  35. package/Build/Workers/chunk-DUBE5G2H.js +497 -0
  36. package/Build/Workers/chunk-E4PBNWWK.js +58 -0
  37. package/Build/Workers/chunk-E5F7LDEP.js +3201 -0
  38. package/Build/Workers/chunk-E5MWOMVC.js +57 -0
  39. package/Build/Workers/chunk-EE3XBOQI.js +1483 -0
  40. package/Build/Workers/chunk-EHA2ZDPZ.js +415 -0
  41. package/Build/Workers/chunk-EKEKPAJF.js +454 -0
  42. package/Build/Workers/chunk-EOHKUXPX.js +198 -0
  43. package/Build/Workers/chunk-ERENMHG2.js +754 -0
  44. package/Build/Workers/chunk-ESQGFRLZ.js +163 -0
  45. package/Build/Workers/chunk-FAKYMBUA.js +1046 -0
  46. package/Build/Workers/chunk-FSK4OZOO.js +352 -0
  47. package/Build/Workers/chunk-FSLRYNZ6.js +682 -0
  48. package/Build/Workers/chunk-FV4OWDV4.js +9230 -0
  49. package/Build/Workers/chunk-FYRNNQSL.js +280 -0
  50. package/Build/Workers/chunk-GMDOGAXK.js +2719 -0
  51. package/Build/Workers/chunk-GRAFCIPA.js +455 -0
  52. package/Build/Workers/chunk-HEY4IOS3.js +140 -0
  53. package/Build/Workers/chunk-HRWFO57T.js +301 -0
  54. package/Build/Workers/chunk-HTCLVUBZ.js +82 -0
  55. package/Build/Workers/chunk-I2Q7XDRA.js +630 -0
  56. package/Build/Workers/chunk-ILPH3NF7.js +3794 -0
  57. package/Build/Workers/chunk-JMF4ATAS.js +3794 -0
  58. package/Build/Workers/chunk-JZUUODN6.js +97 -0
  59. package/Build/Workers/chunk-KEJKMITY.js +82 -0
  60. package/Build/Workers/chunk-KW2QZDUS.js +147 -0
  61. package/Build/Workers/chunk-KWVB54J6.js +241 -0
  62. package/Build/Workers/chunk-L6B5XPBL.js +73 -0
  63. package/Build/Workers/chunk-LGJXN2VP.js +352 -0
  64. package/Build/Workers/chunk-LY2UG3HV.js +38 -0
  65. package/Build/Workers/chunk-M3B3ZUU2.js +476 -0
  66. package/Build/Workers/chunk-MKR6YCMG.js +497 -0
  67. package/Build/Workers/chunk-MROMS2RL.js +162 -0
  68. package/Build/Workers/chunk-MUNAUSK7.js +280 -0
  69. package/Build/Workers/chunk-NCPJBP24.js +140 -0
  70. package/Build/Workers/chunk-NFY5V6MR.js +102 -0
  71. package/Build/Workers/chunk-NHU5JEPP.js +1344 -0
  72. package/Build/Workers/chunk-OODXPB45.js +73 -0
  73. package/Build/Workers/chunk-OXZ5J3JW.js +368 -0
  74. package/Build/Workers/chunk-OYPSUED3.js +1067 -0
  75. package/Build/Workers/chunk-QBSWSTHY.js +257 -0
  76. package/Build/Workers/chunk-QDJYG7QL.js +352 -0
  77. package/Build/Workers/chunk-QIOOTLWN.js +56 -0
  78. package/Build/Workers/chunk-QUPRALOD.js +101 -0
  79. package/Build/Workers/chunk-RBEVHHXK.js +3201 -0
  80. package/Build/Workers/chunk-RHO5HV52.js +305 -0
  81. package/Build/Workers/chunk-RX3U2BBW.js +1483 -0
  82. package/Build/Workers/chunk-S3XHL7GO.js +1992 -0
  83. package/Build/Workers/chunk-SBIC4OGS.js +171 -0
  84. package/Build/Workers/chunk-SVCZUP5R.js +837 -0
  85. package/Build/Workers/chunk-T4CYNROE.js +102 -0
  86. package/Build/Workers/chunk-T5VLPB4H.js +414 -0
  87. package/Build/Workers/chunk-TBHW5UME.js +973 -0
  88. package/Build/Workers/chunk-TPOX6IOR.js +1054 -0
  89. package/Build/Workers/chunk-TX763OWB.js +387 -0
  90. package/Build/Workers/chunk-ULNBTI6R.js +138 -0
  91. package/Build/Workers/chunk-UMUS2AQQ.js +398 -0
  92. package/Build/Workers/chunk-UTAWMCSE.js +163 -0
  93. package/Build/Workers/chunk-UZ7GTP2L.js +162 -0
  94. package/Build/Workers/chunk-VETQOADR.js +2342 -0
  95. package/Build/Workers/chunk-VXRWOM3T.js +101 -0
  96. package/Build/Workers/chunk-W3C7OHXF.js +387 -0
  97. package/Build/Workers/chunk-WB5GWYDP.js +455 -0
  98. package/Build/Workers/chunk-WN6MAL25.js +682 -0
  99. package/Build/Workers/chunk-WTR7KMQA.js +693 -0
  100. package/Build/Workers/chunk-WTTFMU3P.js +241 -0
  101. package/Build/Workers/chunk-WULONJZC.js +1800 -0
  102. package/Build/Workers/chunk-WVVFCMYF.js +147 -0
  103. package/Build/Workers/chunk-WZPMAVTV.js +511 -0
  104. package/Build/Workers/chunk-XAVNBZQ6.js +56 -0
  105. package/Build/Workers/chunk-XDSDR62Y.js +1800 -0
  106. package/Build/Workers/chunk-XDZCVNIZ.js +198 -0
  107. package/Build/Workers/chunk-XNLCW2OI.js +138 -0
  108. package/Build/Workers/chunk-XNQ2BTJD.js +693 -0
  109. package/Build/Workers/chunk-XZYBDSFP.js +305 -0
  110. package/Build/Workers/chunk-Y7KVUJEB.js +219 -0
  111. package/Build/Workers/chunk-YDYN3RPI.js +398 -0
  112. package/Build/Workers/chunk-YMMEQBEW.js +511 -0
  113. package/Build/Workers/chunk-YQFOQAXD.js +9230 -0
  114. package/Build/Workers/chunk-Z6JV4DZG.js +1046 -0
  115. package/Build/Workers/chunk-ZTK5EBUI.js +76 -0
  116. package/Build/Workers/chunk-ZZPDORJK.js +56 -0
  117. package/Build/Workers/combineGeometry.js +24 -24
  118. package/Build/Workers/createBoxGeometry.js +18 -18
  119. package/Build/Workers/createBoxOutlineGeometry.js +16 -16
  120. package/Build/Workers/createCircleGeometry.js +26 -26
  121. package/Build/Workers/createCircleOutlineGeometry.js +19 -19
  122. package/Build/Workers/createCoplanarPolygonGeometry.js +33 -33
  123. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -31
  124. package/Build/Workers/createCorridorGeometry.js +29 -29
  125. package/Build/Workers/createCorridorOutlineGeometry.js +28 -28
  126. package/Build/Workers/createCylinderGeometry.js +20 -20
  127. package/Build/Workers/createCylinderOutlineGeometry.js +18 -18
  128. package/Build/Workers/createEllipseGeometry.js +26 -26
  129. package/Build/Workers/createEllipseOutlineGeometry.js +19 -19
  130. package/Build/Workers/createEllipsoidGeometry.js +19 -19
  131. package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -18
  132. package/Build/Workers/createFrustumGeometry.js +18 -18
  133. package/Build/Workers/createFrustumOutlineGeometry.js +18 -18
  134. package/Build/Workers/createGeometry.js +24 -24
  135. package/Build/Workers/createGroundPolylineGeometry.js +95 -31
  136. package/Build/Workers/createPlaneGeometry.js +16 -16
  137. package/Build/Workers/createPlaneOutlineGeometry.js +15 -15
  138. package/Build/Workers/createPolygonGeometry.js +32 -32
  139. package/Build/Workers/createPolygonOutlineGeometry.js +30 -30
  140. package/Build/Workers/createPolylineGeometry.js +25 -25
  141. package/Build/Workers/createPolylineVolumeGeometry.js +31 -31
  142. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
  143. package/Build/Workers/createRectangleGeometry.js +27 -27
  144. package/Build/Workers/createRectangleOutlineGeometry.js +20 -20
  145. package/Build/Workers/createSimplePolylineGeometry.js +23 -23
  146. package/Build/Workers/createSphereGeometry.js +19 -19
  147. package/Build/Workers/createSphereOutlineGeometry.js +18 -18
  148. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  149. package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
  150. package/Build/Workers/createVectorTileGeometries.js +24 -24
  151. package/Build/Workers/createVectorTilePoints.js +13 -13
  152. package/Build/Workers/createVectorTilePolygons.js +22 -22
  153. package/Build/Workers/createVectorTilePolylines.js +14 -14
  154. package/Build/Workers/createVerticesFromCesium3DTilesTerrain.js +26 -26
  155. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +23 -23
  156. package/Build/Workers/createVerticesFromHeightmap.js +23 -23
  157. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +21 -21
  158. package/Build/Workers/createWallGeometry.js +24 -24
  159. package/Build/Workers/createWallOutlineGeometry.js +23 -23
  160. package/Build/Workers/decodeDraco.js +10 -10
  161. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  162. package/Build/Workers/decodeI3S.js +10 -10
  163. package/Build/Workers/gaussianSplatSorter.js +4 -4
  164. package/Build/Workers/gaussianSplatTextureGenerator.js +4 -4
  165. package/Build/Workers/incrementallyBuildTerrainPicker.js +10 -10
  166. package/Build/Workers/transcodeKTX2.js +6 -6
  167. package/Build/Workers/transferTypedArrayTest.js +1 -1
  168. package/Build/Workers/upsampleQuantizedTerrainMesh.js +23 -23
  169. package/Build/Workers/upsampleVerticesFromCesium3DTilesTerrain.js +26 -26
  170. package/Source/Core/GroundPolylineGeometry.js +99 -4
  171. package/Source/Core/PolylinePipeline.js +9 -2
  172. package/Source/DataSources/PolylineGeometryUpdater.js +125 -7
  173. package/Source/Scene/Camera.js +56 -3
  174. package/Source/Scene/CameraFlightPath.js +14 -0
  175. package/Source/Scene/ClassificationPrimitive.js +63 -3
  176. package/Source/Scene/ColumbusWorlds.js +190 -0
  177. package/Source/Scene/FrameState.js +10 -0
  178. package/Source/Scene/Globe.js +89 -22
  179. package/Source/Scene/GlobeDepth.js +216 -5
  180. package/Source/Scene/GlobeSurfaceTileProvider.js +897 -678
  181. package/Source/Scene/GroundPolylinePrimitive.js +2 -1
  182. package/Source/Scene/Polyline.js +32 -5
  183. package/Source/Scene/PolylineCollection.js +41 -2
  184. package/Source/Scene/Primitive.js +12 -13
  185. package/Source/Scene/PrimitivePipeline.js +158 -28
  186. package/Source/Scene/Scene.js +428 -5
  187. package/Source/Scene/SceneTransforms.js +17 -0
  188. package/Source/Scene/ScreenSpaceCameraController.js +12 -3
  189. package/Source/Shaders/PolylineShadowVolumeFS.glsl +14 -0
  190. package/Source/Shaders/PolylineShadowVolumeFS.js +14 -0
  191. package/Source/Shaders/PolylineShadowVolumeMorphVS.glsl +14 -1
  192. package/Source/Shaders/PolylineShadowVolumeMorphVS.js +14 -1
  193. package/Source/Shaders/PolylineShadowVolumeVS.glsl +7 -0
  194. package/Source/Shaders/PolylineShadowVolumeVS.js +7 -0
  195. package/Source/Shaders/PolylineVS.glsl +16 -6
  196. package/Source/Shaders/PolylineVS.js +16 -6
  197. package/Source/Shaders/RestoreDepth.glsl +8 -0
  198. package/Source/Shaders/RestoreDepth.js +10 -0
  199. package/Source/ThirdParty/zip-module.wasm +0 -0
  200. package/index.d.ts +535 -1393
  201. package/index.js +267 -265
  202. package/package.json +10 -10
@@ -0,0 +1,945 @@
1
+ /**
2
+ * @license
3
+ * Cesium - https://github.com/CesiumGS/cesium
4
+ * Version 1.141.7
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
+ WebMercatorProjection_default
28
+ } from "./chunk-KW2QZDUS.js";
29
+ import {
30
+ GeometryPipeline_default
31
+ } from "./chunk-DQEUGBGA.js";
32
+ import {
33
+ IntersectionTests_default
34
+ } from "./chunk-2GJAWJJT.js";
35
+ import {
36
+ IndexDatatype_default
37
+ } from "./chunk-NCPJBP24.js";
38
+ import {
39
+ GeometryAttributes_default
40
+ } from "./chunk-375SHKGW.js";
41
+ import {
42
+ GeometryAttribute_default,
43
+ Geometry_default
44
+ } from "./chunk-75HIWCEV.js";
45
+ import {
46
+ BoundingSphere_default,
47
+ GeographicProjection_default
48
+ } from "./chunk-CDLPLYLV.js";
49
+ import {
50
+ Rectangle_default
51
+ } from "./chunk-FV4OWDV4.js";
52
+ import {
53
+ Cartesian4_default,
54
+ Matrix4_default
55
+ } from "./chunk-RBEVHHXK.js";
56
+ import {
57
+ ComponentDatatype_default
58
+ } from "./chunk-CWGB3D4Z.js";
59
+ import {
60
+ Cartographic_default,
61
+ Ellipsoid_default
62
+ } from "./chunk-7AMVPXZY.js";
63
+ import {
64
+ Cartesian3_default
65
+ } from "./chunk-CHMDKP5L.js";
66
+ import {
67
+ Check_default,
68
+ DeveloperError_default
69
+ } from "./chunk-ESQGFRLZ.js";
70
+ import {
71
+ defined_default
72
+ } from "./chunk-KEJKMITY.js";
73
+
74
+ // packages/engine/Source/Core/OffsetGeometryInstanceAttribute.js
75
+ function OffsetGeometryInstanceAttribute(x, y, z) {
76
+ x = x ?? 0;
77
+ y = y ?? 0;
78
+ z = z ?? 0;
79
+ this.value = new Float32Array([x, y, z]);
80
+ }
81
+ Object.defineProperties(OffsetGeometryInstanceAttribute.prototype, {
82
+ /**
83
+ * The datatype of each component in the attribute, e.g., individual elements in
84
+ * {@link OffsetGeometryInstanceAttribute#value}.
85
+ *
86
+ * @memberof OffsetGeometryInstanceAttribute.prototype
87
+ *
88
+ * @type {ComponentDatatype}
89
+ * @readonly
90
+ *
91
+ * @default {@link ComponentDatatype.FLOAT}
92
+ */
93
+ componentDatatype: {
94
+ get: function() {
95
+ return ComponentDatatype_default.FLOAT;
96
+ }
97
+ },
98
+ /**
99
+ * The number of components in the attributes, i.e., {@link OffsetGeometryInstanceAttribute#value}.
100
+ *
101
+ * @memberof OffsetGeometryInstanceAttribute.prototype
102
+ *
103
+ * @type {number}
104
+ * @readonly
105
+ *
106
+ * @default 3
107
+ */
108
+ componentsPerAttribute: {
109
+ get: function() {
110
+ return 3;
111
+ }
112
+ },
113
+ /**
114
+ * When <code>true</code> and <code>componentDatatype</code> is an integer format,
115
+ * indicate that the components should be mapped to the range [0, 1] (unsigned)
116
+ * or [-1, 1] (signed) when they are accessed as floating-point for rendering.
117
+ *
118
+ * @memberof OffsetGeometryInstanceAttribute.prototype
119
+ *
120
+ * @type {boolean}
121
+ * @readonly
122
+ *
123
+ * @default false
124
+ */
125
+ normalize: {
126
+ get: function() {
127
+ return false;
128
+ }
129
+ }
130
+ });
131
+ OffsetGeometryInstanceAttribute.fromCartesian3 = function(offset) {
132
+ Check_default.defined("offset", offset);
133
+ return new OffsetGeometryInstanceAttribute(offset.x, offset.y, offset.z);
134
+ };
135
+ OffsetGeometryInstanceAttribute.toValue = function(offset, result) {
136
+ Check_default.defined("offset", offset);
137
+ if (!defined_default(result)) {
138
+ result = new Float32Array([offset.x, offset.y, offset.z]);
139
+ }
140
+ result[0] = offset.x;
141
+ result[1] = offset.y;
142
+ result[2] = offset.z;
143
+ return result;
144
+ };
145
+ var OffsetGeometryInstanceAttribute_default = OffsetGeometryInstanceAttribute;
146
+
147
+ // packages/engine/Source/Scene/ColumbusWorlds.js
148
+ var ColumbusWorlds = {};
149
+ var worldWidthCartographic = new Cartographic_default();
150
+ var worldWidthCartesian = new Cartesian3_default();
151
+ var worldWidthCache = {
152
+ projection: void 0,
153
+ width: 0
154
+ };
155
+ ColumbusWorlds.getWorldWidth = function(projection) {
156
+ if (worldWidthCache.projection !== projection) {
157
+ const northeast = projection.project(
158
+ Rectangle_default.northeast(Rectangle_default.MAX_VALUE, worldWidthCartographic),
159
+ worldWidthCartesian
160
+ );
161
+ worldWidthCache.projection = projection;
162
+ worldWidthCache.width = Math.abs(northeast.x) * 2;
163
+ }
164
+ return worldWidthCache.width;
165
+ };
166
+ ColumbusWorlds.nearestWorldU = function(cameraU, u, projection) {
167
+ const worldWidth = ColumbusWorlds.getWorldWidth(projection);
168
+ return u + Math.round((cameraU - u) / worldWidth) * worldWidth;
169
+ };
170
+ var cameraOffsetDelta = new Cartesian3_default();
171
+ var cameraOffsetTranslation = new Matrix4_default();
172
+ ColumbusWorlds.applyCameraWorldOffset = function(camera, worldOffset) {
173
+ Cartesian3_default.fromElements(0, worldOffset, 0, cameraOffsetDelta);
174
+ Matrix4_default.fromTranslation(cameraOffsetDelta, cameraOffsetTranslation);
175
+ Matrix4_default.multiply(
176
+ camera._viewMatrix,
177
+ cameraOffsetTranslation,
178
+ camera._viewMatrix
179
+ );
180
+ Matrix4_default.inverseTransformation(camera._viewMatrix, camera._invViewMatrix);
181
+ camera._positionWC.y -= worldOffset;
182
+ };
183
+ ColumbusWorlds.translateCullingVolume = function(cullingVolume, worldOffset, result) {
184
+ const planes = cullingVolume.planes;
185
+ const resultPlanes = result.planes;
186
+ for (let i = 0; i < planes.length; ++i) {
187
+ const plane = planes[i];
188
+ let resultPlane = resultPlanes[i];
189
+ if (!defined_default(resultPlane)) {
190
+ resultPlane = resultPlanes[i] = new Cartesian4_default();
191
+ }
192
+ resultPlane.x = plane.x;
193
+ resultPlane.y = plane.y;
194
+ resultPlane.z = plane.z;
195
+ resultPlane.w = plane.w + plane.y * worldOffset;
196
+ }
197
+ return result;
198
+ };
199
+ var worldStripSphere = new BoundingSphere_default();
200
+ ColumbusWorlds.getVisibleWorldIndices = function(cameraU, worldWidth, cullingVolume, maxExtraWorlds, result) {
201
+ result.length = 0;
202
+ if (!(worldWidth > 0) || !Number.isFinite(cameraU)) {
203
+ return result;
204
+ }
205
+ const sphere = worldStripSphere;
206
+ sphere.center.x = 0;
207
+ sphere.center.z = 0;
208
+ sphere.radius = worldWidth * 0.75;
209
+ const centerWorld = Math.round(cameraU / worldWidth);
210
+ for (let i = -maxExtraWorlds; i <= maxExtraWorlds; ++i) {
211
+ const worldIndex = centerWorld + i;
212
+ if (worldIndex === 0) {
213
+ continue;
214
+ }
215
+ sphere.center.y = worldIndex * worldWidth;
216
+ if (cullingVolume.computeVisibility(sphere) === IntersectionTests_default.OUTSIDE) {
217
+ continue;
218
+ }
219
+ result.push(worldIndex);
220
+ }
221
+ return result;
222
+ };
223
+ var ColumbusWorlds_default = ColumbusWorlds;
224
+
225
+ // packages/engine/Source/Scene/PrimitivePipeline.js
226
+ function transformToWorldCoordinates(instances, primitiveModelMatrix, scene3DOnly) {
227
+ let toWorld = !scene3DOnly;
228
+ const length = instances.length;
229
+ let i;
230
+ if (!toWorld && length > 1) {
231
+ const modelMatrix = instances[0].modelMatrix;
232
+ for (i = 1; i < length; ++i) {
233
+ if (!Matrix4_default.equals(modelMatrix, instances[i].modelMatrix)) {
234
+ toWorld = true;
235
+ break;
236
+ }
237
+ }
238
+ }
239
+ if (toWorld) {
240
+ for (i = 0; i < length; ++i) {
241
+ if (defined_default(instances[i].geometry)) {
242
+ GeometryPipeline_default.transformToWorldCoordinates(instances[i]);
243
+ }
244
+ }
245
+ } else {
246
+ Matrix4_default.multiplyTransformation(
247
+ primitiveModelMatrix,
248
+ instances[0].modelMatrix,
249
+ primitiveModelMatrix
250
+ );
251
+ }
252
+ }
253
+ function addGeometryBatchId(geometry, batchId) {
254
+ const attributes = geometry.attributes;
255
+ const positionAttr = attributes.position;
256
+ const numberOfComponents = positionAttr.values.length / positionAttr.componentsPerAttribute;
257
+ attributes.batchId = new GeometryAttribute_default({
258
+ componentDatatype: ComponentDatatype_default.FLOAT,
259
+ componentsPerAttribute: 1,
260
+ values: new Float32Array(numberOfComponents)
261
+ });
262
+ const values = attributes.batchId.values;
263
+ for (let j = 0; j < numberOfComponents; ++j) {
264
+ values[j] = batchId;
265
+ }
266
+ }
267
+ function addBatchIds(instances) {
268
+ const length = instances.length;
269
+ for (let i = 0; i < length; ++i) {
270
+ const instance = instances[i];
271
+ if (defined_default(instance.geometry)) {
272
+ addGeometryBatchId(instance.geometry, i);
273
+ } else if (defined_default(instance.westHemisphereGeometry) && defined_default(instance.eastHemisphereGeometry)) {
274
+ addGeometryBatchId(instance.westHemisphereGeometry, i);
275
+ addGeometryBatchId(instance.eastHemisphereGeometry, i);
276
+ }
277
+ }
278
+ }
279
+ function liftPolyline2DToWorldCopy(geometry, projection) {
280
+ const attributes = geometry.attributes;
281
+ const position2D = attributes.position2D;
282
+ const prevPosition2D = attributes.prevPosition2D;
283
+ const nextPosition2D = attributes.nextPosition2D;
284
+ if (!defined_default(position2D) || !defined_default(prevPosition2D) || !defined_default(nextPosition2D)) {
285
+ return;
286
+ }
287
+ const worldWidth = ColumbusWorlds_default.getWorldWidth(projection);
288
+ const halfWorldWidth = worldWidth * 0.5;
289
+ const positions = position2D.values;
290
+ const vertexCount = positions.length / 3;
291
+ const lifts = new Float64Array(vertexCount);
292
+ let lift = 0;
293
+ let lifted = false;
294
+ for (let i = 1; i < vertexCount; ++i) {
295
+ const du = positions[i * 3] - (positions[(i - 1) * 3] + lift);
296
+ if (du > halfWorldWidth) {
297
+ lift -= worldWidth;
298
+ lifted = true;
299
+ } else if (du < -halfWorldWidth) {
300
+ lift += worldWidth;
301
+ lifted = true;
302
+ }
303
+ lifts[i] = lift;
304
+ }
305
+ if (!lifted) {
306
+ return;
307
+ }
308
+ const prevPositions = prevPosition2D.values;
309
+ const nextPositions = nextPosition2D.values;
310
+ for (let i = 0; i < vertexCount; ++i) {
311
+ const vertexLift = lifts[i];
312
+ if (vertexLift !== 0) {
313
+ positions[i * 3] += vertexLift;
314
+ prevPositions[i * 3] += vertexLift;
315
+ nextPositions[i * 3] += vertexLift;
316
+ }
317
+ }
318
+ }
319
+ function liftGroundPolyline2DToWorldCopy(geometry, projection) {
320
+ const attributes = geometry.attributes;
321
+ const startHiLo2D = attributes.startHiLo2D;
322
+ const position2D = attributes.position2D;
323
+ if (!defined_default(startHiLo2D) || !defined_default(position2D)) {
324
+ return;
325
+ }
326
+ const worldWidth = ColumbusWorlds_default.getWorldWidth(projection);
327
+ const halfWorldWidth = worldWidth * 0.5;
328
+ if (!(halfWorldWidth > 0)) {
329
+ return;
330
+ }
331
+ const starts = startHiLo2D.values;
332
+ const positions = position2D.values;
333
+ const count = Math.min(starts.length / 4, positions.length / 3);
334
+ for (let i = 0; i < count; ++i) {
335
+ const startU = starts[i * 4] + starts[i * 4 + 2];
336
+ const u = positions[i * 3];
337
+ const delta = startU - u;
338
+ if (delta > halfWorldWidth || delta < -halfWorldWidth) {
339
+ positions[i * 3] = u + Math.round(delta / worldWidth) * worldWidth;
340
+ }
341
+ }
342
+ }
343
+ function geometryPipeline(parameters) {
344
+ const instances = parameters.instances;
345
+ const projection = parameters.projection;
346
+ const uintIndexSupport = parameters.elementIndexUintSupported;
347
+ const scene3DOnly = parameters.scene3DOnly;
348
+ const columbusRepeatWorlds = parameters.columbusRepeatWorlds === true;
349
+ const vertexCacheOptimize = parameters.vertexCacheOptimize;
350
+ const compressVertices = parameters.compressVertices;
351
+ const modelMatrix = parameters.modelMatrix;
352
+ let i;
353
+ let geometry;
354
+ let primitiveType;
355
+ let length = instances.length;
356
+ for (i = 0; i < length; ++i) {
357
+ if (defined_default(instances[i].geometry)) {
358
+ primitiveType = instances[i].geometry.primitiveType;
359
+ break;
360
+ }
361
+ }
362
+ for (i = 1; i < length; ++i) {
363
+ if (defined_default(instances[i].geometry) && instances[i].geometry.primitiveType !== primitiveType) {
364
+ throw new DeveloperError_default(
365
+ "All instance geometries must have the same primitiveType."
366
+ );
367
+ }
368
+ }
369
+ transformToWorldCoordinates(instances, modelMatrix, scene3DOnly);
370
+ if (!scene3DOnly) {
371
+ for (i = 0; i < length; ++i) {
372
+ if (defined_default(instances[i].geometry)) {
373
+ GeometryPipeline_default.splitLongitude(instances[i]);
374
+ }
375
+ }
376
+ }
377
+ addBatchIds(instances);
378
+ if (vertexCacheOptimize) {
379
+ for (i = 0; i < length; ++i) {
380
+ const instance = instances[i];
381
+ if (defined_default(instance.geometry)) {
382
+ GeometryPipeline_default.reorderForPostVertexCache(instance.geometry);
383
+ GeometryPipeline_default.reorderForPreVertexCache(instance.geometry);
384
+ } else if (defined_default(instance.westHemisphereGeometry) && defined_default(instance.eastHemisphereGeometry)) {
385
+ GeometryPipeline_default.reorderForPostVertexCache(
386
+ instance.westHemisphereGeometry
387
+ );
388
+ GeometryPipeline_default.reorderForPreVertexCache(
389
+ instance.westHemisphereGeometry
390
+ );
391
+ GeometryPipeline_default.reorderForPostVertexCache(
392
+ instance.eastHemisphereGeometry
393
+ );
394
+ GeometryPipeline_default.reorderForPreVertexCache(
395
+ instance.eastHemisphereGeometry
396
+ );
397
+ }
398
+ }
399
+ }
400
+ let geometries = GeometryPipeline_default.combineInstances(instances);
401
+ length = geometries.length;
402
+ for (i = 0; i < length; ++i) {
403
+ geometry = geometries[i];
404
+ const attributes = geometry.attributes;
405
+ if (!scene3DOnly) {
406
+ const doubleAttributeNames = [];
407
+ for (const name in attributes) {
408
+ if (attributes.hasOwnProperty(name) && attributes[name].componentDatatype === ComponentDatatype_default.DOUBLE) {
409
+ doubleAttributeNames.push(name);
410
+ }
411
+ }
412
+ for (let a = 0; a < doubleAttributeNames.length; ++a) {
413
+ const name = doubleAttributeNames[a];
414
+ GeometryPipeline_default.projectTo2D(
415
+ geometry,
416
+ name,
417
+ `${name}3D`,
418
+ `${name}2D`,
419
+ projection
420
+ );
421
+ }
422
+ if (columbusRepeatWorlds) {
423
+ liftPolyline2DToWorldCopy(geometry, projection);
424
+ liftGroundPolyline2DToWorldCopy(geometry, projection);
425
+ }
426
+ if (defined_default(geometry.boundingSphere) && defined_default(attributes.position2D)) {
427
+ geometry.boundingSphereCV = BoundingSphere_default.fromVertices(
428
+ attributes.position2D.values
429
+ );
430
+ }
431
+ for (let a = 0; a < doubleAttributeNames.length; ++a) {
432
+ const name3D = `${doubleAttributeNames[a]}3D`;
433
+ const name2D = `${doubleAttributeNames[a]}2D`;
434
+ GeometryPipeline_default.encodeAttribute(
435
+ geometry,
436
+ name3D,
437
+ `${name3D}High`,
438
+ `${name3D}Low`
439
+ );
440
+ GeometryPipeline_default.encodeAttribute(
441
+ geometry,
442
+ name2D,
443
+ `${name2D}High`,
444
+ `${name2D}Low`
445
+ );
446
+ }
447
+ } else {
448
+ for (const name in attributes) {
449
+ if (attributes.hasOwnProperty(name) && attributes[name].componentDatatype === ComponentDatatype_default.DOUBLE) {
450
+ GeometryPipeline_default.encodeAttribute(
451
+ geometry,
452
+ name,
453
+ `${name}3DHigh`,
454
+ `${name}3DLow`
455
+ );
456
+ }
457
+ }
458
+ }
459
+ if (compressVertices) {
460
+ GeometryPipeline_default.compressVertices(geometry);
461
+ }
462
+ }
463
+ if (!uintIndexSupport) {
464
+ let splitGeometries = [];
465
+ length = geometries.length;
466
+ for (i = 0; i < length; ++i) {
467
+ geometry = geometries[i];
468
+ splitGeometries = splitGeometries.concat(
469
+ GeometryPipeline_default.fitToUnsignedShortIndices(geometry)
470
+ );
471
+ }
472
+ geometries = splitGeometries;
473
+ }
474
+ return geometries;
475
+ }
476
+ function createPickOffsets(instances, geometryName, geometries, pickOffsets) {
477
+ let offset;
478
+ let indexCount;
479
+ let geometryIndex;
480
+ const offsetIndex = pickOffsets.length - 1;
481
+ if (offsetIndex >= 0) {
482
+ const pickOffset = pickOffsets[offsetIndex];
483
+ offset = pickOffset.offset + pickOffset.count;
484
+ geometryIndex = pickOffset.index;
485
+ indexCount = geometries[geometryIndex].indices.length;
486
+ } else {
487
+ offset = 0;
488
+ geometryIndex = 0;
489
+ indexCount = geometries[geometryIndex].indices.length;
490
+ }
491
+ const length = instances.length;
492
+ for (let i = 0; i < length; ++i) {
493
+ const instance = instances[i];
494
+ const geometry = instance[geometryName];
495
+ if (!defined_default(geometry)) {
496
+ continue;
497
+ }
498
+ const count = geometry.indices.length;
499
+ if (offset + count > indexCount) {
500
+ offset = 0;
501
+ indexCount = geometries[++geometryIndex].indices.length;
502
+ }
503
+ pickOffsets.push({
504
+ index: geometryIndex,
505
+ offset,
506
+ count
507
+ });
508
+ offset += count;
509
+ }
510
+ }
511
+ function createInstancePickOffsets(instances, geometries) {
512
+ const pickOffsets = [];
513
+ createPickOffsets(instances, "geometry", geometries, pickOffsets);
514
+ createPickOffsets(
515
+ instances,
516
+ "westHemisphereGeometry",
517
+ geometries,
518
+ pickOffsets
519
+ );
520
+ createPickOffsets(
521
+ instances,
522
+ "eastHemisphereGeometry",
523
+ geometries,
524
+ pickOffsets
525
+ );
526
+ return pickOffsets;
527
+ }
528
+ var PrimitivePipeline = {};
529
+ PrimitivePipeline.combineGeometry = function(parameters) {
530
+ let geometries;
531
+ let attributeLocations;
532
+ const instances = parameters.instances;
533
+ const length = instances.length;
534
+ let pickOffsets;
535
+ let offsetInstanceExtend;
536
+ let hasOffset = false;
537
+ if (length > 0) {
538
+ geometries = geometryPipeline(parameters);
539
+ if (geometries.length > 0) {
540
+ attributeLocations = GeometryPipeline_default.createAttributeLocations(
541
+ geometries[0]
542
+ );
543
+ if (parameters.createPickOffsets) {
544
+ pickOffsets = createInstancePickOffsets(instances, geometries);
545
+ }
546
+ }
547
+ if (defined_default(instances[0].attributes) && defined_default(instances[0].attributes.offset)) {
548
+ offsetInstanceExtend = new Array(length);
549
+ hasOffset = true;
550
+ }
551
+ }
552
+ const boundingSpheres = new Array(length);
553
+ const boundingSpheresCV = new Array(length);
554
+ for (let i = 0; i < length; ++i) {
555
+ const instance = instances[i];
556
+ const geometry = instance.geometry;
557
+ if (defined_default(geometry)) {
558
+ boundingSpheres[i] = geometry.boundingSphere;
559
+ boundingSpheresCV[i] = geometry.boundingSphereCV;
560
+ if (hasOffset) {
561
+ offsetInstanceExtend[i] = instance.geometry.offsetAttribute;
562
+ }
563
+ }
564
+ const eastHemisphereGeometry = instance.eastHemisphereGeometry;
565
+ const westHemisphereGeometry = instance.westHemisphereGeometry;
566
+ if (defined_default(eastHemisphereGeometry) && defined_default(westHemisphereGeometry)) {
567
+ if (defined_default(eastHemisphereGeometry.boundingSphere) && defined_default(westHemisphereGeometry.boundingSphere)) {
568
+ boundingSpheres[i] = BoundingSphere_default.union(
569
+ eastHemisphereGeometry.boundingSphere,
570
+ westHemisphereGeometry.boundingSphere
571
+ );
572
+ }
573
+ if (defined_default(eastHemisphereGeometry.boundingSphereCV) && defined_default(westHemisphereGeometry.boundingSphereCV)) {
574
+ boundingSpheresCV[i] = BoundingSphere_default.union(
575
+ eastHemisphereGeometry.boundingSphereCV,
576
+ westHemisphereGeometry.boundingSphereCV
577
+ );
578
+ }
579
+ }
580
+ }
581
+ return {
582
+ geometries,
583
+ modelMatrix: parameters.modelMatrix,
584
+ attributeLocations,
585
+ pickOffsets,
586
+ offsetInstanceExtend,
587
+ boundingSpheres,
588
+ boundingSpheresCV
589
+ };
590
+ };
591
+ function transferGeometry(geometry, transferableObjects) {
592
+ const attributes = geometry.attributes;
593
+ for (const name in attributes) {
594
+ if (attributes.hasOwnProperty(name)) {
595
+ const attribute = attributes[name];
596
+ if (defined_default(attribute) && defined_default(attribute.values)) {
597
+ transferableObjects.push(attribute.values.buffer);
598
+ }
599
+ }
600
+ }
601
+ if (defined_default(geometry.indices)) {
602
+ transferableObjects.push(geometry.indices.buffer);
603
+ }
604
+ }
605
+ function transferGeometries(geometries, transferableObjects) {
606
+ const length = geometries.length;
607
+ for (let i = 0; i < length; ++i) {
608
+ transferGeometry(geometries[i], transferableObjects);
609
+ }
610
+ }
611
+ function countCreateGeometryResults(items) {
612
+ let count = 1;
613
+ const length = items.length;
614
+ for (let i = 0; i < length; i++) {
615
+ const geometry = items[i];
616
+ ++count;
617
+ if (!defined_default(geometry)) {
618
+ continue;
619
+ }
620
+ const attributes = geometry.attributes;
621
+ count += 7 + 2 * BoundingSphere_default.packedLength + (defined_default(geometry.indices) ? geometry.indices.length : 0);
622
+ for (const property in attributes) {
623
+ if (attributes.hasOwnProperty(property) && defined_default(attributes[property])) {
624
+ const attribute = attributes[property];
625
+ count += 5 + attribute.values.length;
626
+ }
627
+ }
628
+ }
629
+ return count;
630
+ }
631
+ PrimitivePipeline.packCreateGeometryResults = function(items, transferableObjects) {
632
+ const packedData = new Float64Array(countCreateGeometryResults(items));
633
+ const stringTable = [];
634
+ const stringHash = {};
635
+ const length = items.length;
636
+ let count = 0;
637
+ packedData[count++] = length;
638
+ for (let i = 0; i < length; i++) {
639
+ const geometry = items[i];
640
+ const validGeometry = defined_default(geometry);
641
+ packedData[count++] = validGeometry ? 1 : 0;
642
+ if (!validGeometry) {
643
+ continue;
644
+ }
645
+ packedData[count++] = geometry.primitiveType;
646
+ packedData[count++] = geometry.geometryType;
647
+ packedData[count++] = geometry.offsetAttribute ?? -1;
648
+ const validBoundingSphere = defined_default(geometry.boundingSphere) ? 1 : 0;
649
+ packedData[count++] = validBoundingSphere;
650
+ if (validBoundingSphere) {
651
+ BoundingSphere_default.pack(geometry.boundingSphere, packedData, count);
652
+ }
653
+ count += BoundingSphere_default.packedLength;
654
+ const validBoundingSphereCV = defined_default(geometry.boundingSphereCV) ? 1 : 0;
655
+ packedData[count++] = validBoundingSphereCV;
656
+ if (validBoundingSphereCV) {
657
+ BoundingSphere_default.pack(geometry.boundingSphereCV, packedData, count);
658
+ }
659
+ count += BoundingSphere_default.packedLength;
660
+ const attributes = geometry.attributes;
661
+ const attributesToWrite = [];
662
+ for (const property in attributes) {
663
+ if (attributes.hasOwnProperty(property) && defined_default(attributes[property])) {
664
+ attributesToWrite.push(property);
665
+ if (!defined_default(stringHash[property])) {
666
+ stringHash[property] = stringTable.length;
667
+ stringTable.push(property);
668
+ }
669
+ }
670
+ }
671
+ packedData[count++] = attributesToWrite.length;
672
+ for (let q = 0; q < attributesToWrite.length; q++) {
673
+ const name = attributesToWrite[q];
674
+ const attribute = attributes[name];
675
+ packedData[count++] = stringHash[name];
676
+ packedData[count++] = attribute.componentDatatype;
677
+ packedData[count++] = attribute.componentsPerAttribute;
678
+ packedData[count++] = attribute.normalize ? 1 : 0;
679
+ packedData[count++] = attribute.values.length;
680
+ packedData.set(attribute.values, count);
681
+ count += attribute.values.length;
682
+ }
683
+ const indicesLength = defined_default(geometry.indices) ? geometry.indices.length : 0;
684
+ packedData[count++] = indicesLength;
685
+ if (indicesLength > 0) {
686
+ packedData.set(geometry.indices, count);
687
+ count += indicesLength;
688
+ }
689
+ }
690
+ transferableObjects.push(packedData.buffer);
691
+ return {
692
+ stringTable,
693
+ packedData
694
+ };
695
+ };
696
+ PrimitivePipeline.unpackCreateGeometryResults = function(createGeometryResult) {
697
+ const stringTable = createGeometryResult.stringTable;
698
+ const packedGeometry = createGeometryResult.packedData;
699
+ let i;
700
+ const result = new Array(packedGeometry[0]);
701
+ let resultIndex = 0;
702
+ let packedGeometryIndex = 1;
703
+ while (packedGeometryIndex < packedGeometry.length) {
704
+ const valid = packedGeometry[packedGeometryIndex++] === 1;
705
+ if (!valid) {
706
+ result[resultIndex++] = void 0;
707
+ continue;
708
+ }
709
+ const primitiveType = packedGeometry[packedGeometryIndex++];
710
+ const geometryType = packedGeometry[packedGeometryIndex++];
711
+ let offsetAttribute = packedGeometry[packedGeometryIndex++];
712
+ if (offsetAttribute === -1) {
713
+ offsetAttribute = void 0;
714
+ }
715
+ let boundingSphere;
716
+ let boundingSphereCV;
717
+ const validBoundingSphere = packedGeometry[packedGeometryIndex++] === 1;
718
+ if (validBoundingSphere) {
719
+ boundingSphere = BoundingSphere_default.unpack(
720
+ packedGeometry,
721
+ packedGeometryIndex
722
+ );
723
+ }
724
+ packedGeometryIndex += BoundingSphere_default.packedLength;
725
+ const validBoundingSphereCV = packedGeometry[packedGeometryIndex++] === 1;
726
+ if (validBoundingSphereCV) {
727
+ boundingSphereCV = BoundingSphere_default.unpack(
728
+ packedGeometry,
729
+ packedGeometryIndex
730
+ );
731
+ }
732
+ packedGeometryIndex += BoundingSphere_default.packedLength;
733
+ let length;
734
+ let values;
735
+ let componentsPerAttribute;
736
+ const attributes = new GeometryAttributes_default();
737
+ const numAttributes = packedGeometry[packedGeometryIndex++];
738
+ for (i = 0; i < numAttributes; i++) {
739
+ const name = stringTable[packedGeometry[packedGeometryIndex++]];
740
+ const componentDatatype = packedGeometry[packedGeometryIndex++];
741
+ componentsPerAttribute = packedGeometry[packedGeometryIndex++];
742
+ const normalize = packedGeometry[packedGeometryIndex++] !== 0;
743
+ length = packedGeometry[packedGeometryIndex++];
744
+ values = ComponentDatatype_default.createTypedArray(componentDatatype, length);
745
+ for (let valuesIndex = 0; valuesIndex < length; valuesIndex++) {
746
+ values[valuesIndex] = packedGeometry[packedGeometryIndex++];
747
+ }
748
+ attributes[name] = new GeometryAttribute_default({
749
+ componentDatatype,
750
+ componentsPerAttribute,
751
+ normalize,
752
+ values
753
+ });
754
+ }
755
+ let indices;
756
+ length = packedGeometry[packedGeometryIndex++];
757
+ if (length > 0) {
758
+ const numberOfVertices = values.length / componentsPerAttribute;
759
+ indices = IndexDatatype_default.createTypedArray(numberOfVertices, length);
760
+ for (i = 0; i < length; i++) {
761
+ indices[i] = packedGeometry[packedGeometryIndex++];
762
+ }
763
+ }
764
+ result[resultIndex++] = new Geometry_default({
765
+ primitiveType,
766
+ geometryType,
767
+ boundingSphere,
768
+ boundingSphereCV,
769
+ indices,
770
+ attributes,
771
+ offsetAttribute
772
+ });
773
+ }
774
+ return result;
775
+ };
776
+ function packInstancesForCombine(instances, transferableObjects) {
777
+ const length = instances.length;
778
+ const packedData = new Float64Array(1 + length * 19);
779
+ let count = 0;
780
+ packedData[count++] = length;
781
+ for (let i = 0; i < length; i++) {
782
+ const instance = instances[i];
783
+ Matrix4_default.pack(instance.modelMatrix, packedData, count);
784
+ count += Matrix4_default.packedLength;
785
+ if (defined_default(instance.attributes) && defined_default(instance.attributes.offset)) {
786
+ const values = instance.attributes.offset.value;
787
+ packedData[count] = values[0];
788
+ packedData[count + 1] = values[1];
789
+ packedData[count + 2] = values[2];
790
+ }
791
+ count += 3;
792
+ }
793
+ transferableObjects.push(packedData.buffer);
794
+ return packedData;
795
+ }
796
+ function unpackInstancesForCombine(data) {
797
+ const packedInstances = data;
798
+ const result = new Array(packedInstances[0]);
799
+ let count = 0;
800
+ let i = 1;
801
+ while (i < packedInstances.length) {
802
+ const modelMatrix = Matrix4_default.unpack(packedInstances, i);
803
+ let attributes;
804
+ i += Matrix4_default.packedLength;
805
+ if (defined_default(packedInstances[i])) {
806
+ attributes = {
807
+ offset: new OffsetGeometryInstanceAttribute_default(
808
+ packedInstances[i],
809
+ packedInstances[i + 1],
810
+ packedInstances[i + 2]
811
+ )
812
+ };
813
+ }
814
+ i += 3;
815
+ result[count++] = {
816
+ modelMatrix,
817
+ attributes
818
+ };
819
+ }
820
+ return result;
821
+ }
822
+ PrimitivePipeline.packCombineGeometryParameters = function(parameters, transferableObjects) {
823
+ const createGeometryResults = parameters.createGeometryResults;
824
+ const length = createGeometryResults.length;
825
+ for (let i = 0; i < length; i++) {
826
+ transferableObjects.push(createGeometryResults[i].packedData.buffer);
827
+ }
828
+ return {
829
+ createGeometryResults: parameters.createGeometryResults,
830
+ packedInstances: packInstancesForCombine(
831
+ parameters.instances,
832
+ transferableObjects
833
+ ),
834
+ ellipsoid: parameters.ellipsoid,
835
+ isGeographic: parameters.projection instanceof GeographicProjection_default,
836
+ elementIndexUintSupported: parameters.elementIndexUintSupported,
837
+ scene3DOnly: parameters.scene3DOnly,
838
+ columbusRepeatWorlds: parameters.columbusRepeatWorlds === true,
839
+ vertexCacheOptimize: parameters.vertexCacheOptimize,
840
+ compressVertices: parameters.compressVertices,
841
+ modelMatrix: parameters.modelMatrix,
842
+ createPickOffsets: parameters.createPickOffsets
843
+ };
844
+ };
845
+ PrimitivePipeline.unpackCombineGeometryParameters = function(packedParameters) {
846
+ const instances = unpackInstancesForCombine(packedParameters.packedInstances);
847
+ const createGeometryResults = packedParameters.createGeometryResults;
848
+ const length = createGeometryResults.length;
849
+ let instanceIndex = 0;
850
+ for (let resultIndex = 0; resultIndex < length; resultIndex++) {
851
+ const geometries = PrimitivePipeline.unpackCreateGeometryResults(
852
+ createGeometryResults[resultIndex]
853
+ );
854
+ const geometriesLength = geometries.length;
855
+ for (let geometryIndex = 0; geometryIndex < geometriesLength; geometryIndex++) {
856
+ const geometry = geometries[geometryIndex];
857
+ const instance = instances[instanceIndex];
858
+ instance.geometry = geometry;
859
+ ++instanceIndex;
860
+ }
861
+ }
862
+ const ellipsoid = Ellipsoid_default.clone(packedParameters.ellipsoid);
863
+ const projection = packedParameters.isGeographic ? new GeographicProjection_default(ellipsoid) : new WebMercatorProjection_default(ellipsoid);
864
+ return {
865
+ instances,
866
+ ellipsoid,
867
+ projection,
868
+ elementIndexUintSupported: packedParameters.elementIndexUintSupported,
869
+ scene3DOnly: packedParameters.scene3DOnly,
870
+ columbusRepeatWorlds: packedParameters.columbusRepeatWorlds === true,
871
+ vertexCacheOptimize: packedParameters.vertexCacheOptimize,
872
+ compressVertices: packedParameters.compressVertices,
873
+ modelMatrix: Matrix4_default.clone(packedParameters.modelMatrix),
874
+ createPickOffsets: packedParameters.createPickOffsets
875
+ };
876
+ };
877
+ function packBoundingSpheres(boundingSpheres) {
878
+ const length = boundingSpheres.length;
879
+ const bufferLength = 1 + (BoundingSphere_default.packedLength + 1) * length;
880
+ const buffer = new Float32Array(bufferLength);
881
+ let bufferIndex = 0;
882
+ buffer[bufferIndex++] = length;
883
+ for (let i = 0; i < length; ++i) {
884
+ const bs = boundingSpheres[i];
885
+ if (!defined_default(bs)) {
886
+ buffer[bufferIndex++] = 0;
887
+ } else {
888
+ buffer[bufferIndex++] = 1;
889
+ BoundingSphere_default.pack(boundingSpheres[i], buffer, bufferIndex);
890
+ }
891
+ bufferIndex += BoundingSphere_default.packedLength;
892
+ }
893
+ return buffer;
894
+ }
895
+ function unpackBoundingSpheres(buffer) {
896
+ const result = new Array(buffer[0]);
897
+ let count = 0;
898
+ let i = 1;
899
+ while (i < buffer.length) {
900
+ if (buffer[i++] === 1) {
901
+ result[count] = BoundingSphere_default.unpack(buffer, i);
902
+ }
903
+ ++count;
904
+ i += BoundingSphere_default.packedLength;
905
+ }
906
+ return result;
907
+ }
908
+ PrimitivePipeline.packCombineGeometryResults = function(results, transferableObjects) {
909
+ if (defined_default(results.geometries)) {
910
+ transferGeometries(results.geometries, transferableObjects);
911
+ }
912
+ const packedBoundingSpheres = packBoundingSpheres(results.boundingSpheres);
913
+ const packedBoundingSpheresCV = packBoundingSpheres(
914
+ results.boundingSpheresCV
915
+ );
916
+ transferableObjects.push(
917
+ packedBoundingSpheres.buffer,
918
+ packedBoundingSpheresCV.buffer
919
+ );
920
+ return {
921
+ geometries: results.geometries,
922
+ attributeLocations: results.attributeLocations,
923
+ modelMatrix: results.modelMatrix,
924
+ pickOffsets: results.pickOffsets,
925
+ offsetInstanceExtend: results.offsetInstanceExtend,
926
+ boundingSpheres: packedBoundingSpheres,
927
+ boundingSpheresCV: packedBoundingSpheresCV
928
+ };
929
+ };
930
+ PrimitivePipeline.unpackCombineGeometryResults = function(packedResult) {
931
+ return {
932
+ geometries: packedResult.geometries,
933
+ attributeLocations: packedResult.attributeLocations,
934
+ modelMatrix: packedResult.modelMatrix,
935
+ pickOffsets: packedResult.pickOffsets,
936
+ offsetInstanceExtend: packedResult.offsetInstanceExtend,
937
+ boundingSpheres: unpackBoundingSpheres(packedResult.boundingSpheres),
938
+ boundingSpheresCV: unpackBoundingSpheres(packedResult.boundingSpheresCV)
939
+ };
940
+ };
941
+ var PrimitivePipeline_default = PrimitivePipeline;
942
+
943
+ export {
944
+ PrimitivePipeline_default
945
+ };