VoxelProvider.js 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. import DeveloperError from "../Core/DeveloperError.js";
  2. /**
  3. * Provides voxel data. Intended to be used with {@link VoxelPrimitive}.
  4. * This type describes an interface and is not intended to be instantiated directly.
  5. *
  6. * @alias VoxelProvider
  7. * @constructor
  8. *
  9. * @see Cesium3DTilesVoxelProvider
  10. * @see VoxelPrimitive
  11. * @see VoxelShapeType
  12. *
  13. * @experimental This feature is not final and is subject to change without Cesium's standard deprecation policy.
  14. */
  15. function VoxelProvider() {
  16. DeveloperError.throwInstantiationError();
  17. }
  18. Object.defineProperties(VoxelProvider.prototype, {
  19. /**
  20. * Gets a value indicating whether or not the provider is ready for use.
  21. *
  22. * @memberof VoxelProvider.prototype
  23. * @type {boolean}
  24. * @readonly
  25. * @deprecated
  26. */
  27. ready: {
  28. get: DeveloperError.throwInstantiationError,
  29. },
  30. /**
  31. * Gets the promise that will be resolved when the provider is ready for use.
  32. *
  33. * @memberof VoxelProvider.prototype
  34. * @type {Promise<VoxelProvider>}
  35. * @readonly
  36. * @deprecated
  37. */
  38. readyPromise: {
  39. get: DeveloperError.throwInstantiationError,
  40. },
  41. /**
  42. * A transform from local space to global space. If undefined, the identity matrix will be used instead.
  43. *
  44. * @memberof VoxelProvider.prototype
  45. * @type {Matrix4|undefined}
  46. * @readonly
  47. */
  48. globalTransform: {
  49. get: DeveloperError.throwInstantiationError,
  50. },
  51. /**
  52. * A transform from shape space to local space. If undefined, the identity matrix will be used instead.
  53. *
  54. * @memberof VoxelProvider.prototype
  55. * @type {Matrix4|undefined}
  56. * @readonly
  57. */
  58. shapeTransform: {
  59. get: DeveloperError.throwInstantiationError,
  60. },
  61. /**
  62. * Gets the {@link VoxelShapeType}
  63. * This should not be called before {@link VoxelProvider#ready} returns true.
  64. *
  65. * @memberof VoxelProvider.prototype
  66. * @type {VoxelShapeType}
  67. * @readonly
  68. */
  69. shape: {
  70. get: DeveloperError.throwInstantiationError,
  71. },
  72. /**
  73. * Gets the minimum bounds.
  74. * If undefined, the shape's default minimum bounds will be used instead.
  75. * This should not be called before {@link VoxelProvider#ready} returns true.
  76. *
  77. * @memberof VoxelProvider.prototype
  78. * @type {Cartesian3|undefined}
  79. * @readonly
  80. */
  81. minBounds: {
  82. get: DeveloperError.throwInstantiationError,
  83. },
  84. /**
  85. * Gets the maximum bounds.
  86. * If undefined, the shape's default maximum bounds will be used instead.
  87. * This should not be called before {@link VoxelProvider#ready} returns true.
  88. *
  89. * @memberof VoxelProvider.prototype
  90. * @type {Cartesian3|undefined}
  91. * @readonly
  92. */
  93. maxBounds: {
  94. get: DeveloperError.throwInstantiationError,
  95. },
  96. /**
  97. * Gets the number of voxels per dimension of a tile. This is the same for all tiles in the dataset.
  98. * This should not be called before {@link VoxelProvider#ready} returns true.
  99. *
  100. * @memberof VoxelProvider.prototype
  101. * @type {Cartesian3}
  102. * @readonly
  103. */
  104. dimensions: {
  105. get: DeveloperError.throwInstantiationError,
  106. },
  107. /**
  108. * 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.
  109. * This should not be called before {@link VoxelProvider#ready} returns true.
  110. *
  111. * @memberof VoxelProvider.prototype
  112. * @type {Cartesian3|undefined}
  113. * @readonly
  114. */
  115. paddingBefore: {
  116. get: DeveloperError.throwInstantiationError,
  117. },
  118. /**
  119. * 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.
  120. * This should not be called before {@link VoxelProvider#ready} returns true.
  121. *
  122. * @memberof VoxelProvider.prototype
  123. * @type {Cartesian3|undefined}
  124. * @readonly
  125. */
  126. paddingAfter: {
  127. get: DeveloperError.throwInstantiationError,
  128. },
  129. /**
  130. * Gets the metadata names.
  131. * This should not be called before {@link VoxelProvider#ready} returns true.
  132. *
  133. * @memberof VoxelProvider.prototype
  134. * @type {string[]}
  135. * @readonly
  136. */
  137. names: {
  138. get: DeveloperError.throwInstantiationError,
  139. },
  140. /**
  141. * Gets the metadata types.
  142. * This should not be called before {@link VoxelProvider#ready} returns true.
  143. *
  144. * @memberof VoxelProvider.prototype
  145. * @type {MetadataType[]}
  146. * @readonly
  147. */
  148. types: {
  149. get: DeveloperError.throwInstantiationError,
  150. },
  151. /**
  152. * Gets the metadata component types.
  153. * This should not be called before {@link VoxelProvider#ready} returns true.
  154. *
  155. * @memberof VoxelProvider.prototype
  156. * @type {MetadataComponentType[]}
  157. * @readonly
  158. */
  159. componentTypes: {
  160. get: DeveloperError.throwInstantiationError,
  161. },
  162. /**
  163. * Gets the metadata minimum values.
  164. * This should not be called before {@link VoxelProvider#ready} returns true.
  165. *
  166. * @memberof VoxelProvider.prototype
  167. * @type {number[][]|undefined}
  168. * @readonly
  169. */
  170. minimumValues: {
  171. get: DeveloperError.throwInstantiationError,
  172. },
  173. /**
  174. * Gets the metadata maximum values.
  175. * This should not be called before {@link VoxelProvider#ready} returns true.
  176. *
  177. * @memberof VoxelProvider.prototype
  178. * @type {number[][]|undefined}
  179. * @readonly
  180. */
  181. maximumValues: {
  182. get: DeveloperError.throwInstantiationError,
  183. },
  184. /**
  185. * 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.
  186. * This should not be called before {@link VoxelProvider#ready} returns true.
  187. *
  188. * @memberof VoxelProvider.prototype
  189. * @type {number|undefined}
  190. * @readonly
  191. */
  192. maximumTileCount: {
  193. get: DeveloperError.throwInstantiationError,
  194. },
  195. /**
  196. * Gets the number of keyframes in the dataset.
  197. * This should not be called before {@link VoxelProvider#ready} returns true.
  198. *
  199. * @memberof VoxelProvider.prototype
  200. * @type {number}
  201. * @readonly
  202. * @private
  203. */
  204. keyframeCount: {
  205. get: DeveloperError.throwInstantiationError,
  206. },
  207. /**
  208. * Gets the {@link TimeIntervalCollection} for the dataset, or undefined if it doesn't have timestamps.
  209. * This should not be called before {@link VoxelProvider#ready} returns true.
  210. *
  211. * @memberof VoxelProvider.prototype
  212. * @type {TimeIntervalCollection}
  213. * @readonly
  214. * @private
  215. */
  216. timeIntervalCollection: {
  217. get: DeveloperError.throwInstantiationError,
  218. },
  219. });
  220. /**
  221. * Requests the data for a given tile. The data is a flattened 3D array ordered by X, then Y, then Z.
  222. * This function should not be called before {@link VoxelProvider#ready} returns true.
  223. * @function
  224. *
  225. * @param {object} [options] Object with the following properties:
  226. * @param {number} [options.tileLevel=0] The tile's level.
  227. * @param {number} [options.tileX=0] The tile's X coordinate.
  228. * @param {number} [options.tileY=0] The tile's Y coordinate.
  229. * @param {number} [options.tileZ=0] The tile's Z coordinate.
  230. * @privateparam {number} [options.keyframe=0] The requested keyframe.
  231. * @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.
  232. */
  233. VoxelProvider.prototype.requestData = DeveloperError.throwInstantiationError;
  234. export default VoxelProvider;