ImplicitSubdivisionScheme.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import DeveloperError from "../Core/DeveloperError.js";
  2. /**
  3. * The subdivision scheme for an implicit tileset.
  4. *
  5. * @enum {String}
  6. * @private
  7. * @experimental This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
  8. */
  9. const ImplicitSubdivisionScheme = {
  10. /**
  11. * A quadtree divides a parent tile into four children, split at the midpoint
  12. * of the x and y dimensions of the bounding box
  13. * @type {String}
  14. * @constant
  15. * @private
  16. */
  17. QUADTREE: "QUADTREE",
  18. /**
  19. * An octree divides a parent tile into eight children, split at the midpoint
  20. * of the x, y, and z dimensions of the bounding box.
  21. * @type {String}
  22. * @constant
  23. * @private
  24. */
  25. OCTREE: "OCTREE",
  26. };
  27. /**
  28. * Get the branching factor for the given subdivision scheme
  29. * @param {ImplicitSubdivisionScheme} subdivisionScheme The subdivision scheme
  30. * @returns {Number} The branching factor, either 4 for QUADTREE or 8 for OCTREE
  31. * @private
  32. */
  33. ImplicitSubdivisionScheme.getBranchingFactor = function (subdivisionScheme) {
  34. switch (subdivisionScheme) {
  35. case ImplicitSubdivisionScheme.OCTREE:
  36. return 8;
  37. case ImplicitSubdivisionScheme.QUADTREE:
  38. return 4;
  39. //>>includeStart('debug', pragmas.debug);
  40. default:
  41. throw new DeveloperError("subdivisionScheme is not a valid value.");
  42. //>>includeEnd('debug');
  43. }
  44. };
  45. export default Object.freeze(ImplicitSubdivisionScheme);