@cesium/engine 14.0.0 → 15.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 (156) hide show
  1. package/Build/Workers/{chunk-EWDGNOJE.js → chunk-25TOENEE.js} +7 -7
  2. package/Build/Workers/{chunk-OMXHEJTK.js → chunk-2AVIUB5H.js} +2 -2
  3. package/Build/Workers/{chunk-LJBJM6VI.js → chunk-3JZGPJMZ.js} +6 -6
  4. package/Build/Workers/{chunk-DT5NFR5C.js → chunk-3LHBH4TC.js} +7 -7
  5. package/Build/Workers/{chunk-3QLSKXKF.js → chunk-3LZF23RY.js} +6 -6
  6. package/Build/Workers/{chunk-ED6GLQTK.js → chunk-5S2B46UQ.js} +1 -1
  7. package/Build/Workers/{chunk-B4GSRXE3.js → chunk-67ONR44K.js} +6 -6
  8. package/Build/Workers/{chunk-LOZ4NKY3.js → chunk-6EDBC234.js} +11 -11
  9. package/Build/Workers/{chunk-7ZB2RVIQ.js → chunk-6EV4VOET.js} +10 -10
  10. package/Build/Workers/{chunk-KHWLAQVA.js → chunk-7ITUZTFH.js} +1 -1
  11. package/Build/Workers/{chunk-JHBPC4LK.js → chunk-ARVZCY6X.js} +7 -7
  12. package/Build/Workers/{chunk-FFBJDW4A.js → chunk-B2UQN3DH.js} +6 -6
  13. package/Build/Workers/{chunk-VCNOFQYH.js → chunk-B2Y4ZS6X.js} +9 -9
  14. package/Build/Workers/{chunk-Q4ZVWJXX.js → chunk-BD2TPFGC.js} +5 -5
  15. package/Build/Workers/{chunk-K4AH3TDT.js → chunk-CHX2K5AC.js} +10 -10
  16. package/Build/Workers/{chunk-3LYROPON.js → chunk-CJGVEABL.js} +13 -13
  17. package/Build/Workers/{chunk-KSYBJA4M.js → chunk-DYJHEP3B.js} +5 -5
  18. package/Build/Workers/{chunk-CI2HEJFC.js → chunk-E3H7AVMK.js} +13 -13
  19. package/Build/Workers/{chunk-F4CUH4MR.js → chunk-EZNAJPP5.js} +4 -4
  20. package/Build/Workers/{chunk-YJX7X577.js → chunk-F7ZI463G.js} +15 -15
  21. package/Build/Workers/{chunk-HEZHXDYB.js → chunk-FMZ5CX6V.js} +1 -1
  22. package/Build/Workers/{chunk-G3BVMPWG.js → chunk-FRAWHNSR.js} +2 -2
  23. package/Build/Workers/{chunk-J7IH4EYI.js → chunk-GGV2XJHE.js} +7 -7
  24. package/Build/Workers/{chunk-5KWRW7YL.js → chunk-GK4QU6QI.js} +2 -2
  25. package/Build/Workers/{chunk-77XPS7ZA.js → chunk-HYPB7FAV.js} +10 -10
  26. package/Build/Workers/{chunk-MVM4JV5U.js → chunk-I4HO2ED2.js} +9 -9
  27. package/Build/Workers/{chunk-FX4R4MTH.js → chunk-IGINOLDX.js} +6 -6
  28. package/Build/Workers/{chunk-PWF4EY5P.js → chunk-ISQSYLZY.js} +4 -4
  29. package/Build/Workers/{chunk-7UHKH6M3.js → chunk-JZAMRL5I.js} +6 -6
  30. package/Build/Workers/{chunk-HUFQVUMY.js → chunk-K5G2WELR.js} +7 -7
  31. package/Build/Workers/{chunk-5S5OOA6U.js → chunk-L5SO4Y5V.js} +1 -1
  32. package/Build/Workers/{chunk-LNSWJ43X.js → chunk-LCMJQVIF.js} +11 -11
  33. package/Build/Workers/{chunk-WVNLSTOF.js → chunk-MWJW37I7.js} +2 -2
  34. package/Build/Workers/{chunk-ZGFIT57T.js → chunk-NAGMYRDW.js} +27 -20
  35. package/Build/Workers/{chunk-SDIDRZDG.js → chunk-OYO6TKMU.js} +7 -7
  36. package/Build/Workers/{chunk-HKHQ3EDR.js → chunk-PUTA3AE2.js} +4 -4
  37. package/Build/Workers/{chunk-JPDKYBLF.js → chunk-Q5BHMNKU.js} +13 -13
  38. package/Build/Workers/{chunk-XK4OP6VA.js → chunk-QTEX3Y4V.js} +17 -17
  39. package/Build/Workers/{chunk-TVL3F7IU.js → chunk-QZKN2RXM.js} +1 -1
  40. package/Build/Workers/{chunk-Z3QWTHI7.js → chunk-RO2Z3LCR.js} +14 -14
  41. package/Build/Workers/{chunk-N2XAJBC6.js → chunk-RRN6LRDX.js} +12 -12
  42. package/Build/Workers/{chunk-FYGLNDKG.js → chunk-SLIA3GQP.js} +7 -7
  43. package/Build/Workers/{chunk-7EO56M5R.js → chunk-TFCOEX3W.js} +2 -2
  44. package/Build/Workers/{chunk-KM6MITPF.js → chunk-TU6ZXHVU.js} +5 -5
  45. package/Build/Workers/{chunk-LS3KVHYY.js → chunk-VJ2PDF64.js} +6 -6
  46. package/Build/Workers/{chunk-D7ZBZPHV.js → chunk-VMVPONIV.js} +5 -5
  47. package/Build/Workers/{chunk-3PIZQT3I.js → chunk-WPXU45PH.js} +4 -4
  48. package/Build/Workers/{chunk-WEHZP4SE.js → chunk-XDHM4G3P.js} +7 -7
  49. package/Build/Workers/{chunk-TY4DKOWR.js → chunk-XED3RXKO.js} +2 -2
  50. package/Build/Workers/{chunk-ZMNLEL6W.js → chunk-YNYCGTQH.js} +5 -5
  51. package/Build/Workers/{chunk-4CHMVQTQ.js → chunk-Z4SI54EB.js} +4 -4
  52. package/Build/Workers/{chunk-3JBEPBPL.js → chunk-ZVDLC3T4.js} +13 -13
  53. package/Build/Workers/combineGeometry.js +22 -22
  54. package/Build/Workers/createBoxGeometry.js +16 -16
  55. package/Build/Workers/createBoxOutlineGeometry.js +14 -14
  56. package/Build/Workers/createCircleGeometry.js +24 -24
  57. package/Build/Workers/createCircleOutlineGeometry.js +17 -17
  58. package/Build/Workers/createCoplanarPolygonGeometry.js +31 -31
  59. package/Build/Workers/createCoplanarPolygonOutlineGeometry.js +29 -29
  60. package/Build/Workers/createCorridorGeometry.js +27 -27
  61. package/Build/Workers/createCorridorOutlineGeometry.js +26 -26
  62. package/Build/Workers/createCylinderGeometry.js +18 -18
  63. package/Build/Workers/createCylinderOutlineGeometry.js +16 -16
  64. package/Build/Workers/createEllipseGeometry.js +24 -24
  65. package/Build/Workers/createEllipseOutlineGeometry.js +17 -17
  66. package/Build/Workers/createEllipsoidGeometry.js +17 -17
  67. package/Build/Workers/createEllipsoidOutlineGeometry.js +16 -16
  68. package/Build/Workers/createFrustumGeometry.js +16 -16
  69. package/Build/Workers/createFrustumOutlineGeometry.js +16 -16
  70. package/Build/Workers/createGeometry.js +22 -22
  71. package/Build/Workers/createGroundPolylineGeometry.js +20 -20
  72. package/Build/Workers/createPlaneGeometry.js +14 -14
  73. package/Build/Workers/createPlaneOutlineGeometry.js +13 -13
  74. package/Build/Workers/createPolygonGeometry.js +30 -30
  75. package/Build/Workers/createPolygonOutlineGeometry.js +28 -28
  76. package/Build/Workers/createPolylineGeometry.js +23 -23
  77. package/Build/Workers/createPolylineVolumeGeometry.js +29 -29
  78. package/Build/Workers/createPolylineVolumeOutlineGeometry.js +25 -25
  79. package/Build/Workers/createRectangleGeometry.js +25 -25
  80. package/Build/Workers/createRectangleOutlineGeometry.js +18 -18
  81. package/Build/Workers/createSimplePolylineGeometry.js +21 -21
  82. package/Build/Workers/createSphereGeometry.js +17 -17
  83. package/Build/Workers/createSphereOutlineGeometry.js +16 -16
  84. package/Build/Workers/createTaskProcessorWorker.js +3 -3
  85. package/Build/Workers/createVectorTileClampedPolylines.js +13 -13
  86. package/Build/Workers/createVectorTileGeometries.js +22 -22
  87. package/Build/Workers/createVectorTilePoints.js +12 -12
  88. package/Build/Workers/createVectorTilePolygons.js +20 -20
  89. package/Build/Workers/createVectorTilePolylines.js +13 -13
  90. package/Build/Workers/createVerticesFromGoogleEarthEnterpriseBuffer.js +20 -20
  91. package/Build/Workers/createVerticesFromHeightmap.js +20 -20
  92. package/Build/Workers/createVerticesFromQuantizedTerrainMesh.js +17 -17
  93. package/Build/Workers/createWallGeometry.js +22 -22
  94. package/Build/Workers/createWallOutlineGeometry.js +21 -21
  95. package/Build/Workers/decodeDraco.js +11 -11
  96. package/Build/Workers/decodeGoogleEarthEnterprisePacket.js +5 -5
  97. package/Build/Workers/decodeI3S.js +10 -10
  98. package/Build/Workers/transcodeKTX2.js +50 -43
  99. package/Build/Workers/transferTypedArrayTest.js +1 -1
  100. package/Build/Workers/upsampleQuantizedTerrainMesh.js +20 -20
  101. package/Source/Core/EllipsoidRhumbLine.js +1 -1
  102. package/Source/Core/Ion.js +1 -1
  103. package/Source/Core/PolygonGeometryLibrary.js +26 -4
  104. package/Source/Core/TexturePacker.js +166 -0
  105. package/Source/DataSources/BillboardVisualizer.js +3 -3
  106. package/Source/DataSources/EntityCluster.js +44 -19
  107. package/Source/Renderer/Context.js +0 -4
  108. package/Source/Renderer/Texture.js +6 -5
  109. package/Source/Renderer/TextureAtlas.js +802 -0
  110. package/Source/Scene/ArcGisMapService.js +1 -1
  111. package/Source/Scene/Billboard.js +86 -141
  112. package/Source/Scene/BillboardCollection.js +132 -202
  113. package/Source/Scene/BillboardLoadState.js +44 -0
  114. package/Source/Scene/BillboardTexture.js +348 -0
  115. package/Source/Scene/Camera.js +2 -2
  116. package/Source/Scene/Cesium3DTilesVoxelProvider.js +380 -126
  117. package/Source/Scene/Cesium3DTilesetStatistics.js +0 -1
  118. package/Source/Scene/Expression.js +1 -0
  119. package/Source/Scene/GltfLoader.js +5 -7
  120. package/Source/Scene/ImplicitSubtree.js +2 -0
  121. package/Source/Scene/KeyframeNode.js +16 -2
  122. package/Source/Scene/LabelCollection.js +212 -182
  123. package/Source/Scene/Megatexture.js +145 -81
  124. package/Source/Scene/Model/CustomShader.js +0 -2
  125. package/Source/Scene/Model/Model.js +1 -1
  126. package/Source/Scene/Model/ModelUtility.js +5 -1
  127. package/Source/Scene/Scene.js +39 -15
  128. package/Source/Scene/ScreenSpaceCameraController.js +0 -8
  129. package/Source/Scene/SpatialNode.js +4 -11
  130. package/Source/Scene/Vector3DTilePoints.js +2 -5
  131. package/Source/Scene/VoxelBoxShape.js +12 -5
  132. package/Source/Scene/VoxelCell.js +6 -5
  133. package/Source/Scene/VoxelContent.js +171 -107
  134. package/Source/Scene/VoxelCylinderShape.js +65 -58
  135. package/Source/Scene/VoxelEllipsoidShape.js +15 -5
  136. package/Source/Scene/VoxelMetadataOrder.js +12 -0
  137. package/Source/Scene/VoxelPrimitive.js +122 -54
  138. package/Source/Scene/VoxelProvider.js +34 -29
  139. package/Source/Scene/VoxelRenderResources.js +30 -7
  140. package/Source/Scene/VoxelShape.js +10 -3
  141. package/Source/Scene/VoxelTraversal.js +264 -180
  142. package/Source/Scene/processVoxelProperties.js +3 -0
  143. package/Source/Shaders/GlobeFS.glsl +10 -1
  144. package/Source/Shaders/GlobeFS.js +10 -1
  145. package/Source/Shaders/Voxels/Megatexture.glsl +4 -16
  146. package/Source/Shaders/Voxels/Megatexture.js +4 -16
  147. package/Source/Shaders/Voxels/Octree.glsl +44 -7
  148. package/Source/Shaders/Voxels/Octree.js +44 -7
  149. package/Source/Shaders/Voxels/VoxelFS.glsl +9 -15
  150. package/Source/Shaders/Voxels/VoxelFS.js +9 -15
  151. package/Source/Shaders/Voxels/convertUvToCylinder.glsl +15 -15
  152. package/Source/Shaders/Voxels/convertUvToCylinder.js +15 -15
  153. package/index.d.ts +176 -79
  154. package/index.js +413 -409
  155. package/package.json +2 -2
  156. package/Source/Scene/TextureAtlas.js +0 -558
@@ -2,30 +2,32 @@ import buildVoxelDrawCommands from "./buildVoxelDrawCommands.js";
2
2
  import Cartesian2 from "../Core/Cartesian2.js";
3
3
  import Cartesian3 from "../Core/Cartesian3.js";
4
4
  import Cartesian4 from "../Core/Cartesian4.js";
5
+ import Cartographic from "../Core/Cartographic.js";
6
+ import Cesium3DTilesetStatistics from "./Cesium3DTilesetStatistics.js";
5
7
  import CesiumMath from "../Core/Math.js";
6
8
  import Check from "../Core/Check.js";
7
- import clone from "../Core/clone.js";
8
9
  import Color from "../Core/Color.js";
10
+ import ClippingPlaneCollection from "./ClippingPlaneCollection.js";
11
+ import clone from "../Core/clone.js";
12
+ import CustomShader from "./Model/CustomShader.js";
9
13
  import defaultValue from "../Core/defaultValue.js";
10
14
  import defined from "../Core/defined.js";
11
15
  import destroyObject from "../Core/destroyObject.js";
16
+ import Ellipsoid from "../Core/Ellipsoid.js";
12
17
  import Event from "../Core/Event.js";
13
18
  import JulianDate from "../Core/JulianDate.js";
19
+ import Material from "./Material.js";
14
20
  import Matrix3 from "../Core/Matrix3.js";
15
21
  import Matrix4 from "../Core/Matrix4.js";
16
- import oneTimeWarning from "../Core/oneTimeWarning.js";
17
- import ClippingPlaneCollection from "./ClippingPlaneCollection.js";
18
- import Material from "./Material.js";
19
22
  import MetadataComponentType from "./MetadataComponentType.js";
20
23
  import MetadataType from "./MetadataType.js";
24
+ import oneTimeWarning from "../Core/oneTimeWarning.js";
21
25
  import PolylineCollection from "./PolylineCollection.js";
26
+ import VerticalExaggeration from "../Core/VerticalExaggeration.js";
27
+ import VoxelContent from "./VoxelContent.js";
22
28
  import VoxelShapeType from "./VoxelShapeType.js";
23
29
  import VoxelTraversal from "./VoxelTraversal.js";
24
- import CustomShader from "./Model/CustomShader.js";
25
- import Cartographic from "../Core/Cartographic.js";
26
- import Ellipsoid from "../Core/Ellipsoid.js";
27
- import VerticalExaggeration from "../Core/VerticalExaggeration.js";
28
- import Cesium3DTilesetStatistics from "./Cesium3DTilesetStatistics.js";
30
+ import VoxelMetadataOrder from "./VoxelMetadataOrder.js";
29
31
 
30
32
  /**
31
33
  * A primitive that renders voxel data from a {@link VoxelProvider}.
@@ -38,6 +40,7 @@ import Cesium3DTilesetStatistics from "./Cesium3DTilesetStatistics.js";
38
40
  * @param {Matrix4} [options.modelMatrix=Matrix4.IDENTITY] The model matrix used to transform the primitive.
39
41
  * @param {CustomShader} [options.customShader] The custom shader used to style the primitive.
40
42
  * @param {Clock} [options.clock] The clock used to control time dynamic behavior.
43
+ * @param {Boolean} [options.calculateStatistics] Generate statistics for performance profile.
41
44
  *
42
45
  * @see VoxelProvider
43
46
  * @see Cesium3DTilesVoxelProvider
@@ -77,6 +80,12 @@ function VoxelPrimitive(options) {
77
80
  */
78
81
  this._statistics = new Cesium3DTilesetStatistics();
79
82
 
83
+ /**
84
+ * @type {boolean}
85
+ * @private
86
+ */
87
+ this._calculateStatistics = defaultValue(options.calculateStatistics, false);
88
+
80
89
  /**
81
90
  * This member is not created until the provider is ready.
82
91
  *
@@ -91,6 +100,22 @@ function VoxelPrimitive(options) {
91
100
  */
92
101
  this._shapeVisible = false;
93
102
 
103
+ /**
104
+ * This member is not created until the provider is ready.
105
+ *
106
+ * @type {Cartesian3}
107
+ * @private
108
+ */
109
+ this._dimensions = new Cartesian3();
110
+
111
+ /**
112
+ * This member is not created until the provider is ready.
113
+ *
114
+ * @type {Cartesian3}
115
+ * @private
116
+ */
117
+ this._inputDimensions = new Cartesian3();
118
+
94
119
  /**
95
120
  * This member is not created until the provider is ready.
96
121
  *
@@ -418,6 +443,7 @@ function VoxelPrimitive(options) {
418
443
  megatextureSliceSizeUv: new Cartesian2(),
419
444
  megatextureTileSizeUv: new Cartesian2(),
420
445
  dimensions: new Cartesian3(),
446
+ inputDimensions: new Cartesian3(),
421
447
  paddingBefore: new Cartesian3(),
422
448
  paddingAfter: new Cartesian3(),
423
449
  transformPositionViewToUv: new Matrix4(),
@@ -705,7 +731,8 @@ Object.defineProperties(VoxelPrimitive.prototype, {
705
731
  },
706
732
 
707
733
  /**
708
- * Gets the voxel dimensions.
734
+ * Gets the dimensions of each voxel tile, in z-up orientation.
735
+ * Does not include padding.
709
736
  *
710
737
  * @memberof VoxelPrimitive.prototype
711
738
  * @type {Cartesian3}
@@ -713,7 +740,46 @@ Object.defineProperties(VoxelPrimitive.prototype, {
713
740
  */
714
741
  dimensions: {
715
742
  get: function () {
716
- return this._provider.dimensions;
743
+ return this._dimensions;
744
+ },
745
+ },
746
+
747
+ /**
748
+ * Gets the dimensions of one tile of the input voxel data, in the input orientation.
749
+ * Includes padding.
750
+ * @memberof VoxelPrimitive.prototype
751
+ * @type {Cartesian3}
752
+ * @readonly
753
+ */
754
+ inputDimensions: {
755
+ get: function () {
756
+ return this._inputDimensions;
757
+ },
758
+ },
759
+
760
+ /**
761
+ * Gets the padding before the voxel data.
762
+ *
763
+ * @memberof VoxelPrimitive.prototype
764
+ * @type {Cartesian3}
765
+ * @readonly
766
+ */
767
+ paddingBefore: {
768
+ get: function () {
769
+ return this._paddingBefore;
770
+ },
771
+ },
772
+
773
+ /**
774
+ * Gets the padding after the voxel data.
775
+ *
776
+ * @memberof VoxelPrimitive.prototype
777
+ * @type {Cartesian3}
778
+ * @readonly
779
+ */
780
+ paddingAfter: {
781
+ get: function () {
782
+ return this._paddingAfter;
717
783
  },
718
784
  },
719
785
 
@@ -1059,9 +1125,21 @@ Object.defineProperties(VoxelPrimitive.prototype, {
1059
1125
  return this._customShaderCompilationEvent;
1060
1126
  },
1061
1127
  },
1128
+
1129
+ /**
1130
+ * Loading and rendering information for requested content
1131
+ * To use `visited` and `numberOfTilesWithContentReady` statistics, set options._calculateStatistics` to `true` in the constructor.
1132
+ * @type {Cesium3DTilesetStatistics}
1133
+ * @readonly
1134
+ * @private
1135
+ */
1136
+ statistics: {
1137
+ get: function () {
1138
+ return this._statistics;
1139
+ },
1140
+ },
1062
1141
  });
1063
1142
 
1064
- const scratchDimensions = new Cartesian3();
1065
1143
  const scratchIntersect = new Cartesian4();
1066
1144
  const scratchNdcAabb = new Cartesian4();
1067
1145
  const scratchScale = new Cartesian3();
@@ -1397,8 +1475,12 @@ function initFromProvider(primitive, provider, context) {
1397
1475
 
1398
1476
  // Set uniforms that come from the provider.
1399
1477
  // Note that minBounds and maxBounds can be set dynamically, so their uniforms aren't set here.
1400
- uniforms.dimensions = Cartesian3.clone(
1478
+ primitive._dimensions = Cartesian3.clone(
1401
1479
  provider.dimensions,
1480
+ primitive._dimensions,
1481
+ );
1482
+ uniforms.dimensions = Cartesian3.clone(
1483
+ primitive._dimensions,
1402
1484
  uniforms.dimensions,
1403
1485
  );
1404
1486
  primitive._paddingBefore = Cartesian3.clone(
@@ -1411,15 +1493,37 @@ function initFromProvider(primitive, provider, context) {
1411
1493
  );
1412
1494
  primitive._paddingAfter = Cartesian3.clone(
1413
1495
  defaultValue(provider.paddingAfter, Cartesian3.ZERO),
1414
- primitive._paddingBefore,
1496
+ primitive._paddingAfter,
1415
1497
  );
1416
1498
  uniforms.paddingAfter = Cartesian3.clone(
1417
1499
  primitive._paddingAfter,
1418
1500
  uniforms.paddingAfter,
1419
1501
  );
1502
+ primitive._inputDimensions = Cartesian3.add(
1503
+ primitive._dimensions,
1504
+ primitive._paddingBefore,
1505
+ primitive._inputDimensions,
1506
+ );
1507
+ primitive._inputDimensions = Cartesian3.add(
1508
+ primitive._inputDimensions,
1509
+ primitive._paddingAfter,
1510
+ primitive._inputDimensions,
1511
+ );
1512
+ if (provider.metadataOrder === VoxelMetadataOrder.GLTF) {
1513
+ const inputDimensionsY = primitive._inputDimensions.y;
1514
+ primitive._inputDimensions.y = primitive._inputDimensions.z;
1515
+ primitive._inputDimensions.z = inputDimensionsY;
1516
+ }
1517
+ uniforms.inputDimensions = Cartesian3.clone(
1518
+ primitive._inputDimensions,
1519
+ uniforms.inputDimensions,
1520
+ );
1420
1521
 
1421
1522
  // Create the VoxelTraversal, and set related uniforms
1422
- primitive._traversal = setupTraversal(primitive, provider, context);
1523
+ const keyframeCount = defaultValue(provider.keyframeCount, 1);
1524
+ primitive._traversal = new VoxelTraversal(primitive, context, keyframeCount);
1525
+ primitive.statistics.texturesByteLength =
1526
+ primitive._traversal.textureMemoryByteLength;
1423
1527
  setTraversalUniforms(primitive._traversal, uniforms);
1424
1528
  }
1425
1529
 
@@ -1556,44 +1660,6 @@ function updateShapeAndTransforms(primitive, shape, provider) {
1556
1660
  return true;
1557
1661
  }
1558
1662
 
1559
- /**
1560
- * Set up a VoxelTraversal based on dimensions and types from the primitive and provider
1561
- * @param {VoxelPrimitive} primitive
1562
- * @param {VoxelProvider} provider
1563
- * @param {Context} context
1564
- * @returns {VoxelTraversal}
1565
- * @private
1566
- */
1567
- function setupTraversal(primitive, provider, context) {
1568
- const dimensions = Cartesian3.clone(provider.dimensions, scratchDimensions);
1569
- Cartesian3.add(dimensions, primitive._paddingBefore, dimensions);
1570
- Cartesian3.add(dimensions, primitive._paddingAfter, dimensions);
1571
-
1572
- // It's ok for memory byte length to be undefined.
1573
- // The system will choose a default memory size.
1574
- const maximumTileCount = provider.maximumTileCount;
1575
- const maximumTextureMemoryByteLength = defined(maximumTileCount)
1576
- ? VoxelTraversal.getApproximateTextureMemoryByteLength(
1577
- maximumTileCount,
1578
- dimensions,
1579
- provider.types,
1580
- provider.componentTypes,
1581
- )
1582
- : undefined;
1583
-
1584
- const keyframeCount = defaultValue(provider.keyframeCount, 1);
1585
-
1586
- return new VoxelTraversal(
1587
- primitive,
1588
- context,
1589
- dimensions,
1590
- provider.types,
1591
- provider.componentTypes,
1592
- keyframeCount,
1593
- maximumTextureMemoryByteLength,
1594
- );
1595
- }
1596
-
1597
1663
  /**
1598
1664
  * Set uniforms that come from the traversal.
1599
1665
  * @param {VoxelTraversal} traversal
@@ -1798,6 +1864,7 @@ VoxelPrimitive.prototype.destroy = function () {
1798
1864
 
1799
1865
  this._pickId = this._pickId && this._pickId.destroy();
1800
1866
  this._traversal = this._traversal && this._traversal.destroy();
1867
+ this.statistics.texturesByteLength = 0;
1801
1868
  this._clippingPlanes = this._clippingPlanes && this._clippingPlanes.destroy();
1802
1869
 
1803
1870
  return destroyObject(this);
@@ -2079,7 +2146,8 @@ DefaultVoxelProvider.prototype.requestData = function (options) {
2079
2146
  return undefined;
2080
2147
  }
2081
2148
 
2082
- return Promise.resolve([new Float32Array(1)]);
2149
+ const content = new VoxelContent({ metadata: [new Float32Array(1)] });
2150
+ return Promise.resolve(content);
2083
2151
  };
2084
2152
 
2085
2153
  VoxelPrimitive.DefaultProvider = new DefaultVoxelProvider();
@@ -19,10 +19,11 @@ function VoxelProvider() {
19
19
 
20
20
  Object.defineProperties(VoxelProvider.prototype, {
21
21
  /**
22
- * A transform from local space to global space. If undefined, the identity matrix will be used instead.
22
+ * A transform from local space to global space.
23
23
  *
24
24
  * @memberof VoxelProvider.prototype
25
- * @type {Matrix4|undefined}
25
+ * @type {Matrix4}
26
+ * @default Matrix4.IDENTITY
26
27
  * @readonly
27
28
  */
28
29
  globalTransform: {
@@ -30,10 +31,11 @@ Object.defineProperties(VoxelProvider.prototype, {
30
31
  },
31
32
 
32
33
  /**
33
- * A transform from shape space to local space. If undefined, the identity matrix will be used instead.
34
+ * A transform from shape space to local space.
34
35
  *
35
36
  * @memberof VoxelProvider.prototype
36
- * @type {Matrix4|undefined}
37
+ * @type {Matrix4}
38
+ * @default Matrix4.IDENTITY
37
39
  * @readonly
38
40
  */
39
41
  shapeTransform: {
@@ -42,7 +44,6 @@ Object.defineProperties(VoxelProvider.prototype, {
42
44
 
43
45
  /**
44
46
  * Gets the {@link VoxelShapeType}
45
- * This should not be called before {@link VoxelProvider#ready} returns true.
46
47
  *
47
48
  * @memberof VoxelProvider.prototype
48
49
  * @type {VoxelShapeType}
@@ -55,7 +56,6 @@ Object.defineProperties(VoxelProvider.prototype, {
55
56
  /**
56
57
  * Gets the minimum bounds.
57
58
  * If undefined, the shape's default minimum bounds will be used instead.
58
- * This should not be called before {@link VoxelProvider#ready} returns true.
59
59
  *
60
60
  * @memberof VoxelProvider.prototype
61
61
  * @type {Cartesian3|undefined}
@@ -68,7 +68,6 @@ Object.defineProperties(VoxelProvider.prototype, {
68
68
  /**
69
69
  * Gets the maximum bounds.
70
70
  * If undefined, the shape's default maximum bounds will be used instead.
71
- * This should not be called before {@link VoxelProvider#ready} returns true.
72
71
  *
73
72
  * @memberof VoxelProvider.prototype
74
73
  * @type {Cartesian3|undefined}
@@ -80,7 +79,6 @@ Object.defineProperties(VoxelProvider.prototype, {
80
79
 
81
80
  /**
82
81
  * Gets the number of voxels per dimension of a tile. This is the same for all tiles in the dataset.
83
- * This should not be called before {@link VoxelProvider#ready} returns true.
84
82
  *
85
83
  * @memberof VoxelProvider.prototype
86
84
  * @type {Cartesian3}
@@ -92,10 +90,10 @@ Object.defineProperties(VoxelProvider.prototype, {
92
90
 
93
91
  /**
94
92
  * Gets the number of padding voxels before the tile. This improves rendering quality when sampling the edge of a tile, but it increases memory usage.
95
- * This should not be called before {@link VoxelProvider#ready} returns true.
96
93
  *
97
94
  * @memberof VoxelProvider.prototype
98
- * @type {Cartesian3|undefined}
95
+ * @type {Cartesian3}
96
+ * @default Cartesian3.ZERO
99
97
  * @readonly
100
98
  */
101
99
  paddingBefore: {
@@ -104,10 +102,10 @@ Object.defineProperties(VoxelProvider.prototype, {
104
102
 
105
103
  /**
106
104
  * Gets the number of padding voxels after the tile. This improves rendering quality when sampling the edge of a tile, but it increases memory usage.
107
- * This should not be called before {@link VoxelProvider#ready} returns true.
108
105
  *
109
106
  * @memberof VoxelProvider.prototype
110
- * @type {Cartesian3|undefined}
107
+ * @type {Cartesian3}
108
+ * @default Cartesian3.ZERO
111
109
  * @readonly
112
110
  */
113
111
  paddingAfter: {
@@ -116,7 +114,6 @@ Object.defineProperties(VoxelProvider.prototype, {
116
114
 
117
115
  /**
118
116
  * Gets the metadata names.
119
- * This should not be called before {@link VoxelProvider#ready} returns true.
120
117
  *
121
118
  * @memberof VoxelProvider.prototype
122
119
  * @type {string[]}
@@ -128,7 +125,6 @@ Object.defineProperties(VoxelProvider.prototype, {
128
125
 
129
126
  /**
130
127
  * Gets the metadata types.
131
- * This should not be called before {@link VoxelProvider#ready} returns true.
132
128
  *
133
129
  * @memberof VoxelProvider.prototype
134
130
  * @type {MetadataType[]}
@@ -140,7 +136,6 @@ Object.defineProperties(VoxelProvider.prototype, {
140
136
 
141
137
  /**
142
138
  * Gets the metadata component types.
143
- * This should not be called before {@link VoxelProvider#ready} returns true.
144
139
  *
145
140
  * @memberof VoxelProvider.prototype
146
141
  * @type {MetadataComponentType[]}
@@ -150,9 +145,20 @@ Object.defineProperties(VoxelProvider.prototype, {
150
145
  get: DeveloperError.throwInstantiationError,
151
146
  },
152
147
 
148
+ /**
149
+ * Gets the ordering of the metadata in the buffers.
150
+ *
151
+ * @memberof VoxelProvider.prototype
152
+ * @type {VoxelMetadataOrder}
153
+ * @default VoxelMetadataOrder.XYZ
154
+ * @readonly
155
+ */
156
+ metadataOrder: {
157
+ get: DeveloperError.throwInstantiationError,
158
+ },
159
+
153
160
  /**
154
161
  * Gets the metadata minimum values.
155
- * This should not be called before {@link VoxelProvider#ready} returns true.
156
162
  *
157
163
  * @memberof VoxelProvider.prototype
158
164
  * @type {number[][]|undefined}
@@ -164,7 +170,6 @@ Object.defineProperties(VoxelProvider.prototype, {
164
170
 
165
171
  /**
166
172
  * Gets the metadata maximum values.
167
- * This should not be called before {@link VoxelProvider#ready} returns true.
168
173
  *
169
174
  * @memberof VoxelProvider.prototype
170
175
  * @type {number[][]|undefined}
@@ -175,8 +180,9 @@ Object.defineProperties(VoxelProvider.prototype, {
175
180
  },
176
181
 
177
182
  /**
178
- * The maximum number of tiles that exist for this provider. This value is used as a hint to the voxel renderer to allocate an appropriate amount of GPU memory. If this value is not known it can be undefined.
179
- * This should not be called before {@link VoxelProvider#ready} returns true.
183
+ * The maximum number of tiles that exist for this provider.
184
+ * This value is used as a hint to the voxel renderer to allocate an appropriate amount of GPU memory.
185
+ * If this value is not known it can be undefined.
180
186
  *
181
187
  * @memberof VoxelProvider.prototype
182
188
  * @type {number|undefined}
@@ -198,10 +204,9 @@ Object.defineProperties(VoxelProvider.prototype, {
198
204
 
199
205
  /**
200
206
  * Gets the number of keyframes in the dataset.
201
- * This should not be called before {@link VoxelProvider#ready} returns true.
202
207
  *
203
208
  * @memberof VoxelProvider.prototype
204
- * @type {number}
209
+ * @type {number|undefined}
205
210
  * @readonly
206
211
  * @private
207
212
  */
@@ -210,11 +215,11 @@ Object.defineProperties(VoxelProvider.prototype, {
210
215
  },
211
216
 
212
217
  /**
213
- * Gets the {@link TimeIntervalCollection} for the dataset, or undefined if it doesn't have timestamps.
214
- * This should not be called before {@link VoxelProvider#ready} returns true.
218
+ * Gets the {@link TimeIntervalCollection} for the dataset,
219
+ * or undefined if it doesn't have timestamps.
215
220
  *
216
221
  * @memberof VoxelProvider.prototype
217
- * @type {TimeIntervalCollection}
222
+ * @type {TimeIntervalCollection|undefined}
218
223
  * @readonly
219
224
  * @private
220
225
  */
@@ -224,9 +229,7 @@ Object.defineProperties(VoxelProvider.prototype, {
224
229
  });
225
230
 
226
231
  /**
227
- * Requests the data for a given tile. The data is a flattened 3D array ordered by X, then Y, then Z.
228
- * This function should not be called before {@link VoxelProvider#ready} returns true.
229
- * @function
232
+ * Requests the data for a given tile.
230
233
  *
231
234
  * @param {object} [options] Object with the following properties:
232
235
  * @param {number} [options.tileLevel=0] The tile's level.
@@ -234,8 +237,10 @@ Object.defineProperties(VoxelProvider.prototype, {
234
237
  * @param {number} [options.tileY=0] The tile's Y coordinate.
235
238
  * @param {number} [options.tileZ=0] The tile's Z coordinate.
236
239
  * @privateparam {number} [options.keyframe=0] The requested keyframe.
237
- * @returns {Promise<Array[]>|undefined} A promise to an array of typed arrays containing the requested voxel data or undefined if there was a problem loading the data.
240
+ * @returns {Promise<VoxelContent>|undefined} A promise resolving to a VoxelContent containing the data for the tile, or undefined if the request could not be scheduled this frame.
238
241
  */
239
- VoxelProvider.prototype.requestData = DeveloperError.throwInstantiationError;
242
+ VoxelProvider.prototype.requestData = function (options) {
243
+ DeveloperError.throwInstantiationError();
244
+ };
240
245
 
241
246
  export default VoxelProvider;
@@ -19,6 +19,7 @@ import convertUvToCylinder from "../Shaders/Voxels/convertUvToCylinder.js";
19
19
  import convertUvToEllipsoid from "../Shaders/Voxels/convertUvToEllipsoid.js";
20
20
  import Octree from "../Shaders/Voxels/Octree.js";
21
21
  import Megatexture from "../Shaders/Voxels/Megatexture.js";
22
+ import VoxelMetadataOrder from "./VoxelMetadataOrder.js";
22
23
 
23
24
  /**
24
25
  * Set up render resources, including basic shader code, for rendering
@@ -69,7 +70,7 @@ function VoxelRenderResources(primitive) {
69
70
  /**
70
71
  * A dictionary mapping uniform name to functions that return the uniform
71
72
  * values.
72
- *
73
+ * @private
73
74
  * @type {Object<string, Function>}
74
75
  */
75
76
  this.uniformMap = uniformMap;
@@ -86,6 +87,34 @@ function VoxelRenderResources(primitive) {
86
87
  // Build shader
87
88
  shaderBuilder.addVertexLines([VoxelVS]);
88
89
 
90
+ const shapeType = primitive._provider.shape;
91
+ if (primitive.provider.metadataOrder === VoxelMetadataOrder.GLTF) {
92
+ shaderBuilder.addDefine(
93
+ "GLTF_METADATA_ORDER",
94
+ undefined,
95
+ ShaderDestination.FRAGMENT,
96
+ );
97
+ if (shapeType === "BOX") {
98
+ shaderBuilder.addDefine(
99
+ "SHAPE_BOX",
100
+ undefined,
101
+ ShaderDestination.FRAGMENT,
102
+ );
103
+ } else if (shapeType === "CYLINDER") {
104
+ shaderBuilder.addDefine(
105
+ "SHAPE_CYLINDER",
106
+ undefined,
107
+ ShaderDestination.FRAGMENT,
108
+ );
109
+ } else if (shapeType === "ELLIPSOID") {
110
+ shaderBuilder.addDefine(
111
+ "SHAPE_ELLIPSOID",
112
+ undefined,
113
+ ShaderDestination.FRAGMENT,
114
+ );
115
+ }
116
+ }
117
+
89
118
  shaderBuilder.addFragmentLines([
90
119
  customShader.fragmentShaderText,
91
120
  "#line 0",
@@ -124,7 +153,6 @@ function VoxelRenderResources(primitive) {
124
153
  shaderBuilder.addFragmentLines([IntersectDepth]);
125
154
  }
126
155
 
127
- const shapeType = primitive._provider.shape;
128
156
  if (shapeType === "BOX") {
129
157
  shaderBuilder.addFragmentLines([
130
158
  convertUvToBox,
@@ -139,11 +167,6 @@ function VoxelRenderResources(primitive) {
139
167
  Intersection,
140
168
  ]);
141
169
  } else if (shapeType === "ELLIPSOID") {
142
- shaderBuilder.addDefine(
143
- "SHAPE_ELLIPSOID",
144
- undefined,
145
- ShaderDestination.FRAGMENT,
146
- );
147
170
  shaderBuilder.addFragmentLines([
148
171
  convertUvToEllipsoid,
149
172
  IntersectLongitude,
@@ -26,6 +26,7 @@ Object.defineProperties(VoxelShape.prototype, {
26
26
  * @memberof VoxelShape.prototype
27
27
  * @type {OrientedBoundingBox}
28
28
  * @readonly
29
+ * @private
29
30
  */
30
31
  orientedBoundingBox: {
31
32
  get: DeveloperError.throwInstantiationError,
@@ -38,6 +39,7 @@ Object.defineProperties(VoxelShape.prototype, {
38
39
  * @memberof VoxelShape.prototype
39
40
  * @type {BoundingSphere}
40
41
  * @readonly
42
+ * @private
41
43
  */
42
44
  boundingSphere: {
43
45
  get: DeveloperError.throwInstantiationError,
@@ -50,6 +52,7 @@ Object.defineProperties(VoxelShape.prototype, {
50
52
  * @memberof VoxelShape.prototype
51
53
  * @type {Matrix4}
52
54
  * @readonly
55
+ * @private
53
56
  */
54
57
  boundTransform: {
55
58
  get: DeveloperError.throwInstantiationError,
@@ -62,6 +65,7 @@ Object.defineProperties(VoxelShape.prototype, {
62
65
  * @memberof VoxelShape.prototype
63
66
  * @type {Matrix4}
64
67
  * @readonly
68
+ * @private
65
69
  */
66
70
  shapeTransform: {
67
71
  get: DeveloperError.throwInstantiationError,
@@ -70,6 +74,7 @@ Object.defineProperties(VoxelShape.prototype, {
70
74
  /**
71
75
  * @type {Object<string, any>}
72
76
  * @readonly
77
+ * @private
73
78
  */
74
79
  shaderUniforms: {
75
80
  get: DeveloperError.throwInstantiationError,
@@ -78,6 +83,7 @@ Object.defineProperties(VoxelShape.prototype, {
78
83
  /**
79
84
  * @type {Object<string, any>}
80
85
  * @readonly
86
+ * @private
81
87
  */
82
88
  shaderDefines: {
83
89
  get: DeveloperError.throwInstantiationError,
@@ -87,6 +93,7 @@ Object.defineProperties(VoxelShape.prototype, {
87
93
  * The maximum number of intersections against the shape for any ray direction.
88
94
  * @type {number}
89
95
  * @readonly
96
+ * @private
90
97
  */
91
98
  shaderMaximumIntersectionsLength: {
92
99
  get: DeveloperError.throwInstantiationError,
@@ -95,7 +102,7 @@ Object.defineProperties(VoxelShape.prototype, {
95
102
 
96
103
  /**
97
104
  * Update the shape's state.
98
- *
105
+ * @private
99
106
  * @param {Matrix4} modelMatrix The model matrix.
100
107
  * @param {Cartesian3} minBounds The minimum bounds.
101
108
  * @param {Cartesian3} maxBounds The maximum bounds.
@@ -106,7 +113,7 @@ VoxelShape.prototype.update = DeveloperError.throwInstantiationError;
106
113
  /**
107
114
  * Computes an oriented bounding box for a specified tile.
108
115
  * The update function must be called before calling this function.
109
- *
116
+ * @private
110
117
  * @param {number} tileLevel The tile's level.
111
118
  * @param {number} tileX The tile's x coordinate.
112
119
  * @param {number} tileY The tile's y coordinate.
@@ -120,7 +127,7 @@ VoxelShape.prototype.computeOrientedBoundingBoxForTile =
120
127
  /**
121
128
  * Computes an oriented bounding box for a specified sample within a specified tile.
122
129
  * The update function must be called before calling this function.
123
- *
130
+ * @private
124
131
  * @param {SpatialNode} spatialNode The spatial node containing the sample
125
132
  * @param {Cartesian3} tileDimensions The size of the tile in number of samples, before padding
126
133
  * @param {Cartesian3} tileUv The sample coordinate within the tile