All files / engine/Source/Scene ImplicitSubdivisionScheme.js

100% Statements 6/6
100% Branches 3/3
100% Functions 1/1
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49                  1x                                                 1x 2055x   1350x   704x     1x            
import DeveloperError from "../Core/DeveloperError.js";
 
/**
 * The subdivision scheme for an implicit tileset.
 *
 * @enum {string}
 * @private
 * @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.
 */
const ImplicitSubdivisionScheme = {
  /**
   * A quadtree divides a parent tile into four children, split at the midpoint
   * of the x and y dimensions of the bounding box
   * @type {string}
   * @constant
   * @private
   */
  QUADTREE: "QUADTREE",
  /**
   * An octree divides a parent tile into eight children, split at the midpoint
   * of the x, y, and z dimensions of the bounding box.
   * @type {string}
   * @constant
   * @private
   */
  OCTREE: "OCTREE",
};
 
/**
 * Get the branching factor for the given subdivision scheme
 * @param {ImplicitSubdivisionScheme} subdivisionScheme The subdivision scheme
 * @returns {number} The branching factor, either 4 for QUADTREE or 8 for OCTREE
 * @private
 */
ImplicitSubdivisionScheme.getBranchingFactor = function (subdivisionScheme) {
  switch (subdivisionScheme) {
    case ImplicitSubdivisionScheme.OCTREE:
      return 8;
    case ImplicitSubdivisionScheme.QUADTREE:
      return 4;
    //>>includeStart('debug', pragmas.debug);
    default:
      throw new DeveloperError("subdivisionScheme is not a valid value.");
    //>>includeEnd('debug');
  }
};
 
export default Object.freeze(ImplicitSubdivisionScheme);