@cesium/engine 6.2.0 → 8.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 (268) hide show
  1. package/Build/ThirdParty/Workers/z-worker-pako.js +568 -407
  2. package/Build/Workers/{chunk-RH4N2ONY.js → chunk-23UFSGND.js} +7 -7
  3. package/Build/Workers/{chunk-HPP4JLNH.js → chunk-2A75IWRS.js} +7 -7
  4. package/Build/Workers/{chunk-5IRLXUTA.js → chunk-2FRVPMCS.js} +10 -10
  5. package/Build/Workers/{chunk-ZQRZBHYI.js → chunk-2FWRMUTY.js} +4 -4
  6. package/Build/Workers/{chunk-Z2SIPUKB.js → chunk-2UPKWTMJ.js} +6 -6
  7. package/Build/Workers/{chunk-434ZTTFX.js → chunk-34FXV7D7.js} +2 -2
  8. package/Build/Workers/{chunk-MW3CJYLX.js → chunk-3VAZEH7M.js} +2 -2
  9. package/Build/Workers/{chunk-HUPNRBWW.js → chunk-4DO5W5XZ.js} +6 -6
  10. package/Build/Workers/{chunk-PIXK6KHB.js → chunk-4H7PY4U5.js} +2 -2
  11. package/Build/Workers/{chunk-BP467WX3.js → chunk-5QULIR53.js} +4 -4
  12. package/Build/Workers/{chunk-R3HUGXBH.js → chunk-7TC63SJW.js} +8 -8
  13. package/Build/Workers/{chunk-SQVTYRZY.js → chunk-7ZFGPDJA.js} +4 -4
  14. package/Build/Workers/{chunk-TIXXVKUY.js → chunk-A5DWLWCY.js} +10 -10
  15. package/Build/Workers/{chunk-CWJQGBWT.js → chunk-BBWDMCVU.js} +1 -1
  16. package/Build/Workers/{chunk-4KP73B43.js → chunk-BG4UCVXN.js} +3 -3
  17. package/Build/Workers/{chunk-Y4OJ4B23.js → chunk-BIKA3NRA.js} +5 -5
  18. package/Build/Workers/{chunk-DR5XZ6K5.js → chunk-BROJAZRZ.js} +13 -13
  19. package/Build/Workers/{chunk-FWGNCYP6.js → chunk-DDUQAJ4P.js} +7 -7
  20. package/Build/Workers/{chunk-QRBRVGZC.js → chunk-EERJKOAF.js} +4 -4
  21. package/Build/Workers/{chunk-52VSIKEA.js → chunk-EG6PTBY2.js} +15 -15
  22. package/Build/Workers/{chunk-O43GWBSF.js → chunk-EHWHNOEX.js} +1 -1
  23. package/Build/Workers/{chunk-MN34FIF5.js → chunk-F3YA3Y2Z.js} +1 -1
  24. package/Build/Workers/{chunk-GF5TNNKP.js → chunk-F4HFJMGM.js} +6 -6
  25. package/Build/Workers/{chunk-HOT2SNXP.js → chunk-FJKNFAKQ.js} +133 -553
  26. package/Build/Workers/{chunk-TMPVBFJQ.js → chunk-FNIRWHJB.js} +10 -10
  27. package/Build/Workers/{chunk-DMCSY5BU.js → chunk-FZRIVR7Y.js} +5 -5
  28. package/Build/Workers/{chunk-Z4JUBRHP.js → chunk-G43QFN4Q.js} +6 -6
  29. package/Build/Workers/{chunk-HPH5HSFE.js → chunk-GATZHF3K.js} +2 -2
  30. package/Build/Workers/{chunk-CSIZ3BGT.js → chunk-GRC2ZTAF.js} +14 -14
  31. package/Build/Workers/{chunk-NE4JNU6H.js → chunk-HU6N6EXB.js} +10 -10
  32. package/Build/Workers/{chunk-GVL5I7TC.js → chunk-I46ZRR5W.js} +17 -17
  33. package/Build/Workers/{chunk-5GDBZTHX.js → chunk-JURN7NPV.js} +17 -17
  34. package/Build/Workers/{chunk-H5DUXHCV.js → chunk-KKCR2YOP.js} +11 -11
  35. package/Build/Workers/{chunk-LX6XV4DK.js → chunk-LPR3YNP2.js} +5 -5
  36. package/Build/Workers/{chunk-HFKSAB5K.js → chunk-M7ERACJJ.js} +13 -13
  37. package/Build/Workers/{chunk-BUZDZBUH.js → chunk-MDWEGWPA.js} +10 -10
  38. package/Build/Workers/{chunk-LGJUI2CE.js → chunk-OGXZVPPM.js} +9 -5
  39. package/Build/Workers/{chunk-PZ2WJWUG.js → chunk-PGSJK77E.js} +6 -6
  40. package/Build/Workers/{chunk-ARPTYYKS.js → chunk-PPH7OFP3.js} +5 -5
  41. package/Build/Workers/{chunk-R4OZKBXH.js → chunk-SH5USDPI.js} +6 -6
  42. package/Build/Workers/{chunk-SV7DDPAC.js → chunk-SOWMRMWA.js} +1 -1
  43. package/Build/Workers/{chunk-RIDPF7PO.js → chunk-STW2DGFI.js} +2 -2
  44. package/Build/Workers/{chunk-CDGHUKQ4.js → chunk-T3XIFPYR.js} +13 -13
  45. package/Build/Workers/chunk-TTUZP4BO.js +501 -0
  46. package/Build/Workers/{chunk-QTZQZY2C.js → chunk-UEXTBDBE.js} +34 -10
  47. package/Build/Workers/{chunk-XUTVA4K5.js → chunk-VOXYEYJT.js} +11 -11
  48. package/Build/Workers/{chunk-AXFRNOVC.js → chunk-X4356LRH.js} +12 -12
  49. package/Build/Workers/{chunk-5HLGKKG3.js → chunk-XGI5BXZY.js} +2 -2
  50. package/Build/Workers/{chunk-SNN7WOC2.js → chunk-Y2ME2IJV.js} +13 -13
  51. package/Build/Workers/{chunk-LGL4P5KL.js → chunk-Y5UQJLYE.js} +6 -6
  52. package/Build/Workers/{chunk-3PW6ZBN4.js → chunk-YJEBABKH.js} +7 -7
  53. package/Build/Workers/{chunk-YBKFS53K.js → chunk-YWTJ2B4B.js} +1 -1
  54. package/Build/Workers/{chunk-5SK36PU4.js → chunk-Z3TIFFGF.js} +7 -7
  55. package/Build/Workers/{chunk-JGG36SQV.js → chunk-ZT7KWISZ.js} +4 -4
  56. package/Build/Workers/combineGeometry.js +24 -23
  57. package/Build/Workers/createBoxGeometry.js +18 -17
  58. package/Build/Workers/createBoxOutlineGeometry.js +16 -15
  59. package/Build/Workers/createCircleGeometry.js +26 -25
  60. package/Build/Workers/createCircleOutlineGeometry.js +19 -18
  61. package/Build/Workers/createCoplanarPolygonGeometry.js +33 -32
  62. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +31 -30
  63. package/Build/Workers/createCorridorGeometry.js +29 -29
  64. package/Build/Workers/createCorridorOutlineGeometry.js +28 -28
  65. package/Build/Workers/createCylinderGeometry.js +20 -19
  66. package/Build/Workers/createCylinderOutlineGeometry.js +18 -17
  67. package/Build/Workers/createEllipseGeometry.js +26 -25
  68. package/Build/Workers/createEllipseOutlineGeometry.js +19 -18
  69. package/Build/Workers/createEllipsoidGeometry.js +19 -18
  70. package/Build/Workers/createEllipsoidOutlineGeometry.js +18 -17
  71. package/Build/Workers/createFrustumGeometry.js +18 -17
  72. package/Build/Workers/createFrustumOutlineGeometry.js +18 -17
  73. package/Build/Workers/createGeometry.js +54 -33
  74. package/Build/Workers/createGroundPolylineGeometry.js +22 -21
  75. package/Build/Workers/createPlaneGeometry.js +16 -15
  76. package/Build/Workers/createPlaneOutlineGeometry.js +15 -14
  77. package/Build/Workers/createPolygonGeometry.js +32 -166
  78. package/Build/Workers/createPolygonOutlineGeometry.js +30 -29
  79. package/Build/Workers/createPolylineGeometry.js +25 -24
  80. package/Build/Workers/createPolylineVolumeGeometry.js +32 -33
  81. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +27 -27
  82. package/Build/Workers/createRectangleGeometry.js +27 -26
  83. package/Build/Workers/createRectangleOutlineGeometry.js +20 -19
  84. package/Build/Workers/createSimplePolylineGeometry.js +23 -22
  85. package/Build/Workers/createSphereGeometry.js +19 -18
  86. package/Build/Workers/createSphereOutlineGeometry.js +18 -17
  87. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  88. package/Build/Workers/createVectorTileClampedPolylines.js +14 -14
  89. package/Build/Workers/createVectorTileGeometries.js +24 -23
  90. package/Build/Workers/createVectorTilePoints.js +12 -12
  91. package/Build/Workers/createVectorTilePolygons.js +22 -21
  92. package/Build/Workers/createVectorTilePolylines.js +14 -14
  93. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +22 -21
  94. package/Build/Workers/createVerticesFromHeightmap.js +22 -21
  95. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +19 -18
  96. package/Build/Workers/createWallGeometry.js +24 -23
  97. package/Build/Workers/createWallOutlineGeometry.js +23 -22
  98. package/Build/Workers/decodeDraco.js +11 -11
  99. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  100. package/Build/Workers/decodeI3S.js +601 -92
  101. package/Build/Workers/transcodeKTX2.js +7 -7
  102. package/Build/Workers/transferTypedArrayTest.js +1 -1
  103. package/Build/Workers/upsampleQuantizedTerrainMesh.js +22 -21
  104. package/LICENSE.md +1 -1
  105. package/Source/Assets/approximateTerrainHeights.json +1 -1
  106. package/Source/Core/Ellipsoid.js +6 -0
  107. package/Source/Core/GregorianDate.js +85 -0
  108. package/Source/Core/HeadingPitchRange.js +2 -2
  109. package/Source/Core/IntersectionTests.js +6 -3
  110. package/Source/Core/Ion.js +1 -1
  111. package/Source/Core/PixelFormat.js +5 -0
  112. package/Source/Core/PolygonGeometry.js +0 -169
  113. package/Source/Core/Resource.js +30 -69
  114. package/Source/Core/Transforms.js +30 -18
  115. package/Source/Core/createWorldBathymetryAsync.js +45 -0
  116. package/Source/Core/srgbToLinear.js +32 -0
  117. package/Source/DataSources/CzmlDataSource.js +51 -23
  118. package/Source/DataSources/DataSourceDisplay.js +27 -0
  119. package/Source/DataSources/EllipsoidGeometryUpdater.js +3 -4
  120. package/Source/DataSources/Entity.js +28 -7
  121. package/Source/DataSources/EntityCollection.js +1 -2
  122. package/Source/DataSources/GeometryUpdater.js +1 -2
  123. package/Source/DataSources/GeometryUpdaterSet.js +114 -0
  124. package/Source/DataSources/GeometryVisualizer.js +19 -83
  125. package/Source/DataSources/GroundGeometryUpdater.js +6 -3
  126. package/Source/DataSources/ModelVisualizer.js +19 -98
  127. package/Source/DataSources/PolygonGeometryUpdater.js +14 -2
  128. package/Source/DataSources/PolylineGeometryUpdater.js +9 -8
  129. package/Source/DataSources/TerrainOffsetProperty.js +15 -23
  130. package/Source/Renderer/AutomaticUniforms.js +121 -1
  131. package/Source/Renderer/Context.js +10 -0
  132. package/Source/Renderer/ContextLimits.js +2 -0
  133. package/Source/Renderer/UniformState.js +127 -0
  134. package/Source/Renderer/demodernizeShader.js +4 -1
  135. package/Source/Scene/ArcGisMapService.js +1 -1
  136. package/Source/Scene/Atmosphere.js +127 -0
  137. package/Source/Scene/Axis.js +12 -7
  138. package/Source/Scene/Billboard.js +29 -26
  139. package/Source/Scene/BillboardCollection.js +3 -3
  140. package/Source/Scene/Camera.js +47 -5
  141. package/Source/Scene/Cesium3DTile.js +1 -0
  142. package/Source/Scene/Cesium3DTileContent.js +14 -0
  143. package/Source/Scene/Cesium3DTileset.js +364 -45
  144. package/Source/Scene/Cesium3DTilesetBaseTraversal.js +2 -4
  145. package/Source/Scene/Cesium3DTilesetTraversal.js +4 -0
  146. package/Source/Scene/Composite3DTileContent.js +42 -0
  147. package/Source/Scene/DynamicAtmosphereLightingType.js +56 -0
  148. package/Source/Scene/Empty3DTileContent.js +4 -0
  149. package/Source/Scene/Fog.js +1 -0
  150. package/Source/Scene/FrameState.js +14 -1
  151. package/Source/Scene/Geometry3DTileContent.js +4 -0
  152. package/Source/Scene/Globe.js +3 -2
  153. package/Source/Scene/GlobeSurfaceTileProvider.js +3 -1
  154. package/Source/Scene/GlobeTranslucencyState.js +1 -1
  155. package/Source/Scene/GltfLoader.js +15 -5
  156. package/Source/Scene/GltfPipeline/updateVersion.js +69 -68
  157. package/Source/Scene/HeightReference.js +59 -2
  158. package/Source/Scene/I3SDataProvider.js +270 -53
  159. package/Source/Scene/I3SDecoder.js +8 -1
  160. package/Source/Scene/I3SFeature.js +2 -5
  161. package/Source/Scene/I3SField.js +136 -31
  162. package/Source/Scene/I3SGeometry.js +70 -2
  163. package/Source/Scene/I3SLayer.js +55 -10
  164. package/Source/Scene/I3SNode.js +175 -18
  165. package/Source/Scene/I3SStatistics.js +94 -0
  166. package/Source/Scene/I3SSublayer.js +176 -0
  167. package/Source/Scene/I3SSymbology.js +337 -0
  168. package/Source/Scene/Implicit3DTileContent.js +4 -0
  169. package/Source/Scene/KeyframeNode.js +1 -1
  170. package/Source/Scene/LabelCollection.js +2 -2
  171. package/Source/Scene/Model/AtmospherePipelineStage.js +59 -0
  172. package/Source/Scene/Model/B3dmLoader.js +4 -0
  173. package/Source/Scene/Model/FeatureIdPipelineStage.js +25 -2
  174. package/Source/Scene/Model/I3dmLoader.js +4 -0
  175. package/Source/Scene/Model/InstancingPipelineStage.js +24 -6
  176. package/Source/Scene/Model/MetadataPipelineStage.js +31 -3
  177. package/Source/Scene/Model/Model.js +82 -32
  178. package/Source/Scene/Model/Model3DTileContent.js +31 -0
  179. package/Source/Scene/Model/ModelAnimationChannel.js +16 -15
  180. package/Source/Scene/Model/ModelSceneGraph.js +6 -0
  181. package/Source/Scene/Model/pickModel.js +426 -0
  182. package/Source/Scene/Multiple3DTileContent.js +42 -0
  183. package/Source/Scene/PickFramebuffer.js +37 -2
  184. package/Source/Scene/Picking.js +113 -39
  185. package/Source/Scene/Primitive.js +6 -2
  186. package/Source/Scene/QuadtreePrimitive.js +1 -1
  187. package/Source/Scene/Scene.js +312 -46
  188. package/Source/Scene/ScreenSpaceCameraController.js +23 -13
  189. package/Source/Scene/SensorVolumePortionToDisplay.js +69 -0
  190. package/Source/Scene/SkyAtmosphere.js +5 -6
  191. package/Source/Scene/SpatialNode.js +12 -19
  192. package/Source/Scene/StructuralMetadata.js +1 -1
  193. package/Source/Scene/Terrain.js +49 -0
  194. package/Source/Scene/TileBoundingS2Cell.js +2 -2
  195. package/Source/Scene/Tileset3DTileContent.js +4 -0
  196. package/Source/Scene/Vector3DTileContent.js +4 -0
  197. package/Source/Scene/VoxelBoxShape.js +76 -0
  198. package/Source/Scene/VoxelCell.js +273 -0
  199. package/Source/Scene/VoxelCylinderShape.js +114 -43
  200. package/Source/Scene/VoxelEllipsoidShape.js +158 -116
  201. package/Source/Scene/VoxelPrimitive.js +3 -1
  202. package/Source/Scene/VoxelRenderResources.js +3 -0
  203. package/Source/Scene/VoxelShape.js +13 -0
  204. package/Source/Scene/VoxelTraversal.js +76 -54
  205. package/Source/Scene/buildVoxelDrawCommands.js +23 -0
  206. package/Source/Scene/createGooglePhotorealistic3DTileset.js +1 -0
  207. package/Source/Scene/processVoxelProperties.js +2 -0
  208. package/Source/Shaders/AtmosphereCommon.glsl +3 -11
  209. package/Source/Shaders/AtmosphereCommon.js +3 -11
  210. package/Source/Shaders/Builtin/CzmBuiltins.js +12 -0
  211. package/Source/Shaders/Builtin/Functions/applyHSBShift.glsl +32 -0
  212. package/Source/Shaders/Builtin/Functions/applyHSBShift.js +34 -0
  213. package/Source/Shaders/Builtin/Functions/approximateTanh.glsl +10 -0
  214. package/Source/Shaders/Builtin/Functions/approximateTanh.js +12 -0
  215. package/Source/Shaders/Builtin/Functions/computeAtmosphereColor.glsl +44 -0
  216. package/Source/Shaders/Builtin/Functions/computeAtmosphereColor.js +46 -0
  217. package/Source/Shaders/Builtin/Functions/computeGroundAtmosphereScattering.glsl +30 -0
  218. package/Source/Shaders/Builtin/Functions/computeGroundAtmosphereScattering.js +32 -0
  219. package/Source/Shaders/Builtin/Functions/computeScattering.glsl +150 -0
  220. package/Source/Shaders/Builtin/Functions/computeScattering.js +152 -0
  221. package/Source/Shaders/Builtin/Functions/getDynamicAtmosphereLightDirection.glsl +22 -0
  222. package/Source/Shaders/Builtin/Functions/getDynamicAtmosphereLightDirection.js +24 -0
  223. package/Source/Shaders/Builtin/Functions/translateRelativeToEye.glsl +5 -0
  224. package/Source/Shaders/Builtin/Functions/translateRelativeToEye.js +5 -0
  225. package/Source/Shaders/GlobeFS.glsl +16 -25
  226. package/Source/Shaders/GlobeFS.js +16 -25
  227. package/Source/Shaders/GlobeVS.glsl +1 -1
  228. package/Source/Shaders/GlobeVS.js +1 -1
  229. package/Source/Shaders/Model/AtmosphereStageFS.glsl +111 -0
  230. package/Source/Shaders/Model/AtmosphereStageFS.js +113 -0
  231. package/Source/Shaders/Model/AtmosphereStageVS.glsl +12 -0
  232. package/Source/Shaders/Model/AtmosphereStageVS.js +14 -0
  233. package/Source/Shaders/Model/GeometryStageFS.glsl +1 -1
  234. package/Source/Shaders/Model/GeometryStageFS.js +1 -1
  235. package/Source/Shaders/Model/GeometryStageVS.glsl +4 -4
  236. package/Source/Shaders/Model/GeometryStageVS.js +4 -4
  237. package/Source/Shaders/Model/ModelColorStageFS.glsl +1 -1
  238. package/Source/Shaders/Model/ModelColorStageFS.js +2 -1
  239. package/Source/Shaders/Model/ModelFS.glsl +4 -0
  240. package/Source/Shaders/Model/ModelFS.js +4 -0
  241. package/Source/Shaders/Model/ModelVS.glsl +9 -4
  242. package/Source/Shaders/Model/ModelVS.js +9 -4
  243. package/Source/Shaders/SkyAtmosphereCommon.glsl +3 -13
  244. package/Source/Shaders/SkyAtmosphereCommon.js +3 -13
  245. package/Source/Shaders/SkyAtmosphereFS.glsl +5 -10
  246. package/Source/Shaders/SkyAtmosphereFS.js +5 -10
  247. package/Source/Shaders/SkyAtmosphereVS.glsl +3 -2
  248. package/Source/Shaders/SkyAtmosphereVS.js +3 -2
  249. package/Source/Shaders/Voxels/IntersectCylinder.glsl +14 -111
  250. package/Source/Shaders/Voxels/IntersectCylinder.js +14 -111
  251. package/Source/Shaders/Voxels/IntersectEllipsoid.glsl +32 -113
  252. package/Source/Shaders/Voxels/IntersectEllipsoid.js +32 -113
  253. package/Source/Shaders/Voxels/IntersectLongitude.glsl +102 -0
  254. package/Source/Shaders/Voxels/IntersectLongitude.js +104 -0
  255. package/Source/Shaders/Voxels/VoxelFS.glsl +39 -1
  256. package/Source/Shaders/Voxels/VoxelFS.js +39 -1
  257. package/Source/Shaders/Voxels/convertUvToCylinder.glsl +19 -37
  258. package/Source/Shaders/Voxels/convertUvToCylinder.js +19 -37
  259. package/Source/Shaders/Voxels/convertUvToEllipsoid.glsl +24 -44
  260. package/Source/Shaders/Voxels/convertUvToEllipsoid.js +24 -44
  261. package/Source/ThirdParty/Workers/z-worker-pako.js +1 -1
  262. package/Source/ThirdParty/draco_decoder.wasm +0 -0
  263. package/Source/Workers/createGeometry.js +40 -11
  264. package/Source/Workers/decodeI3S.js +720 -94
  265. package/index.d.ts +574 -71
  266. package/index.js +217 -196
  267. package/package.json +3 -3
  268. package/Build/Workers/chunk-ATB2I7OS.js +0 -55
@@ -0,0 +1,273 @@
1
+ import Cartesian3 from "../Core/Cartesian3.js";
2
+ import Check from "../Core/Check.js";
3
+ import defined from "../Core/defined.js";
4
+ import MetadataType from "./MetadataType.js";
5
+ import OrientedBoundingBox from "../Core/OrientedBoundingBox.js";
6
+
7
+ /**
8
+ * A cell from a {@link VoxelPrimitive}.
9
+ * <p>
10
+ * Provides access to properties associated with one cell of a voxel primitive.
11
+ * </p>
12
+ * <p>
13
+ * Do not construct this directly. Access it through picking using {@link Scene#pickVoxel}.
14
+ * </p>
15
+ *
16
+ * @alias VoxelCell
17
+ * @constructor
18
+ *
19
+ * @param {VoxelPrimitive} primitive The voxel primitive containing the cell
20
+ * @param {number} tileIndex The index of the tile
21
+ * @param {number} sampleIndex The index of the sample within the tile, containing metadata for this cell
22
+ *
23
+ * @example
24
+ * // On left click, display all the properties for a voxel cell in the console log.
25
+ * handler.setInputAction(function(movement) {
26
+ * const voxelCell = scene.pickVoxel(movement.position);
27
+ * if (voxelCell instanceof Cesium.VoxelCell) {
28
+ * const propertyIds = voxelCell.getPropertyIds();
29
+ * const length = propertyIds.length;
30
+ * for (let i = 0; i < length; ++i) {
31
+ * const propertyId = propertyIds[i];
32
+ * console.log(`{propertyId}: ${voxelCell.getProperty(propertyId)}`);
33
+ * }
34
+ * }
35
+ * }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
36
+ *
37
+ * @experimental This feature is not final and is subject to change without Cesium's standard deprecation policy.
38
+ */
39
+ function VoxelCell(primitive, tileIndex, sampleIndex) {
40
+ this._primitive = primitive;
41
+ this._tileIndex = tileIndex;
42
+ this._sampleIndex = sampleIndex;
43
+ this._metadata = {};
44
+ this._orientedBoundingBox = new OrientedBoundingBox();
45
+ }
46
+
47
+ /**
48
+ * Construct a VoxelCell, and update the metadata and bounding box using the properties
49
+ * of a supplied keyframe node.
50
+ *
51
+ * @private
52
+ * @param {VoxelPrimitive} primitive The voxel primitive containing the cell.
53
+ * @param {number} tileIndex The index of the tile.
54
+ * @param {number} sampleIndex The index of the sample within the tile, containing metadata for this cell.
55
+ * @param {KeyframeNode} keyframeNode The keyframe node containing information about the tile.
56
+ * @returns {VoxelCell}
57
+ *
58
+ * @experimental This feature is not final and is subject to change without Cesium's standard deprecation policy.
59
+ */
60
+ VoxelCell.fromKeyframeNode = function (
61
+ primitive,
62
+ tileIndex,
63
+ sampleIndex,
64
+ keyframeNode
65
+ ) {
66
+ //>>includeStart('debug', pragmas.debug);
67
+ Check.typeOf.object("primitive", primitive);
68
+ Check.typeOf.number("tileIndex", tileIndex);
69
+ Check.typeOf.number("sampleIndex", sampleIndex);
70
+ Check.typeOf.object("keyframeNode", keyframeNode);
71
+ //>>includeEnd('debug');
72
+
73
+ const voxelCell = new VoxelCell(primitive, tileIndex, sampleIndex);
74
+ const { spatialNode, metadata } = keyframeNode;
75
+ voxelCell._metadata = getMetadataForSample(primitive, metadata, sampleIndex);
76
+ voxelCell._orientedBoundingBox = getOrientedBoundingBox(
77
+ primitive,
78
+ spatialNode,
79
+ sampleIndex,
80
+ voxelCell._orientedBoundingBox
81
+ );
82
+ return voxelCell;
83
+ };
84
+
85
+ /**
86
+ * @private
87
+ * @param {VoxelPrimitive} primitive
88
+ * @param {object} metadata
89
+ * @param {number} sampleIndex
90
+ * @returns {object}
91
+ */
92
+ function getMetadataForSample(primitive, metadata, sampleIndex) {
93
+ if (!defined(metadata)) {
94
+ return undefined;
95
+ }
96
+ const { names, types } = primitive.provider;
97
+ const metadataMap = {};
98
+ for (let i = 0; i < names.length; i++) {
99
+ const name = names[i];
100
+ const componentCount = MetadataType.getComponentCount(types[i]);
101
+ const samples = metadata[i].slice(
102
+ sampleIndex * componentCount,
103
+ (sampleIndex + 1) * componentCount
104
+ );
105
+ metadataMap[name] = samples;
106
+ }
107
+ return metadataMap;
108
+ }
109
+
110
+ const tileCoordinateScratch = new Cartesian3();
111
+ const tileUvScratch = new Cartesian3();
112
+
113
+ /**
114
+ * @private
115
+ * @param {VoxelPrimitive} primitive
116
+ * @param {SpatialNode} spatialNode
117
+ * @param {OrientedBoundingBox} result
118
+ * @returns {OrientedBoundingBox}
119
+ */
120
+ function getOrientedBoundingBox(primitive, spatialNode, sampleIndex, result) {
121
+ // Convert the sample index into a 3D tile coordinate
122
+ // Note: dimensions from the spatialNode include padding
123
+ const paddedDimensions = spatialNode.dimensions;
124
+ const sliceSize = paddedDimensions.x * paddedDimensions.y;
125
+ const zIndex = Math.floor(sampleIndex / sliceSize);
126
+ const indexInSlice = sampleIndex - zIndex * sliceSize;
127
+ const yIndex = Math.floor(indexInSlice / paddedDimensions.x);
128
+ const xIndex = indexInSlice - yIndex * paddedDimensions.x;
129
+ const tileCoordinate = Cartesian3.fromElements(
130
+ xIndex,
131
+ yIndex,
132
+ zIndex,
133
+ tileCoordinateScratch
134
+ );
135
+
136
+ // Remove padding, and convert to a fraction in [0, 1], where the limits are
137
+ // the unpadded bounds of the tile
138
+ const tileUv = Cartesian3.divideComponents(
139
+ Cartesian3.subtract(
140
+ tileCoordinate,
141
+ primitive._paddingBefore,
142
+ tileCoordinateScratch
143
+ ),
144
+ primitive.dimensions,
145
+ tileUvScratch
146
+ );
147
+
148
+ const shape = primitive._shape;
149
+ return shape.computeOrientedBoundingBoxForSample(
150
+ spatialNode,
151
+ primitive.dimensions,
152
+ tileUv,
153
+ result
154
+ );
155
+ }
156
+
157
+ Object.defineProperties(VoxelCell.prototype, {
158
+ /**
159
+ * Gets an object of the metadata values for this cell. The object's keys are the metadata names.
160
+ *
161
+ * @memberof VoxelCell.prototype
162
+ *
163
+ * @type {object}
164
+ *
165
+ * @readonly
166
+ * @private
167
+ */
168
+ metadata: {
169
+ get: function () {
170
+ return this._metadata;
171
+ },
172
+ },
173
+
174
+ /**
175
+ * All objects returned by {@link Scene#pick} have a <code>primitive</code> property. This returns
176
+ * the VoxelPrimitive containing the cell.
177
+ *
178
+ * @memberof VoxelCell.prototype
179
+ *
180
+ * @type {VoxelPrimitive}
181
+ *
182
+ * @readonly
183
+ */
184
+ primitive: {
185
+ get: function () {
186
+ return this._primitive;
187
+ },
188
+ },
189
+
190
+ /**
191
+ * Get the sample index of the cell.
192
+ *
193
+ * @memberof VoxelCell.prototype
194
+ *
195
+ * @type {number}
196
+ *
197
+ * @readonly
198
+ */
199
+ sampleIndex: {
200
+ get: function () {
201
+ return this._sampleIndex;
202
+ },
203
+ },
204
+
205
+ /**
206
+ * Get the index of the tile containing the cell.
207
+ *
208
+ * @memberof VoxelCell.prototype
209
+ *
210
+ * @type {number}
211
+ *
212
+ * @readonly
213
+ */
214
+ tileIndex: {
215
+ get: function () {
216
+ return this._tileIndex;
217
+ },
218
+ },
219
+
220
+ /**
221
+ * Get a copy of the oriented bounding box containing the cell.
222
+ *
223
+ * @memberof VoxelCell.prototype
224
+ *
225
+ * @type {OrientedBoundingBox}
226
+ *
227
+ * @readonly
228
+ */
229
+ orientedBoundingBox: {
230
+ get: function () {
231
+ return this._orientedBoundingBox.clone();
232
+ },
233
+ },
234
+ });
235
+
236
+ /**
237
+ * Returns <code>true</code> if the feature contains this property.
238
+ *
239
+ * @param {string} name The case-sensitive name of the property.
240
+ * @returns {boolean} Whether the feature contains this property.
241
+ */
242
+ VoxelCell.prototype.hasProperty = function (name) {
243
+ return defined(this._metadata[name]);
244
+ };
245
+
246
+ /**
247
+ * Returns an array of metadata property names for the feature.
248
+ *
249
+ * @returns {string[]} The IDs of the feature's properties.
250
+ */
251
+ VoxelCell.prototype.getNames = function () {
252
+ return Object.keys(this._metadata);
253
+ };
254
+
255
+ /**
256
+ * Returns a copy of the value of the metadata in the cell with the given name.
257
+ *
258
+ * @param {string} name The case-sensitive name of the property.
259
+ * @returns {*} The value of the property or <code>undefined</code> if the feature does not have this property.
260
+ *
261
+ * @example
262
+ * // Display all the properties for a voxel cell in the console log.
263
+ * const names = voxelCell.getNames();
264
+ * for (let i = 0; i < names.length; ++i) {
265
+ * const name = names[i];
266
+ * console.log(`{name}: ${voxelCell.getProperty(name)}`);
267
+ * }
268
+ */
269
+ VoxelCell.prototype.getProperty = function (name) {
270
+ return this._metadata[name];
271
+ };
272
+
273
+ export default VoxelCell;
@@ -120,15 +120,11 @@ function VoxelCylinderShape() {
120
120
  CYLINDER_HAS_RENDER_BOUNDS_ANGLE: undefined,
121
121
  CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_EQUAL_ZERO: undefined,
122
122
  CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_UNDER_HALF: undefined,
123
- CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_EQUAL_HALF: undefined,
124
123
  CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_OVER_HALF: undefined,
125
124
 
126
125
  CYLINDER_HAS_SHAPE_BOUNDS_RADIUS: undefined,
127
- CYLINDER_HAS_SHAPE_BOUNDS_RADIUS_FLAT: undefined,
128
126
  CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT: undefined,
129
- CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT_FLAT: undefined,
130
127
  CYLINDER_HAS_SHAPE_BOUNDS_ANGLE: undefined,
131
- CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_RANGE_EQUAL_ZERO: undefined,
132
128
  CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_DISCONTINUITY: undefined,
133
129
  CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MAX_DISCONTINUITY: undefined,
134
130
  CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_MAX_REVERSED: undefined,
@@ -324,17 +320,12 @@ VoxelCylinderShape.prototype.update = function (
324
320
  shapeAngleRange > defaultAngleRangeHalf + epsilonAngle &&
325
321
  shapeAngleRange < defaultAngleRange - epsilonAngle;
326
322
  const shapeIsAngleFlipped =
327
- shapeAngleRange > epsilonAngle &&
328
323
  shapeAngleRange < defaultAngleRangeHalf - epsilonAngle;
329
324
  const shapeIsAngleRangeHalf =
330
325
  shapeAngleRange >= defaultAngleRangeHalf - epsilonAngle &&
331
326
  shapeAngleRange <= defaultAngleRangeHalf + epsilonAngle;
332
- const shapeIsAngleRangeZero = shapeAngleRange <= epsilonAngle;
333
327
  const shapeHasAngle =
334
- shapeIsAngleRegular ||
335
- shapeIsAngleFlipped ||
336
- shapeIsAngleRangeHalf ||
337
- shapeIsAngleRangeZero;
328
+ shapeIsAngleRegular || shapeIsAngleFlipped || shapeIsAngleRangeHalf;
338
329
  const shapeIsMinAngleDiscontinuity = CesiumMath.equalsEpsilon(
339
330
  shapeMinAngle,
340
331
  defaultMinAngle,
@@ -357,23 +348,16 @@ VoxelCylinderShape.prototype.update = function (
357
348
  const renderAngleRange =
358
349
  renderMaxAngle - renderMinAngle + renderIsAngleReversed * defaultAngleRange;
359
350
  const renderIsAngleRegular =
360
- renderAngleRange > defaultAngleRangeHalf + epsilonAngle &&
351
+ renderAngleRange >= defaultAngleRangeHalf - epsilonAngle &&
361
352
  renderAngleRange < defaultAngleRange - epsilonAngle;
362
353
  const renderIsAngleFlipped =
363
354
  renderAngleRange > epsilonAngle &&
364
355
  renderAngleRange < defaultAngleRangeHalf - epsilonAngle;
365
- const renderIsAngleRangeHalf =
366
- renderAngleRange >= defaultAngleRangeHalf - epsilonAngle &&
367
- renderAngleRange <= defaultAngleRangeHalf + epsilonAngle;
368
356
  const renderIsAngleRangeZero = renderAngleRange <= epsilonAngle;
369
357
  const renderHasAngle =
370
- renderIsAngleRegular ||
371
- renderIsAngleFlipped ||
372
- renderIsAngleRangeHalf ||
373
- renderIsAngleRangeZero;
358
+ renderIsAngleRegular || renderIsAngleFlipped || renderIsAngleRangeZero;
374
359
 
375
- const shaderUniforms = this.shaderUniforms;
376
- const shaderDefines = this.shaderDefines;
360
+ const { shaderUniforms, shaderDefines } = this;
377
361
 
378
362
  // To keep things simple, clear the defines every time
379
363
  for (const key in shaderDefines) {
@@ -408,12 +392,6 @@ VoxelCylinderShape.prototype.update = function (
408
392
  if (renderMinHeight === renderMaxHeight) {
409
393
  shaderDefines["CYLINDER_HAS_RENDER_BOUNDS_HEIGHT_FLAT"] = true;
410
394
  }
411
- if (shapeMinHeight === shapeMaxHeight) {
412
- shaderDefines["CYLINDER_HAS_SHAPE_BOUNDS_HEIGHT_FLAT"] = true;
413
- }
414
- if (shapeMinRadius === shapeMaxRadius) {
415
- shaderDefines["CYLINDER_HAS_SHAPE_BOUNDS_RADIUS_FLAT"] = true;
416
- }
417
395
  if (!shapeIsDefaultRadius) {
418
396
  shaderDefines["CYLINDER_HAS_SHAPE_BOUNDS_RADIUS"] = true;
419
397
 
@@ -423,8 +401,13 @@ VoxelCylinderShape.prototype.update = function (
423
401
  // scale = 1.0 / (maxRadius - minRadius)
424
402
  // offset = -minRadius / (maxRadius - minRadius)
425
403
  // offset = minRadius / (minRadius - maxRadius)
426
- const scale = 1.0 / (shapeMaxRadius - shapeMinRadius);
427
- const offset = shapeMinRadius / (shapeMinRadius - shapeMaxRadius);
404
+ const radiusRange = shapeMaxRadius - shapeMinRadius;
405
+ let scale = 0.0;
406
+ let offset = 1.0;
407
+ if (radiusRange !== 0.0) {
408
+ scale = 1.0 / radiusRange;
409
+ offset = -shapeMinRadius / radiusRange;
410
+ }
428
411
  shaderUniforms.cylinderUvToShapeUvRadius = Cartesian2.fromElements(
429
412
  scale,
430
413
  offset,
@@ -446,8 +429,13 @@ VoxelCylinderShape.prototype.update = function (
446
429
  // offset = -2.0 * (minHeight * 0.5 + 0.5) / (maxHeight - minHeight)
447
430
  // offset = -(minHeight + 1.0) / (maxHeight - minHeight)
448
431
  // offset = (minHeight + 1.0) / (minHeight - maxHeight)
449
- const scale = 2.0 / (shapeMaxHeight - shapeMinHeight);
450
- const offset = (shapeMinHeight + 1.0) / (shapeMinHeight - shapeMaxHeight);
432
+ const heightRange = shapeMaxHeight - shapeMinHeight;
433
+ let scale = 0.0;
434
+ let offset = 1.0;
435
+ if (heightRange !== 0.0) {
436
+ scale = 2.0 / heightRange;
437
+ offset = -(shapeMinHeight + 1.0) / heightRange;
438
+ }
451
439
  shaderUniforms.cylinderUvToShapeUvHeight = Cartesian2.fromElements(
452
440
  scale,
453
441
  offset,
@@ -505,9 +493,6 @@ VoxelCylinderShape.prototype.update = function (
505
493
  } else if (renderIsAngleFlipped) {
506
494
  shaderDefines["CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_OVER_HALF"] = true;
507
495
  intersectionCount += 2;
508
- } else if (renderIsAngleRangeHalf) {
509
- shaderDefines["CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_EQUAL_HALF"] = true;
510
- intersectionCount += 1;
511
496
  } else if (renderIsAngleRangeZero) {
512
497
  shaderDefines["CYLINDER_HAS_RENDER_BOUNDS_ANGLE_RANGE_EQUAL_ZERO"] = true;
513
498
  intersectionCount += 2;
@@ -522,9 +507,6 @@ VoxelCylinderShape.prototype.update = function (
522
507
 
523
508
  if (shapeHasAngle) {
524
509
  shaderDefines["CYLINDER_HAS_SHAPE_BOUNDS_ANGLE"] = true;
525
- if (shapeIsAngleRangeZero) {
526
- shaderDefines["CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_RANGE_EQUAL_ZERO"] = true;
527
- }
528
510
  if (shapeIsMinAngleDiscontinuity) {
529
511
  shaderDefines["CYLINDER_HAS_SHAPE_BOUNDS_ANGLE_MIN_DISCONTINUITY"] = true;
530
512
  }
@@ -553,13 +535,21 @@ VoxelCylinderShape.prototype.update = function (
553
535
  // offset = -uvMinAngle / (uvMaxAngle - uvMinAngle)
554
536
  // offset = -((minAngle - pi) / (2.0 * pi)) / (((maxAngle - pi) / (2.0 * pi)) - ((minAngle - pi) / (2.0 * pi)))
555
537
  // offset = -(minAngle - pi) / (maxAngle - minAngle)
556
- const scale = defaultAngleRange / shapeAngleRange;
557
- const offset = -(shapeMinAngle - defaultMinAngle) / shapeAngleRange;
558
- shaderUniforms.cylinderUvToShapeUvAngle = Cartesian2.fromElements(
559
- scale,
560
- offset,
561
- shaderUniforms.cylinderUvToShapeUvAngle
562
- );
538
+ if (shapeAngleRange <= epsilonAngle) {
539
+ shaderUniforms.cylinderUvToShapeUvAngle = Cartesian2.fromElements(
540
+ 0.0,
541
+ 1.0,
542
+ shaderUniforms.cylinderUvToShapeUvAngle
543
+ );
544
+ } else {
545
+ const scale = defaultAngleRange / shapeAngleRange;
546
+ const offset = -(shapeMinAngle - defaultMinAngle) / shapeAngleRange;
547
+ shaderUniforms.cylinderUvToShapeUvAngle = Cartesian2.fromElements(
548
+ scale,
549
+ offset,
550
+ shaderUniforms.cylinderUvToShapeUvAngle
551
+ );
552
+ }
563
553
  }
564
554
 
565
555
  this.shaderMaximumIntersectionsLength = intersectionCount;
@@ -645,6 +635,87 @@ VoxelCylinderShape.prototype.computeOrientedBoundingBoxForTile = function (
645
635
  );
646
636
  };
647
637
 
638
+ const sampleSizeScratch = new Cartesian3();
639
+ const scratchTileMinBounds = new Cartesian3();
640
+ const scratchTileMaxBounds = new Cartesian3();
641
+
642
+ /**
643
+ * Computes an oriented bounding box for a specified sample within a specified tile.
644
+ * The update function must be called before calling this function.
645
+ *
646
+ * @param {SpatialNode} spatialNode The spatial node containing the sample
647
+ * @param {Cartesian3} tileDimensions The size of the tile in number of samples, before padding
648
+ * @param {Cartesian3} tileUv The sample coordinate within the tile
649
+ * @param {OrientedBoundingBox} result The oriented bounding box that will be set to enclose the specified sample
650
+ * @returns {OrientedBoundingBox} The oriented bounding box.
651
+ */
652
+ VoxelCylinderShape.prototype.computeOrientedBoundingBoxForSample = function (
653
+ spatialNode,
654
+ tileDimensions,
655
+ tileUv,
656
+ result
657
+ ) {
658
+ //>>includeStart('debug', pragmas.debug);
659
+ Check.typeOf.object("spatialNode", spatialNode);
660
+ Check.typeOf.object("tileDimensions", tileDimensions);
661
+ Check.typeOf.object("tileUv", tileUv);
662
+ Check.typeOf.object("result", result);
663
+ //>>includeEnd('debug');
664
+
665
+ const tileSizeAtLevel = 1.0 / Math.pow(2.0, spatialNode.level);
666
+ const sampleSize = Cartesian3.divideComponents(
667
+ Cartesian3.ONE,
668
+ tileDimensions,
669
+ sampleSizeScratch
670
+ );
671
+ const sampleSizeAtLevel = Cartesian3.multiplyByScalar(
672
+ sampleSize,
673
+ tileSizeAtLevel,
674
+ sampleSizeScratch
675
+ );
676
+
677
+ const minLerp = Cartesian3.multiplyByScalar(
678
+ Cartesian3.fromElements(
679
+ spatialNode.x + tileUv.x,
680
+ spatialNode.y + tileUv.y,
681
+ spatialNode.z + tileUv.z,
682
+ scratchTileMinBounds
683
+ ),
684
+ tileSizeAtLevel,
685
+ scratchTileMinBounds
686
+ );
687
+ const maxLerp = Cartesian3.add(
688
+ minLerp,
689
+ sampleSizeAtLevel,
690
+ scratchTileMaxBounds
691
+ );
692
+
693
+ const minimumRadius = this._minimumRadius;
694
+ const maximumRadius = this._maximumRadius;
695
+ const minimumHeight = this._minimumHeight;
696
+ const maximumHeight = this._maximumHeight;
697
+ const minimumAngle = this._minimumAngle;
698
+ const maximumAngle = this._maximumAngle;
699
+
700
+ const radiusStart = CesiumMath.lerp(minimumRadius, maximumRadius, minLerp.x);
701
+ const radiusEnd = CesiumMath.lerp(minimumRadius, maximumRadius, maxLerp.x);
702
+ const heightStart = CesiumMath.lerp(minimumHeight, maximumHeight, minLerp.y);
703
+ const heightEnd = CesiumMath.lerp(minimumHeight, maximumHeight, maxLerp.y);
704
+ const angleStart = CesiumMath.lerp(minimumAngle, maximumAngle, minLerp.z);
705
+ const angleEnd = CesiumMath.lerp(minimumAngle, maximumAngle, maxLerp.z);
706
+
707
+ return getCylinderChunkObb(
708
+ radiusStart,
709
+ radiusEnd,
710
+ heightStart,
711
+ heightEnd,
712
+ angleStart,
713
+ angleEnd,
714
+ this.shapeTransform,
715
+ result
716
+ );
717
+ };
718
+
648
719
  const scratchOrientedBoundingBox = new OrientedBoundingBox();
649
720
  const scratchVoxelScale = new Cartesian3();
650
721
  const scratchRootScale = new Cartesian3();