GeometryOffsetAttribute-3e8c299c.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /* This file is automatically rebuilt by the Cesium build process. */
  2. define(['exports', './RuntimeError-c581ca93', './defaultValue-94c3e563'], (function (exports, RuntimeError, defaultValue) { 'use strict';
  3. /**
  4. * Fill an array or a portion of an array with a given value.
  5. *
  6. * @param {Array} array The array to fill.
  7. * @param {*} value The value to fill the array with.
  8. * @param {Number} [start=0] The index to start filling at.
  9. * @param {Number} [end=array.length] The index to end stop at.
  10. *
  11. * @returns {Array} The resulting array.
  12. * @private
  13. */
  14. function arrayFill(array, value, start, end) {
  15. //>>includeStart('debug', pragmas.debug);
  16. RuntimeError.Check.defined("array", array);
  17. RuntimeError.Check.defined("value", value);
  18. if (defaultValue.defined(start)) {
  19. RuntimeError.Check.typeOf.number("start", start);
  20. }
  21. if (defaultValue.defined(end)) {
  22. RuntimeError.Check.typeOf.number("end", end);
  23. }
  24. //>>includeEnd('debug');
  25. if (typeof array.fill === "function") {
  26. return array.fill(value, start, end);
  27. }
  28. const length = array.length >>> 0;
  29. const relativeStart = defaultValue.defaultValue(start, 0);
  30. // If negative, find wrap around position
  31. let k =
  32. relativeStart < 0
  33. ? Math.max(length + relativeStart, 0)
  34. : Math.min(relativeStart, length);
  35. const relativeEnd = defaultValue.defaultValue(end, length);
  36. // If negative, find wrap around position
  37. const last =
  38. relativeEnd < 0
  39. ? Math.max(length + relativeEnd, 0)
  40. : Math.min(relativeEnd, length);
  41. // Fill array accordingly
  42. while (k < last) {
  43. array[k] = value;
  44. k++;
  45. }
  46. return array;
  47. }
  48. /**
  49. * Represents which vertices should have a value of `true` for the `applyOffset` attribute
  50. * @private
  51. */
  52. const GeometryOffsetAttribute = {
  53. NONE: 0,
  54. TOP: 1,
  55. ALL: 2,
  56. };
  57. var GeometryOffsetAttribute$1 = Object.freeze(GeometryOffsetAttribute);
  58. exports.GeometryOffsetAttribute = GeometryOffsetAttribute$1;
  59. exports.arrayFill = arrayFill;
  60. }));