GeometryOffsetAttribute-cb30cd97.js 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* This file is automatically rebuilt by the Cesium build process. */
  2. define(['exports', './defined-26bd4a03', './Check-da037458', './freezeObject-2d83f591', './defaultValue-f2e68450'], function (exports, defined, Check, freezeObject, 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. Check.Check.defined('array', array);
  17. Check.Check.defined('value', value);
  18. if (defined.defined(start)) {
  19. Check.Check.typeOf.number('start', start);
  20. }
  21. if (defined.defined(end)) {
  22. Check.Check.typeOf.number('end', end);
  23. }
  24. //>>includeEnd('debug');
  25. if (typeof array.fill === 'function') {
  26. return array.fill(value, start, end);
  27. }
  28. var length = array.length >>> 0;
  29. var relativeStart = defaultValue.defaultValue(start, 0);
  30. // If negative, find wrap around position
  31. var k = (relativeStart < 0) ? Math.max(length + relativeStart, 0) : Math.min(relativeStart, length);
  32. var relativeEnd = defaultValue.defaultValue(end, length);
  33. // If negative, find wrap around position
  34. var last = (relativeEnd < 0) ? Math.max(length + relativeEnd, 0) : Math.min(relativeEnd, length);
  35. // Fill array accordingly
  36. while (k < last) {
  37. array[k] = value;
  38. k++;
  39. }
  40. return array;
  41. }
  42. /**
  43. * Represents which vertices should have a value of `true` for the `applyOffset` attribute
  44. * @private
  45. */
  46. var GeometryOffsetAttribute = {
  47. NONE : 0,
  48. TOP : 1,
  49. ALL : 2
  50. };
  51. var GeometryOffsetAttribute$1 = freezeObject.freezeObject(GeometryOffsetAttribute);
  52. exports.GeometryOffsetAttribute = GeometryOffsetAttribute$1;
  53. exports.arrayFill = arrayFill;
  54. });