VoxelShape.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. import DeveloperError from "../Core/DeveloperError.js";
  2. /**
  3. * Controls per-shape behavior for culling and rendering voxel grids.
  4. * This type describes an interface and is not intended to be instantiated directly.
  5. *
  6. * @alias VoxelShape
  7. * @constructor
  8. *
  9. * @see VoxelBoxShape
  10. * @see VoxelEllipsoidShape
  11. * @see VoxelCylinderShape
  12. * @see VoxelShapeType
  13. *
  14. * @private
  15. */
  16. function VoxelShape() {
  17. DeveloperError.throwInstantiationError();
  18. }
  19. Object.defineProperties(VoxelShape.prototype, {
  20. /**
  21. * An oriented bounding box containing the bounded shape.
  22. * The update function must be called before accessing this value.
  23. *
  24. * @memberof VoxelShape.prototype
  25. * @type {OrientedBoundingBox}
  26. * @readonly
  27. */
  28. orientedBoundingBox: {
  29. get: DeveloperError.throwInstantiationError,
  30. },
  31. /**
  32. * A bounding sphere containing the bounded shape.
  33. * The update function must be called before accessing this value.
  34. *
  35. * @memberof VoxelShape.prototype
  36. * @type {BoundingSphere}
  37. * @readonly
  38. */
  39. boundingSphere: {
  40. get: DeveloperError.throwInstantiationError,
  41. },
  42. /**
  43. * A transformation matrix containing the bounded shape.
  44. * The update function must be called before accessing this value.
  45. *
  46. * @memberof VoxelShape.prototype
  47. * @type {Matrix4}
  48. * @readonly
  49. */
  50. boundTransform: {
  51. get: DeveloperError.throwInstantiationError,
  52. },
  53. /**
  54. * A transformation matrix containing the shape, ignoring the bounds.
  55. * The update function must be called before accessing this value.
  56. *
  57. * @memberof VoxelShape.prototype
  58. * @type {Matrix4}
  59. * @readonly
  60. */
  61. shapeTransform: {
  62. get: DeveloperError.throwInstantiationError,
  63. },
  64. /**
  65. * @type {Object<string, any>}
  66. * @readonly
  67. */
  68. shaderUniforms: {
  69. get: DeveloperError.throwInstantiationError,
  70. },
  71. /**
  72. * @type {Object<string, any>}
  73. * @readonly
  74. */
  75. shaderDefines: {
  76. get: DeveloperError.throwInstantiationError,
  77. },
  78. /**
  79. * The maximum number of intersections against the shape for any ray direction.
  80. * @type {number}
  81. * @readonly
  82. */
  83. shaderMaximumIntersectionsLength: {
  84. get: DeveloperError.throwInstantiationError,
  85. },
  86. });
  87. /**
  88. * Update the shape's state.
  89. *
  90. * @param {Matrix4} modelMatrix The model matrix.
  91. * @param {Cartesian3} minBounds The minimum bounds.
  92. * @param {Cartesian3} maxBounds The maximum bounds.
  93. * @returns {boolean} Whether the shape is visible.
  94. */
  95. VoxelShape.prototype.update = DeveloperError.throwInstantiationError;
  96. /**
  97. * Computes an oriented bounding box for a specified tile.
  98. * The update function must be called before calling this function.
  99. *
  100. * @param {number} tileLevel The tile's level.
  101. * @param {number} tileX The tile's x coordinate.
  102. * @param {number} tileY The tile's y coordinate.
  103. * @param {number} tileZ The tile's z coordinate.
  104. * @param {OrientedBoundingBox} result The oriented bounding box that will be set to enclose the specified tile.
  105. * @returns {OrientedBoundingBox} The oriented bounding box.
  106. */
  107. VoxelShape.prototype.computeOrientedBoundingBoxForTile =
  108. DeveloperError.throwInstantiationError;
  109. /**
  110. * Computes an approximate step size for raymarching the root tile of a voxel grid.
  111. * The update function must be called before calling this function.
  112. *
  113. * @param {Cartesian3} voxelDimensions The voxel grid dimensions for a tile.
  114. * @returns {number} The step size.
  115. */
  116. VoxelShape.prototype.computeApproximateStepSize =
  117. DeveloperError.throwInstantiationError;
  118. /**
  119. * Defines the minimum bounds of the shape. The meaning can vary per-shape.
  120. *
  121. * @type {Cartesian3}
  122. * @constant
  123. * @readonly
  124. *
  125. * @private
  126. */
  127. VoxelShape.DefaultMinBounds = DeveloperError.throwInstantiationError;
  128. /**
  129. * Defines the maximum bounds of the shape. The meaning can vary per-shape.
  130. *
  131. * @type {Cartesian3}
  132. * @constant
  133. * @readonly
  134. *
  135. * @private
  136. */
  137. VoxelShape.DefaultMaxBounds = DeveloperError.throwInstantiationError;
  138. export default VoxelShape;