@cesium/engine 3.0.1 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (234) hide show
  1. package/Build/ThirdParty/Workers/pako_deflate.min.js +605 -0
  2. package/Build/ThirdParty/Workers/pako_inflate.min.js +800 -0
  3. package/Build/ThirdParty/Workers/z-worker-pako.js +502 -0
  4. package/Build/Workers/chunk-27R2KRIK.js +634 -0
  5. package/Build/Workers/chunk-2C65EKYA.js +55 -0
  6. package/Build/Workers/chunk-2NLMZNJI.js +138 -0
  7. package/Build/Workers/chunk-4V6RCTVH.js +289 -0
  8. package/Build/Workers/chunk-4VWUFKYW.js +368 -0
  9. package/Build/Workers/chunk-527JG4D7.js +629 -0
  10. package/Build/Workers/chunk-5U4UHRZ2.js +8644 -0
  11. package/Build/Workers/chunk-7CZEWQWE.js +353 -0
  12. package/Build/Workers/chunk-7IMAWM6A.js +842 -0
  13. package/Build/Workers/{package.js → chunk-A6EA6KIE.js} +13 -2
  14. package/Build/Workers/chunk-AXGQUPXA.js +1075 -0
  15. package/Build/Workers/chunk-BT6YIL2N.js +39 -0
  16. package/Build/Workers/chunk-C6MRR5YL.js +476 -0
  17. package/Build/Workers/chunk-DJUTBX6A.js +1860 -0
  18. package/Build/Workers/chunk-EQ6ZAP37.js +218 -0
  19. package/Build/Workers/chunk-F7P2HCYZ.js +73 -0
  20. package/Build/Workers/chunk-FE2XG3SS.js +73 -0
  21. package/Build/Workers/chunk-FKHRSGKP.js +781 -0
  22. package/Build/Workers/chunk-FVDTKX3F.js +58 -0
  23. package/Build/Workers/chunk-FYHCAKU6.js +684 -0
  24. package/Build/Workers/chunk-G3MOT7BZ.js +157 -0
  25. package/Build/Workers/chunk-H52L6U76.js +421 -0
  26. package/Build/Workers/chunk-H6MBQ4W4.js +305 -0
  27. package/Build/Workers/chunk-HCZR75II.js +2716 -0
  28. package/Build/Workers/chunk-I5MQWHBR.js +102 -0
  29. package/Build/Workers/chunk-KAFF2QX3.js +258 -0
  30. package/Build/Workers/chunk-LGSGX2RH.js +757 -0
  31. package/Build/Workers/chunk-LQRFWCNX.js +124 -0
  32. package/Build/Workers/chunk-N5MMDSD2.js +44 -0
  33. package/Build/Workers/chunk-NRETMGYL.js +390 -0
  34. package/Build/Workers/chunk-P4M4QUNQ.js +196 -0
  35. package/Build/Workers/chunk-P7PWX5HR.js +430 -0
  36. package/Build/Workers/chunk-PGB3EFR7.js +171 -0
  37. package/Build/Workers/chunk-PW5CA4MJ.js +3273 -0
  38. package/Build/Workers/chunk-PWDYKCNC.js +501 -0
  39. package/Build/Workers/chunk-QIS3NB7U.js +1258 -0
  40. package/Build/Workers/chunk-QVJ6IRKV.js +77 -0
  41. package/Build/Workers/chunk-RDCDRNJ7.js +117 -0
  42. package/Build/Workers/chunk-RDM3BKNC.js +1009 -0
  43. package/Build/Workers/chunk-RRUPTJ6P.js +452 -0
  44. package/Build/Workers/chunk-SGRWJKNO.js +400 -0
  45. package/Build/Workers/chunk-TF5D2H7B.js +138 -0
  46. package/Build/Workers/chunk-TVYIHH4V.js +513 -0
  47. package/Build/Workers/chunk-U5LKG6LX.js +101 -0
  48. package/Build/Workers/chunk-UGZGTV5K.js +302 -0
  49. package/Build/Workers/chunk-UN7AK64D.js +163 -0
  50. package/Build/Workers/chunk-V2LKNJGT.js +59 -0
  51. package/Build/Workers/chunk-VSCXSFHE.js +1477 -0
  52. package/Build/Workers/chunk-XJCTFTBM.js +2041 -0
  53. package/Build/Workers/chunk-XZVQMPWG.js +100 -0
  54. package/Build/Workers/chunk-YLAFWVOW.js +834 -0
  55. package/Build/Workers/chunk-YLS3FX3U.js +236 -0
  56. package/Build/Workers/chunk-YMJPANZZ.js +693 -0
  57. package/Build/Workers/combineGeometry.js +65 -15
  58. package/Build/Workers/createBoxGeometry.js +55 -10
  59. package/Build/Workers/createBoxOutlineGeometry.js +231 -310
  60. package/Build/Workers/createCircleGeometry.js +185 -202
  61. package/Build/Workers/createCircleOutlineGeometry.js +141 -155
  62. package/Build/Workers/createCoplanarPolygonGeometry.js +477 -557
  63. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +218 -230
  64. package/Build/Workers/createCorridorGeometry.js +1162 -1307
  65. package/Build/Workers/createCorridorOutlineGeometry.js +533 -569
  66. package/Build/Workers/createCylinderGeometry.js +57 -10
  67. package/Build/Workers/createCylinderOutlineGeometry.js +224 -258
  68. package/Build/Workers/createEllipseGeometry.js +68 -12
  69. package/Build/Workers/createEllipseOutlineGeometry.js +61 -12
  70. package/Build/Workers/createEllipsoidGeometry.js +56 -10
  71. package/Build/Workers/createEllipsoidOutlineGeometry.js +58 -13
  72. package/Build/Workers/createFrustumGeometry.js +55 -10
  73. package/Build/Workers/createFrustumOutlineGeometry.js +226 -243
  74. package/Build/Workers/createGeometry.js +143 -48
  75. package/Build/Workers/createGroundPolylineGeometry.js +1484 -2011
  76. package/Build/Workers/createPlaneGeometry.js +216 -243
  77. package/Build/Workers/createPlaneOutlineGeometry.js +121 -113
  78. package/Build/Workers/createPolygonGeometry.js +1041 -1327
  79. package/Build/Workers/createPolygonOutlineGeometry.js +516 -657
  80. package/Build/Workers/createPolylineGeometry.js +471 -547
  81. package/Build/Workers/createPolylineVolumeGeometry.js +352 -384
  82. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +271 -295
  83. package/Build/Workers/createRectangleGeometry.js +1128 -1331
  84. package/Build/Workers/createRectangleOutlineGeometry.js +445 -500
  85. package/Build/Workers/createSimplePolylineGeometry.js +381 -440
  86. package/Build/Workers/createSphereGeometry.js +112 -118
  87. package/Build/Workers/createSphereOutlineGeometry.js +112 -121
  88. package/Build/Workers/createTaskProcessorWorker.js +32 -127
  89. package/Build/Workers/createVectorTileClampedPolylines.js +462 -505
  90. package/Build/Workers/createVectorTileGeometries.js +377 -436
  91. package/Build/Workers/createVectorTilePoints.js +110 -77
  92. package/Build/Workers/createVectorTilePolygons.js +369 -391
  93. package/Build/Workers/createVectorTilePolylines.js +252 -244
  94. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +543 -615
  95. package/Build/Workers/createVerticesFromHeightmap.js +2244 -2677
  96. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +682 -904
  97. package/Build/Workers/createWallGeometry.js +459 -593
  98. package/Build/Workers/createWallOutlineGeometry.js +324 -419
  99. package/Build/Workers/decodeDraco.js +327 -347
  100. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +2530 -3567
  101. package/Build/Workers/decodeI3S.js +765 -970
  102. package/Build/Workers/transcodeKTX2.js +3353 -1464
  103. package/Build/Workers/transferTypedArrayTest.js +3 -4
  104. package/Build/Workers/upsampleQuantizedTerrainMesh.js +748 -953
  105. package/LICENSE.md +0 -12
  106. package/Source/Core/FeatureDetection.js +9 -0
  107. package/Source/Core/GoogleMaps.js +1 -1
  108. package/Source/Core/GroundPolylineGeometry.js +3 -2
  109. package/Source/Core/Ion.js +1 -1
  110. package/Source/Core/KTX2Transcoder.js +7 -3
  111. package/Source/Core/RequestScheduler.js +1 -0
  112. package/Source/Core/TaskProcessor.js +150 -146
  113. package/Source/Core/Transforms.js +2 -2
  114. package/Source/Core/buildModuleUrl.js +6 -5
  115. package/Source/DataSources/CzmlDataSource.js +6 -4
  116. package/Source/Scene/ArcGisMapService.js +1 -1
  117. package/Source/Scene/DracoLoader.js +26 -3
  118. package/Source/Scene/GltfLoaderUtil.js +1 -7
  119. package/Source/Scene/I3SDataProvider.js +0 -27
  120. package/Source/Scene/I3SDecoder.js +127 -0
  121. package/Source/Scene/I3SNode.js +32 -110
  122. package/Source/Scene/ImageryLayer.js +2 -2
  123. package/Source/Scene/Implicit3DTileContent.js +13 -0
  124. package/Source/Scene/ImplicitTileset.js +5 -0
  125. package/Source/Scene/Model/I3dmLoader.js +5 -1
  126. package/Source/Scene/Model/Model.js +4 -1
  127. package/Source/Scene/OpenStreetMapImageryProvider.js +7 -4
  128. package/Source/Scene/SingleTileImageryProvider.js +4 -2
  129. package/Source/ThirdParty/Workers/basis_transcoder.js +1 -1
  130. package/Source/{WorkersES6 → Workers}/createGeometry.js +11 -12
  131. package/Source/{WorkersES6 → Workers}/createTaskProcessorWorker.js +43 -59
  132. package/Source/{WorkersES6 → Workers}/decodeDraco.js +19 -25
  133. package/Source/{WorkersES6 → Workers}/decodeI3S.js +18 -32
  134. package/Source/{WorkersES6 → Workers}/transcodeKTX2.js +19 -26
  135. package/Source/Workers/transferTypedArrayTest.js +0 -6
  136. package/index.d.ts +20 -11
  137. package/index.js +170 -169
  138. package/package.json +3 -2
  139. package/Build/Workers/ArcType-2d9abbbc.js +0 -37
  140. package/Build/Workers/AttributeCompression-f9f6c717.js +0 -716
  141. package/Build/Workers/AxisAlignedBoundingBox-4bfd84f3.js +0 -258
  142. package/Build/Workers/BoundingRectangle-5fd6403a.js +0 -369
  143. package/Build/Workers/BoxGeometry-7aa4ce7f.js +0 -884
  144. package/Build/Workers/Check-6ede7e26.js +0 -290
  145. package/Build/Workers/Color-8e135f71.js +0 -2262
  146. package/Build/Workers/ComponentDatatype-cf1fa08e.js +0 -341
  147. package/Build/Workers/CoplanarPolygonGeometryLibrary-59c69b0a.js +0 -132
  148. package/Build/Workers/CorridorGeometryLibrary-63907365.js +0 -498
  149. package/Build/Workers/CylinderGeometry-8fc7c44b.js +0 -467
  150. package/Build/Workers/CylinderGeometryLibrary-7bf291b4.js +0 -63
  151. package/Build/Workers/EllipseGeometry-16b3736a.js +0 -1304
  152. package/Build/Workers/EllipseGeometryLibrary-21262a28.js +0 -366
  153. package/Build/Workers/EllipseOutlineGeometry-05d35d18.js +0 -443
  154. package/Build/Workers/EllipsoidGeodesic-5b3623dc.js +0 -520
  155. package/Build/Workers/EllipsoidGeometry-a503d1d6.js +0 -637
  156. package/Build/Workers/EllipsoidOutlineGeometry-7b09f24d.js +0 -454
  157. package/Build/Workers/EllipsoidRhumbLine-ef872433.js +0 -741
  158. package/Build/Workers/EllipsoidTangentPlane-546c0d5e.js +0 -373
  159. package/Build/Workers/EncodedCartesian3-57415c8a.js +0 -171
  160. package/Build/Workers/FrustumGeometry-87ce8622.js +0 -2540
  161. package/Build/Workers/GeometryAttribute-8fcff0d5.js +0 -619
  162. package/Build/Workers/GeometryAttributes-ad136444.js +0 -91
  163. package/Build/Workers/GeometryInstance-34d9e21e.js +0 -121
  164. package/Build/Workers/GeometryOffsetAttribute-9ad0019c.js +0 -16
  165. package/Build/Workers/GeometryPipeline-70d69a43.js +0 -3690
  166. package/Build/Workers/IndexDatatype-2643aa47.js +0 -200
  167. package/Build/Workers/IntersectionTests-85350792.js +0 -1836
  168. package/Build/Workers/Math-0a2ac845.js +0 -1340
  169. package/Build/Workers/Matrix2-e1298525.js +0 -7086
  170. package/Build/Workers/Matrix3-41c58dde.js +0 -4283
  171. package/Build/Workers/OrientedBoundingBox-29fb0fcd.js +0 -1259
  172. package/Build/Workers/Plane-4c3d403b.js +0 -309
  173. package/Build/Workers/PolygonGeometryLibrary-bad6329a.js +0 -1074
  174. package/Build/Workers/PolygonPipeline-dd13ee78.js +0 -1344
  175. package/Build/Workers/PolylinePipeline-7119eb3f.js +0 -573
  176. package/Build/Workers/PolylineVolumeGeometryLibrary-d25f0050.js +0 -781
  177. package/Build/Workers/PrimitivePipeline-111ee29f.js +0 -966
  178. package/Build/Workers/RectangleGeometryLibrary-bb378fb6.js +0 -280
  179. package/Build/Workers/RuntimeError-ef395448.js +0 -68
  180. package/Build/Workers/TerrainEncoding-c8e029a2.js +0 -1227
  181. package/Build/Workers/Transforms-e2d4a55a.js +0 -14713
  182. package/Build/Workers/VertexFormat-030f11ff.js +0 -312
  183. package/Build/Workers/WallGeometryLibrary-3e0819ec.js +0 -211
  184. package/Build/Workers/WebGLConstants-0b1ce7ba.js +0 -620
  185. package/Build/Workers/WebMercatorProjection-13ed1a6e.js +0 -151
  186. package/Build/Workers/arrayRemoveDuplicates-d2061e85.js +0 -129
  187. package/Build/Workers/cesiumWorkerBootstrapper.js +0 -1363
  188. package/Build/Workers/combine-d9581036.js +0 -82
  189. package/Build/Workers/defaultValue-fe22d8c0.js +0 -51
  190. package/Source/ThirdParty/Workers/draco_decoder_nodejs.js +0 -117
  191. package/Source/Workers/cesiumWorkerBootstrapper.js +0 -2290
  192. package/Source/Workers/package.json +0 -1
  193. /package/Source/{WorkersES6 → Workers}/combineGeometry.js +0 -0
  194. /package/Source/{WorkersES6 → Workers}/createBoxGeometry.js +0 -0
  195. /package/Source/{WorkersES6 → Workers}/createBoxOutlineGeometry.js +0 -0
  196. /package/Source/{WorkersES6 → Workers}/createCircleGeometry.js +0 -0
  197. /package/Source/{WorkersES6 → Workers}/createCircleOutlineGeometry.js +0 -0
  198. /package/Source/{WorkersES6 → Workers}/createCoplanarPolygonGeometry.js +0 -0
  199. /package/Source/{WorkersES6 → Workers}/createCoplanarPolygonOutlineGeometry.js +0 -0
  200. /package/Source/{WorkersES6 → Workers}/createCorridorGeometry.js +0 -0
  201. /package/Source/{WorkersES6 → Workers}/createCorridorOutlineGeometry.js +0 -0
  202. /package/Source/{WorkersES6 → Workers}/createCylinderGeometry.js +0 -0
  203. /package/Source/{WorkersES6 → Workers}/createCylinderOutlineGeometry.js +0 -0
  204. /package/Source/{WorkersES6 → Workers}/createEllipseGeometry.js +0 -0
  205. /package/Source/{WorkersES6 → Workers}/createEllipseOutlineGeometry.js +0 -0
  206. /package/Source/{WorkersES6 → Workers}/createEllipsoidGeometry.js +0 -0
  207. /package/Source/{WorkersES6 → Workers}/createEllipsoidOutlineGeometry.js +0 -0
  208. /package/Source/{WorkersES6 → Workers}/createFrustumGeometry.js +0 -0
  209. /package/Source/{WorkersES6 → Workers}/createFrustumOutlineGeometry.js +0 -0
  210. /package/Source/{WorkersES6 → Workers}/createGroundPolylineGeometry.js +0 -0
  211. /package/Source/{WorkersES6 → Workers}/createPlaneGeometry.js +0 -0
  212. /package/Source/{WorkersES6 → Workers}/createPlaneOutlineGeometry.js +0 -0
  213. /package/Source/{WorkersES6 → Workers}/createPolygonGeometry.js +0 -0
  214. /package/Source/{WorkersES6 → Workers}/createPolygonOutlineGeometry.js +0 -0
  215. /package/Source/{WorkersES6 → Workers}/createPolylineGeometry.js +0 -0
  216. /package/Source/{WorkersES6 → Workers}/createPolylineVolumeGeometry.js +0 -0
  217. /package/Source/{WorkersES6 → Workers}/createPolylineVolumeOutlineGeometry.js +0 -0
  218. /package/Source/{WorkersES6 → Workers}/createRectangleGeometry.js +0 -0
  219. /package/Source/{WorkersES6 → Workers}/createRectangleOutlineGeometry.js +0 -0
  220. /package/Source/{WorkersES6 → Workers}/createSimplePolylineGeometry.js +0 -0
  221. /package/Source/{WorkersES6 → Workers}/createSphereGeometry.js +0 -0
  222. /package/Source/{WorkersES6 → Workers}/createSphereOutlineGeometry.js +0 -0
  223. /package/Source/{WorkersES6 → Workers}/createVectorTileClampedPolylines.js +0 -0
  224. /package/Source/{WorkersES6 → Workers}/createVectorTileGeometries.js +0 -0
  225. /package/Source/{WorkersES6 → Workers}/createVectorTilePoints.js +0 -0
  226. /package/Source/{WorkersES6 → Workers}/createVectorTilePolygons.js +0 -0
  227. /package/Source/{WorkersES6 → Workers}/createVectorTilePolylines.js +0 -0
  228. /package/Source/{WorkersES6 → Workers}/createVerticesFromGoogleEarthEnterpriseBuffer.js +0 -0
  229. /package/Source/{WorkersES6 → Workers}/createVerticesFromHeightmap.js +0 -0
  230. /package/Source/{WorkersES6 → Workers}/createVerticesFromQuantizedTerrainMesh.js +0 -0
  231. /package/Source/{WorkersES6 → Workers}/createWallGeometry.js +0 -0
  232. /package/Source/{WorkersES6 → Workers}/createWallOutlineGeometry.js +0 -0
  233. /package/Source/{WorkersES6 → Workers}/decodeGoogleEarthEnterprisePacket.js +0 -0
  234. /package/Source/{WorkersES6 → Workers}/upsampleQuantizedTerrainMesh.js +0 -0
@@ -1,445 +1,386 @@
1
- define(['./Transforms-e2d4a55a', './BoxGeometry-7aa4ce7f', './Matrix3-41c58dde', './Color-8e135f71', './CylinderGeometry-8fc7c44b', './defaultValue-fe22d8c0', './EllipsoidGeometry-a503d1d6', './IndexDatatype-2643aa47', './Matrix2-e1298525', './createTaskProcessorWorker', './Check-6ede7e26', './Math-0a2ac845', './combine-d9581036', './RuntimeError-ef395448', './ComponentDatatype-cf1fa08e', './WebGLConstants-0b1ce7ba', './GeometryAttribute-8fcff0d5', './GeometryAttributes-ad136444', './GeometryOffsetAttribute-9ad0019c', './VertexFormat-030f11ff', './CylinderGeometryLibrary-7bf291b4'], (function (Transforms, BoxGeometry, Matrix3, Color, CylinderGeometry, defaultValue, EllipsoidGeometry, IndexDatatype, Matrix2, createTaskProcessorWorker, Check, Math$1, combine, RuntimeError, ComponentDatatype, WebGLConstants, GeometryAttribute, GeometryAttributes, GeometryOffsetAttribute, VertexFormat, CylinderGeometryLibrary) { 'use strict';
2
-
3
- /**
4
- * Describes a renderable batch of geometry.
5
- *
6
- * @alias Vector3DTileBatch
7
- * @constructor
8
- *
9
- * @param {object} options An object with the following properties:
10
- * @param {number} options.offset The offset of the batch into the indices buffer.
11
- * @param {number} options.count The number of indices in the batch.
12
- * @param {Color} options.color The color of the geometry in the batch.
13
- * @param {number[]} options.batchIds An array where each element is the batch id of the geometry in the batch.
14
- *
15
- * @private
16
- */
17
- function Vector3DTileBatch(options) {
18
- /**
19
- * The offset of the batch into the indices buffer.
20
- * @type {number}
21
- */
22
- this.offset = options.offset;
23
- /**
24
- * The number of indices in the batch.
25
- * @type {number}
26
- */
27
- this.count = options.count;
28
- /**
29
- * The color of the geometry in the batch.
30
- * @type {Color}
31
- */
32
- this.color = options.color;
33
- /**
34
- * An array where each element is the batch id of the geometry in the batch.
35
- * @type {number[]}
36
- */
37
- this.batchIds = options.batchIds;
38
- }
39
-
40
- const scratchCartesian = new Matrix3.Cartesian3();
41
-
42
- const packedBoxLength = Matrix2.Matrix4.packedLength + Matrix3.Cartesian3.packedLength;
43
- const packedCylinderLength = Matrix2.Matrix4.packedLength + 2;
44
- const packedEllipsoidLength = Matrix2.Matrix4.packedLength + Matrix3.Cartesian3.packedLength;
45
- const packedSphereLength = Matrix3.Cartesian3.packedLength + 1;
46
-
47
- const scratchModelMatrixAndBV = {
48
- modelMatrix: new Matrix2.Matrix4(),
49
- boundingVolume: new Transforms.BoundingSphere(),
50
- };
51
-
52
- function boxModelMatrixAndBoundingVolume(boxes, index) {
53
- let boxIndex = index * packedBoxLength;
54
-
55
- const dimensions = Matrix3.Cartesian3.unpack(boxes, boxIndex, scratchCartesian);
56
- boxIndex += Matrix3.Cartesian3.packedLength;
57
-
58
- const boxModelMatrix = Matrix2.Matrix4.unpack(
59
- boxes,
60
- boxIndex,
61
- scratchModelMatrixAndBV.modelMatrix
62
- );
63
- Matrix2.Matrix4.multiplyByScale(boxModelMatrix, dimensions, boxModelMatrix);
64
-
65
- const boundingVolume = scratchModelMatrixAndBV.boundingVolume;
66
- Matrix3.Cartesian3.clone(Matrix3.Cartesian3.ZERO, boundingVolume.center);
67
- boundingVolume.radius = Math.sqrt(3.0);
68
-
69
- return scratchModelMatrixAndBV;
70
- }
71
-
72
- function cylinderModelMatrixAndBoundingVolume(cylinders, index) {
73
- let cylinderIndex = index * packedCylinderLength;
74
-
75
- const cylinderRadius = cylinders[cylinderIndex++];
76
- const length = cylinders[cylinderIndex++];
77
- const scale = Matrix3.Cartesian3.fromElements(
78
- cylinderRadius,
79
- cylinderRadius,
80
- length,
81
- scratchCartesian
82
- );
83
-
84
- const cylinderModelMatrix = Matrix2.Matrix4.unpack(
85
- cylinders,
86
- cylinderIndex,
87
- scratchModelMatrixAndBV.modelMatrix
88
- );
89
- Matrix2.Matrix4.multiplyByScale(cylinderModelMatrix, scale, cylinderModelMatrix);
90
-
91
- const boundingVolume = scratchModelMatrixAndBV.boundingVolume;
92
- Matrix3.Cartesian3.clone(Matrix3.Cartesian3.ZERO, boundingVolume.center);
93
- boundingVolume.radius = Math.sqrt(2.0);
94
-
95
- return scratchModelMatrixAndBV;
1
+ /**
2
+ * @license
3
+ * Cesium - https://github.com/CesiumGS/cesium
4
+ * Version 1.109
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
+ Color_default
28
+ } from "./chunk-27R2KRIK.js";
29
+ import {
30
+ CylinderGeometry_default
31
+ } from "./chunk-SGRWJKNO.js";
32
+ import "./chunk-F7P2HCYZ.js";
33
+ import {
34
+ EllipsoidGeometry_default
35
+ } from "./chunk-TVYIHH4V.js";
36
+ import {
37
+ createTaskProcessorWorker_default
38
+ } from "./chunk-U5LKG6LX.js";
39
+ import {
40
+ BoxGeometry_default
41
+ } from "./chunk-FYHCAKU6.js";
42
+ import "./chunk-A6EA6KIE.js";
43
+ import "./chunk-2NLMZNJI.js";
44
+ import {
45
+ IndexDatatype_default
46
+ } from "./chunk-TF5D2H7B.js";
47
+ import "./chunk-N5MMDSD2.js";
48
+ import "./chunk-UGZGTV5K.js";
49
+ import {
50
+ BoundingSphere_default
51
+ } from "./chunk-5U4UHRZ2.js";
52
+ import "./chunk-FE2XG3SS.js";
53
+ import {
54
+ Matrix4_default
55
+ } from "./chunk-PW5CA4MJ.js";
56
+ import "./chunk-KAFF2QX3.js";
57
+ import {
58
+ Cartesian3_default
59
+ } from "./chunk-XJCTFTBM.js";
60
+ import "./chunk-PWDYKCNC.js";
61
+ import "./chunk-527JG4D7.js";
62
+ import "./chunk-FVDTKX3F.js";
63
+ import "./chunk-BT6YIL2N.js";
64
+ import "./chunk-UN7AK64D.js";
65
+ import {
66
+ defined_default
67
+ } from "./chunk-QVJ6IRKV.js";
68
+
69
+ // packages/engine/Source/Scene/Vector3DTileBatch.js
70
+ function Vector3DTileBatch(options) {
71
+ this.offset = options.offset;
72
+ this.count = options.count;
73
+ this.color = options.color;
74
+ this.batchIds = options.batchIds;
75
+ }
76
+ var Vector3DTileBatch_default = Vector3DTileBatch;
77
+
78
+ // packages/engine/Source/Workers/createVectorTileGeometries.js
79
+ var scratchCartesian = new Cartesian3_default();
80
+ var packedBoxLength = Matrix4_default.packedLength + Cartesian3_default.packedLength;
81
+ var packedCylinderLength = Matrix4_default.packedLength + 2;
82
+ var packedEllipsoidLength = Matrix4_default.packedLength + Cartesian3_default.packedLength;
83
+ var packedSphereLength = Cartesian3_default.packedLength + 1;
84
+ var scratchModelMatrixAndBV = {
85
+ modelMatrix: new Matrix4_default(),
86
+ boundingVolume: new BoundingSphere_default()
87
+ };
88
+ function boxModelMatrixAndBoundingVolume(boxes, index) {
89
+ let boxIndex = index * packedBoxLength;
90
+ const dimensions = Cartesian3_default.unpack(boxes, boxIndex, scratchCartesian);
91
+ boxIndex += Cartesian3_default.packedLength;
92
+ const boxModelMatrix = Matrix4_default.unpack(
93
+ boxes,
94
+ boxIndex,
95
+ scratchModelMatrixAndBV.modelMatrix
96
+ );
97
+ Matrix4_default.multiplyByScale(boxModelMatrix, dimensions, boxModelMatrix);
98
+ const boundingVolume = scratchModelMatrixAndBV.boundingVolume;
99
+ Cartesian3_default.clone(Cartesian3_default.ZERO, boundingVolume.center);
100
+ boundingVolume.radius = Math.sqrt(3);
101
+ return scratchModelMatrixAndBV;
102
+ }
103
+ function cylinderModelMatrixAndBoundingVolume(cylinders, index) {
104
+ let cylinderIndex = index * packedCylinderLength;
105
+ const cylinderRadius = cylinders[cylinderIndex++];
106
+ const length = cylinders[cylinderIndex++];
107
+ const scale = Cartesian3_default.fromElements(
108
+ cylinderRadius,
109
+ cylinderRadius,
110
+ length,
111
+ scratchCartesian
112
+ );
113
+ const cylinderModelMatrix = Matrix4_default.unpack(
114
+ cylinders,
115
+ cylinderIndex,
116
+ scratchModelMatrixAndBV.modelMatrix
117
+ );
118
+ Matrix4_default.multiplyByScale(cylinderModelMatrix, scale, cylinderModelMatrix);
119
+ const boundingVolume = scratchModelMatrixAndBV.boundingVolume;
120
+ Cartesian3_default.clone(Cartesian3_default.ZERO, boundingVolume.center);
121
+ boundingVolume.radius = Math.sqrt(2);
122
+ return scratchModelMatrixAndBV;
123
+ }
124
+ function ellipsoidModelMatrixAndBoundingVolume(ellipsoids, index) {
125
+ let ellipsoidIndex = index * packedEllipsoidLength;
126
+ const radii = Cartesian3_default.unpack(ellipsoids, ellipsoidIndex, scratchCartesian);
127
+ ellipsoidIndex += Cartesian3_default.packedLength;
128
+ const ellipsoidModelMatrix = Matrix4_default.unpack(
129
+ ellipsoids,
130
+ ellipsoidIndex,
131
+ scratchModelMatrixAndBV.modelMatrix
132
+ );
133
+ Matrix4_default.multiplyByScale(ellipsoidModelMatrix, radii, ellipsoidModelMatrix);
134
+ const boundingVolume = scratchModelMatrixAndBV.boundingVolume;
135
+ Cartesian3_default.clone(Cartesian3_default.ZERO, boundingVolume.center);
136
+ boundingVolume.radius = 1;
137
+ return scratchModelMatrixAndBV;
138
+ }
139
+ function sphereModelMatrixAndBoundingVolume(spheres, index) {
140
+ let sphereIndex = index * packedSphereLength;
141
+ const sphereRadius = spheres[sphereIndex++];
142
+ const sphereTranslation = Cartesian3_default.unpack(
143
+ spheres,
144
+ sphereIndex,
145
+ scratchCartesian
146
+ );
147
+ const sphereModelMatrix = Matrix4_default.fromTranslation(
148
+ sphereTranslation,
149
+ scratchModelMatrixAndBV.modelMatrix
150
+ );
151
+ Matrix4_default.multiplyByUniformScale(
152
+ sphereModelMatrix,
153
+ sphereRadius,
154
+ sphereModelMatrix
155
+ );
156
+ const boundingVolume = scratchModelMatrixAndBV.boundingVolume;
157
+ Cartesian3_default.clone(Cartesian3_default.ZERO, boundingVolume.center);
158
+ boundingVolume.radius = 1;
159
+ return scratchModelMatrixAndBV;
160
+ }
161
+ var scratchPosition = new Cartesian3_default();
162
+ function createPrimitive(options, primitive, primitiveBatchIds, geometry, getModelMatrixAndBoundingVolume) {
163
+ if (!defined_default(primitive)) {
164
+ return;
96
165
  }
97
-
98
- function ellipsoidModelMatrixAndBoundingVolume(ellipsoids, index) {
99
- let ellipsoidIndex = index * packedEllipsoidLength;
100
-
101
- const radii = Matrix3.Cartesian3.unpack(ellipsoids, ellipsoidIndex, scratchCartesian);
102
- ellipsoidIndex += Matrix3.Cartesian3.packedLength;
103
-
104
- const ellipsoidModelMatrix = Matrix2.Matrix4.unpack(
105
- ellipsoids,
106
- ellipsoidIndex,
107
- scratchModelMatrixAndBV.modelMatrix
166
+ const numberOfPrimitives = primitiveBatchIds.length;
167
+ const geometryPositions = geometry.attributes.position.values;
168
+ const geometryIndices = geometry.indices;
169
+ const positions = options.positions;
170
+ const vertexBatchIds = options.vertexBatchIds;
171
+ const indices = options.indices;
172
+ const batchIds = options.batchIds;
173
+ const batchTableColors = options.batchTableColors;
174
+ const batchedIndices = options.batchedIndices;
175
+ const indexOffsets = options.indexOffsets;
176
+ const indexCounts = options.indexCounts;
177
+ const boundingVolumes = options.boundingVolumes;
178
+ const modelMatrix = options.modelMatrix;
179
+ const center = options.center;
180
+ let positionOffset = options.positionOffset;
181
+ let batchIdIndex = options.batchIdIndex;
182
+ let indexOffset = options.indexOffset;
183
+ const batchedIndicesOffset = options.batchedIndicesOffset;
184
+ for (let i = 0; i < numberOfPrimitives; ++i) {
185
+ const primitiveModelMatrixAndBV = getModelMatrixAndBoundingVolume(
186
+ primitive,
187
+ i
108
188
  );
109
- Matrix2.Matrix4.multiplyByScale(ellipsoidModelMatrix, radii, ellipsoidModelMatrix);
110
-
111
- const boundingVolume = scratchModelMatrixAndBV.boundingVolume;
112
- Matrix3.Cartesian3.clone(Matrix3.Cartesian3.ZERO, boundingVolume.center);
113
- boundingVolume.radius = 1.0;
114
-
115
- return scratchModelMatrixAndBV;
116
- }
117
-
118
- function sphereModelMatrixAndBoundingVolume(spheres, index) {
119
- let sphereIndex = index * packedSphereLength;
120
-
121
- const sphereRadius = spheres[sphereIndex++];
122
-
123
- const sphereTranslation = Matrix3.Cartesian3.unpack(
124
- spheres,
125
- sphereIndex,
126
- scratchCartesian
127
- );
128
- const sphereModelMatrix = Matrix2.Matrix4.fromTranslation(
129
- sphereTranslation,
130
- scratchModelMatrixAndBV.modelMatrix
131
- );
132
- Matrix2.Matrix4.multiplyByUniformScale(
133
- sphereModelMatrix,
134
- sphereRadius,
135
- sphereModelMatrix
136
- );
137
-
138
- const boundingVolume = scratchModelMatrixAndBV.boundingVolume;
139
- Matrix3.Cartesian3.clone(Matrix3.Cartesian3.ZERO, boundingVolume.center);
140
- boundingVolume.radius = 1.0;
141
-
142
- return scratchModelMatrixAndBV;
143
- }
144
-
145
- const scratchPosition = new Matrix3.Cartesian3();
146
-
147
- function createPrimitive(
148
- options,
149
- primitive,
150
- primitiveBatchIds,
151
- geometry,
152
- getModelMatrixAndBoundingVolume
153
- ) {
154
- if (!defaultValue.defined(primitive)) {
155
- return;
189
+ const primitiveModelMatrix = primitiveModelMatrixAndBV.modelMatrix;
190
+ Matrix4_default.multiply(modelMatrix, primitiveModelMatrix, primitiveModelMatrix);
191
+ const batchId = primitiveBatchIds[i];
192
+ const positionsLength = geometryPositions.length;
193
+ for (let j = 0; j < positionsLength; j += 3) {
194
+ const position = Cartesian3_default.unpack(geometryPositions, j, scratchPosition);
195
+ Matrix4_default.multiplyByPoint(primitiveModelMatrix, position, position);
196
+ Cartesian3_default.subtract(position, center, position);
197
+ Cartesian3_default.pack(position, positions, positionOffset * 3 + j);
198
+ vertexBatchIds[batchIdIndex++] = batchId;
156
199
  }
157
-
158
- const numberOfPrimitives = primitiveBatchIds.length;
159
- const geometryPositions = geometry.attributes.position.values;
160
- const geometryIndices = geometry.indices;
161
-
162
- const positions = options.positions;
163
- const vertexBatchIds = options.vertexBatchIds;
164
- const indices = options.indices;
165
-
166
- const batchIds = options.batchIds;
167
- const batchTableColors = options.batchTableColors;
168
- const batchedIndices = options.batchedIndices;
169
- const indexOffsets = options.indexOffsets;
170
- const indexCounts = options.indexCounts;
171
- const boundingVolumes = options.boundingVolumes;
172
-
173
- const modelMatrix = options.modelMatrix;
174
- const center = options.center;
175
-
176
- let positionOffset = options.positionOffset;
177
- let batchIdIndex = options.batchIdIndex;
178
- let indexOffset = options.indexOffset;
179
- const batchedIndicesOffset = options.batchedIndicesOffset;
180
-
181
- for (let i = 0; i < numberOfPrimitives; ++i) {
182
- const primitiveModelMatrixAndBV = getModelMatrixAndBoundingVolume(
183
- primitive,
184
- i
185
- );
186
- const primitiveModelMatrix = primitiveModelMatrixAndBV.modelMatrix;
187
- Matrix2.Matrix4.multiply(modelMatrix, primitiveModelMatrix, primitiveModelMatrix);
188
-
189
- const batchId = primitiveBatchIds[i];
190
-
191
- const positionsLength = geometryPositions.length;
192
- for (let j = 0; j < positionsLength; j += 3) {
193
- const position = Matrix3.Cartesian3.unpack(geometryPositions, j, scratchPosition);
194
- Matrix2.Matrix4.multiplyByPoint(primitiveModelMatrix, position, position);
195
- Matrix3.Cartesian3.subtract(position, center, position);
196
-
197
- Matrix3.Cartesian3.pack(position, positions, positionOffset * 3 + j);
198
- vertexBatchIds[batchIdIndex++] = batchId;
199
- }
200
-
201
- const indicesLength = geometryIndices.length;
202
- for (let k = 0; k < indicesLength; ++k) {
203
- indices[indexOffset + k] = geometryIndices[k] + positionOffset;
204
- }
205
-
206
- const offset = i + batchedIndicesOffset;
207
- batchedIndices[offset] = new Vector3DTileBatch({
208
- offset: indexOffset,
209
- count: indicesLength,
210
- color: Color.Color.fromRgba(batchTableColors[batchId]),
211
- batchIds: [batchId],
212
- });
213
- batchIds[offset] = batchId;
214
- indexOffsets[offset] = indexOffset;
215
- indexCounts[offset] = indicesLength;
216
- boundingVolumes[offset] = Transforms.BoundingSphere.transform(
217
- primitiveModelMatrixAndBV.boundingVolume,
218
- primitiveModelMatrix
219
- );
220
-
221
- positionOffset += positionsLength / 3;
222
- indexOffset += indicesLength;
200
+ const indicesLength = geometryIndices.length;
201
+ for (let k = 0; k < indicesLength; ++k) {
202
+ indices[indexOffset + k] = geometryIndices[k] + positionOffset;
223
203
  }
224
-
225
- options.positionOffset = positionOffset;
226
- options.batchIdIndex = batchIdIndex;
227
- options.indexOffset = indexOffset;
228
- options.batchedIndicesOffset += numberOfPrimitives;
204
+ const offset = i + batchedIndicesOffset;
205
+ batchedIndices[offset] = new Vector3DTileBatch_default({
206
+ offset: indexOffset,
207
+ count: indicesLength,
208
+ color: Color_default.fromRgba(batchTableColors[batchId]),
209
+ batchIds: [batchId]
210
+ });
211
+ batchIds[offset] = batchId;
212
+ indexOffsets[offset] = indexOffset;
213
+ indexCounts[offset] = indicesLength;
214
+ boundingVolumes[offset] = BoundingSphere_default.transform(
215
+ primitiveModelMatrixAndBV.boundingVolume,
216
+ primitiveModelMatrix
217
+ );
218
+ positionOffset += positionsLength / 3;
219
+ indexOffset += indicesLength;
229
220
  }
230
-
231
- const scratchCenter = new Matrix3.Cartesian3();
232
- const scratchMatrix4 = new Matrix2.Matrix4();
233
-
234
- function unpackBuffer(buffer) {
235
- const packedBuffer = new Float64Array(buffer);
236
-
237
- let offset = 0;
238
- Matrix3.Cartesian3.unpack(packedBuffer, offset, scratchCenter);
239
- offset += Matrix3.Cartesian3.packedLength;
240
-
241
- Matrix2.Matrix4.unpack(packedBuffer, offset, scratchMatrix4);
221
+ options.positionOffset = positionOffset;
222
+ options.batchIdIndex = batchIdIndex;
223
+ options.indexOffset = indexOffset;
224
+ options.batchedIndicesOffset += numberOfPrimitives;
225
+ }
226
+ var scratchCenter = new Cartesian3_default();
227
+ var scratchMatrix4 = new Matrix4_default();
228
+ function unpackBuffer(buffer) {
229
+ const packedBuffer = new Float64Array(buffer);
230
+ let offset = 0;
231
+ Cartesian3_default.unpack(packedBuffer, offset, scratchCenter);
232
+ offset += Cartesian3_default.packedLength;
233
+ Matrix4_default.unpack(packedBuffer, offset, scratchMatrix4);
234
+ }
235
+ function packedBatchedIndicesLength(batchedIndices) {
236
+ const length = batchedIndices.length;
237
+ let count = 0;
238
+ for (let i = 0; i < length; ++i) {
239
+ count += Color_default.packedLength + 3 + batchedIndices[i].batchIds.length;
242
240
  }
243
-
244
- function packedBatchedIndicesLength(batchedIndices) {
245
- const length = batchedIndices.length;
246
- let count = 0;
247
- for (let i = 0; i < length; ++i) {
248
- count += Color.Color.packedLength + 3 + batchedIndices[i].batchIds.length;
249
- }
250
- return count;
241
+ return count;
242
+ }
243
+ function packBuffer(indicesBytesPerElement, batchedIndices, boundingVolumes) {
244
+ const numBVs = boundingVolumes.length;
245
+ const length = 1 + 1 + numBVs * BoundingSphere_default.packedLength + 1 + packedBatchedIndicesLength(batchedIndices);
246
+ const packedBuffer = new Float64Array(length);
247
+ let offset = 0;
248
+ packedBuffer[offset++] = indicesBytesPerElement;
249
+ packedBuffer[offset++] = numBVs;
250
+ for (let i = 0; i < numBVs; ++i) {
251
+ BoundingSphere_default.pack(boundingVolumes[i], packedBuffer, offset);
252
+ offset += BoundingSphere_default.packedLength;
251
253
  }
252
-
253
- function packBuffer(indicesBytesPerElement, batchedIndices, boundingVolumes) {
254
- const numBVs = boundingVolumes.length;
255
- const length =
256
- 1 +
257
- 1 +
258
- numBVs * Transforms.BoundingSphere.packedLength +
259
- 1 +
260
- packedBatchedIndicesLength(batchedIndices);
261
-
262
- const packedBuffer = new Float64Array(length);
263
-
264
- let offset = 0;
265
- packedBuffer[offset++] = indicesBytesPerElement;
266
- packedBuffer[offset++] = numBVs;
267
-
268
- for (let i = 0; i < numBVs; ++i) {
269
- Transforms.BoundingSphere.pack(boundingVolumes[i], packedBuffer, offset);
270
- offset += Transforms.BoundingSphere.packedLength;
254
+ const indicesLength = batchedIndices.length;
255
+ packedBuffer[offset++] = indicesLength;
256
+ for (let j = 0; j < indicesLength; ++j) {
257
+ const batchedIndex = batchedIndices[j];
258
+ Color_default.pack(batchedIndex.color, packedBuffer, offset);
259
+ offset += Color_default.packedLength;
260
+ packedBuffer[offset++] = batchedIndex.offset;
261
+ packedBuffer[offset++] = batchedIndex.count;
262
+ const batchIds = batchedIndex.batchIds;
263
+ const batchIdsLength = batchIds.length;
264
+ packedBuffer[offset++] = batchIdsLength;
265
+ for (let k = 0; k < batchIdsLength; ++k) {
266
+ packedBuffer[offset++] = batchIds[k];
271
267
  }
272
-
273
- const indicesLength = batchedIndices.length;
274
- packedBuffer[offset++] = indicesLength;
275
-
276
- for (let j = 0; j < indicesLength; ++j) {
277
- const batchedIndex = batchedIndices[j];
278
-
279
- Color.Color.pack(batchedIndex.color, packedBuffer, offset);
280
- offset += Color.Color.packedLength;
281
-
282
- packedBuffer[offset++] = batchedIndex.offset;
283
- packedBuffer[offset++] = batchedIndex.count;
284
-
285
- const batchIds = batchedIndex.batchIds;
286
- const batchIdsLength = batchIds.length;
287
- packedBuffer[offset++] = batchIdsLength;
288
-
289
- for (let k = 0; k < batchIdsLength; ++k) {
290
- packedBuffer[offset++] = batchIds[k];
291
- }
292
- }
293
-
294
- return packedBuffer;
295
- }
296
-
297
- function createVectorTileGeometries(parameters, transferableObjects) {
298
- const boxes = defaultValue.defined(parameters.boxes)
299
- ? new Float32Array(parameters.boxes)
300
- : undefined;
301
- const boxBatchIds = defaultValue.defined(parameters.boxBatchIds)
302
- ? new Uint16Array(parameters.boxBatchIds)
303
- : undefined;
304
- const cylinders = defaultValue.defined(parameters.cylinders)
305
- ? new Float32Array(parameters.cylinders)
306
- : undefined;
307
- const cylinderBatchIds = defaultValue.defined(parameters.cylinderBatchIds)
308
- ? new Uint16Array(parameters.cylinderBatchIds)
309
- : undefined;
310
- const ellipsoids = defaultValue.defined(parameters.ellipsoids)
311
- ? new Float32Array(parameters.ellipsoids)
312
- : undefined;
313
- const ellipsoidBatchIds = defaultValue.defined(parameters.ellipsoidBatchIds)
314
- ? new Uint16Array(parameters.ellipsoidBatchIds)
315
- : undefined;
316
- const spheres = defaultValue.defined(parameters.spheres)
317
- ? new Float32Array(parameters.spheres)
318
- : undefined;
319
- const sphereBatchIds = defaultValue.defined(parameters.sphereBatchIds)
320
- ? new Uint16Array(parameters.sphereBatchIds)
321
- : undefined;
322
-
323
- const numberOfBoxes = defaultValue.defined(boxes) ? boxBatchIds.length : 0;
324
- const numberOfCylinders = defaultValue.defined(cylinders) ? cylinderBatchIds.length : 0;
325
- const numberOfEllipsoids = defaultValue.defined(ellipsoids) ? ellipsoidBatchIds.length : 0;
326
- const numberOfSpheres = defaultValue.defined(spheres) ? sphereBatchIds.length : 0;
327
-
328
- const boxGeometry = BoxGeometry.BoxGeometry.getUnitBox();
329
- const cylinderGeometry = CylinderGeometry.CylinderGeometry.getUnitCylinder();
330
- const ellipsoidGeometry = EllipsoidGeometry.EllipsoidGeometry.getUnitEllipsoid();
331
-
332
- const boxPositions = boxGeometry.attributes.position.values;
333
- const cylinderPositions = cylinderGeometry.attributes.position.values;
334
- const ellipsoidPositions = ellipsoidGeometry.attributes.position.values;
335
-
336
- let numberOfPositions = boxPositions.length * numberOfBoxes;
337
- numberOfPositions += cylinderPositions.length * numberOfCylinders;
338
- numberOfPositions +=
339
- ellipsoidPositions.length * (numberOfEllipsoids + numberOfSpheres);
340
-
341
- const boxIndices = boxGeometry.indices;
342
- const cylinderIndices = cylinderGeometry.indices;
343
- const ellipsoidIndices = ellipsoidGeometry.indices;
344
-
345
- let numberOfIndices = boxIndices.length * numberOfBoxes;
346
- numberOfIndices += cylinderIndices.length * numberOfCylinders;
347
- numberOfIndices +=
348
- ellipsoidIndices.length * (numberOfEllipsoids + numberOfSpheres);
349
-
350
- const positions = new Float32Array(numberOfPositions);
351
- const vertexBatchIds = new Uint16Array(numberOfPositions / 3);
352
- const indices = IndexDatatype.IndexDatatype.createTypedArray(
353
- numberOfPositions / 3,
354
- numberOfIndices
355
- );
356
-
357
- const numberOfGeometries =
358
- numberOfBoxes + numberOfCylinders + numberOfEllipsoids + numberOfSpheres;
359
- const batchIds = new Uint16Array(numberOfGeometries);
360
- const batchedIndices = new Array(numberOfGeometries);
361
- const indexOffsets = new Uint32Array(numberOfGeometries);
362
- const indexCounts = new Uint32Array(numberOfGeometries);
363
- const boundingVolumes = new Array(numberOfGeometries);
364
-
365
- unpackBuffer(parameters.packedBuffer);
366
-
367
- const options = {
368
- batchTableColors: new Uint32Array(parameters.batchTableColors),
369
- positions: positions,
370
- vertexBatchIds: vertexBatchIds,
371
- indices: indices,
372
- batchIds: batchIds,
373
- batchedIndices: batchedIndices,
374
- indexOffsets: indexOffsets,
375
- indexCounts: indexCounts,
376
- boundingVolumes: boundingVolumes,
377
- positionOffset: 0,
378
- batchIdIndex: 0,
379
- indexOffset: 0,
380
- batchedIndicesOffset: 0,
381
- modelMatrix: scratchMatrix4,
382
- center: scratchCenter,
383
- };
384
-
385
- createPrimitive(
386
- options,
387
- boxes,
388
- boxBatchIds,
389
- boxGeometry,
390
- boxModelMatrixAndBoundingVolume
391
- );
392
- createPrimitive(
393
- options,
394
- cylinders,
395
- cylinderBatchIds,
396
- cylinderGeometry,
397
- cylinderModelMatrixAndBoundingVolume
398
- );
399
- createPrimitive(
400
- options,
401
- ellipsoids,
402
- ellipsoidBatchIds,
403
- ellipsoidGeometry,
404
- ellipsoidModelMatrixAndBoundingVolume
405
- );
406
- createPrimitive(
407
- options,
408
- spheres,
409
- sphereBatchIds,
410
- ellipsoidGeometry,
411
- sphereModelMatrixAndBoundingVolume
412
- );
413
-
414
- const packedBuffer = packBuffer(
415
- indices.BYTES_PER_ELEMENT,
416
- batchedIndices,
417
- boundingVolumes
418
- );
419
- transferableObjects.push(
420
- positions.buffer,
421
- vertexBatchIds.buffer,
422
- indices.buffer
423
- );
424
- transferableObjects.push(
425
- batchIds.buffer,
426
- indexOffsets.buffer,
427
- indexCounts.buffer
428
- );
429
- transferableObjects.push(packedBuffer.buffer);
430
-
431
- return {
432
- positions: positions.buffer,
433
- vertexBatchIds: vertexBatchIds.buffer,
434
- indices: indices.buffer,
435
- indexOffsets: indexOffsets.buffer,
436
- indexCounts: indexCounts.buffer,
437
- batchIds: batchIds.buffer,
438
- packedBuffer: packedBuffer.buffer,
439
- };
440
268
  }
441
- var createVectorTileGeometries$1 = createTaskProcessorWorker(createVectorTileGeometries);
442
-
443
- return createVectorTileGeometries$1;
444
-
445
- }));
269
+ return packedBuffer;
270
+ }
271
+ function createVectorTileGeometries(parameters, transferableObjects) {
272
+ const boxes = defined_default(parameters.boxes) ? new Float32Array(parameters.boxes) : void 0;
273
+ const boxBatchIds = defined_default(parameters.boxBatchIds) ? new Uint16Array(parameters.boxBatchIds) : void 0;
274
+ const cylinders = defined_default(parameters.cylinders) ? new Float32Array(parameters.cylinders) : void 0;
275
+ const cylinderBatchIds = defined_default(parameters.cylinderBatchIds) ? new Uint16Array(parameters.cylinderBatchIds) : void 0;
276
+ const ellipsoids = defined_default(parameters.ellipsoids) ? new Float32Array(parameters.ellipsoids) : void 0;
277
+ const ellipsoidBatchIds = defined_default(parameters.ellipsoidBatchIds) ? new Uint16Array(parameters.ellipsoidBatchIds) : void 0;
278
+ const spheres = defined_default(parameters.spheres) ? new Float32Array(parameters.spheres) : void 0;
279
+ const sphereBatchIds = defined_default(parameters.sphereBatchIds) ? new Uint16Array(parameters.sphereBatchIds) : void 0;
280
+ const numberOfBoxes = defined_default(boxes) ? boxBatchIds.length : 0;
281
+ const numberOfCylinders = defined_default(cylinders) ? cylinderBatchIds.length : 0;
282
+ const numberOfEllipsoids = defined_default(ellipsoids) ? ellipsoidBatchIds.length : 0;
283
+ const numberOfSpheres = defined_default(spheres) ? sphereBatchIds.length : 0;
284
+ const boxGeometry = BoxGeometry_default.getUnitBox();
285
+ const cylinderGeometry = CylinderGeometry_default.getUnitCylinder();
286
+ const ellipsoidGeometry = EllipsoidGeometry_default.getUnitEllipsoid();
287
+ const boxPositions = boxGeometry.attributes.position.values;
288
+ const cylinderPositions = cylinderGeometry.attributes.position.values;
289
+ const ellipsoidPositions = ellipsoidGeometry.attributes.position.values;
290
+ let numberOfPositions = boxPositions.length * numberOfBoxes;
291
+ numberOfPositions += cylinderPositions.length * numberOfCylinders;
292
+ numberOfPositions += ellipsoidPositions.length * (numberOfEllipsoids + numberOfSpheres);
293
+ const boxIndices = boxGeometry.indices;
294
+ const cylinderIndices = cylinderGeometry.indices;
295
+ const ellipsoidIndices = ellipsoidGeometry.indices;
296
+ let numberOfIndices = boxIndices.length * numberOfBoxes;
297
+ numberOfIndices += cylinderIndices.length * numberOfCylinders;
298
+ numberOfIndices += ellipsoidIndices.length * (numberOfEllipsoids + numberOfSpheres);
299
+ const positions = new Float32Array(numberOfPositions);
300
+ const vertexBatchIds = new Uint16Array(numberOfPositions / 3);
301
+ const indices = IndexDatatype_default.createTypedArray(
302
+ numberOfPositions / 3,
303
+ numberOfIndices
304
+ );
305
+ const numberOfGeometries = numberOfBoxes + numberOfCylinders + numberOfEllipsoids + numberOfSpheres;
306
+ const batchIds = new Uint16Array(numberOfGeometries);
307
+ const batchedIndices = new Array(numberOfGeometries);
308
+ const indexOffsets = new Uint32Array(numberOfGeometries);
309
+ const indexCounts = new Uint32Array(numberOfGeometries);
310
+ const boundingVolumes = new Array(numberOfGeometries);
311
+ unpackBuffer(parameters.packedBuffer);
312
+ const options = {
313
+ batchTableColors: new Uint32Array(parameters.batchTableColors),
314
+ positions,
315
+ vertexBatchIds,
316
+ indices,
317
+ batchIds,
318
+ batchedIndices,
319
+ indexOffsets,
320
+ indexCounts,
321
+ boundingVolumes,
322
+ positionOffset: 0,
323
+ batchIdIndex: 0,
324
+ indexOffset: 0,
325
+ batchedIndicesOffset: 0,
326
+ modelMatrix: scratchMatrix4,
327
+ center: scratchCenter
328
+ };
329
+ createPrimitive(
330
+ options,
331
+ boxes,
332
+ boxBatchIds,
333
+ boxGeometry,
334
+ boxModelMatrixAndBoundingVolume
335
+ );
336
+ createPrimitive(
337
+ options,
338
+ cylinders,
339
+ cylinderBatchIds,
340
+ cylinderGeometry,
341
+ cylinderModelMatrixAndBoundingVolume
342
+ );
343
+ createPrimitive(
344
+ options,
345
+ ellipsoids,
346
+ ellipsoidBatchIds,
347
+ ellipsoidGeometry,
348
+ ellipsoidModelMatrixAndBoundingVolume
349
+ );
350
+ createPrimitive(
351
+ options,
352
+ spheres,
353
+ sphereBatchIds,
354
+ ellipsoidGeometry,
355
+ sphereModelMatrixAndBoundingVolume
356
+ );
357
+ const packedBuffer = packBuffer(
358
+ indices.BYTES_PER_ELEMENT,
359
+ batchedIndices,
360
+ boundingVolumes
361
+ );
362
+ transferableObjects.push(
363
+ positions.buffer,
364
+ vertexBatchIds.buffer,
365
+ indices.buffer
366
+ );
367
+ transferableObjects.push(
368
+ batchIds.buffer,
369
+ indexOffsets.buffer,
370
+ indexCounts.buffer
371
+ );
372
+ transferableObjects.push(packedBuffer.buffer);
373
+ return {
374
+ positions: positions.buffer,
375
+ vertexBatchIds: vertexBatchIds.buffer,
376
+ indices: indices.buffer,
377
+ indexOffsets: indexOffsets.buffer,
378
+ indexCounts: indexCounts.buffer,
379
+ batchIds: batchIds.buffer,
380
+ packedBuffer: packedBuffer.buffer
381
+ };
382
+ }
383
+ var createVectorTileGeometries_default = createTaskProcessorWorker_default(createVectorTileGeometries);
384
+ export {
385
+ createVectorTileGeometries_default as default
386
+ };