PackableForInterpolation.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import DeveloperError from "./DeveloperError.js";
  2. /**
  3. * Static interface for {@link Packable} types which are interpolated in a
  4. * different representation than their packed value. These methods and
  5. * properties are expected to be defined on a constructor function.
  6. *
  7. * @namespace PackableForInterpolation
  8. *
  9. * @see Packable
  10. */
  11. const PackableForInterpolation = {
  12. /**
  13. * The number of elements used to store the object into an array in its interpolatable form.
  14. * @type {Number}
  15. */
  16. packedInterpolationLength: undefined,
  17. /**
  18. * Converts a packed array into a form suitable for interpolation.
  19. * @function
  20. *
  21. * @param {Number[]} packedArray The packed array.
  22. * @param {Number} [startingIndex=0] The index of the first element to be converted.
  23. * @param {Number} [lastIndex=packedArray.length] The index of the last element to be converted.
  24. * @param {Number[]} [result] The object into which to store the result.
  25. */
  26. convertPackedArrayForInterpolation: DeveloperError.throwInstantiationError,
  27. /**
  28. * Retrieves an instance from a packed array converted with {@link PackableForInterpolation.convertPackedArrayForInterpolation}.
  29. * @function
  30. *
  31. * @param {Number[]} array The array previously packed for interpolation.
  32. * @param {Number[]} sourceArray The original packed array.
  33. * @param {Number} [startingIndex=0] The startingIndex used to convert the array.
  34. * @param {Number} [lastIndex=packedArray.length] The lastIndex used to convert the array.
  35. * @param {Object} [result] The object into which to store the result.
  36. * @returns {Object} The modified result parameter or a new Object instance if one was not provided.
  37. */
  38. unpackInterpolationResult: DeveloperError.throwInstantiationError,
  39. };
  40. export default PackableForInterpolation;