智慧水务管理系统 - 精河县供水工程综合管理平台

DirectionalLight.js 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import Cartesian3 from "../Core/Cartesian3.js";
  2. import Check from "../Core/Check.js";
  3. import Color from "../Core/Color.js";
  4. import DeveloperError from "../Core/DeveloperError.js";
  5. /**
  6. * A light that gets emitted in a single direction from infinitely far away.
  7. *
  8. * @param {object} options Object with the following properties:
  9. * @param {Cartesian3} options.direction The direction in which light gets emitted.
  10. * @param {Color} [options.color=Color.WHITE] The color of the light.
  11. * @param {number} [options.intensity=1.0] The intensity of the light.
  12. *
  13. * @exception {DeveloperError} options.direction cannot be zero-length
  14. *
  15. * @alias DirectionalLight
  16. * @constructor
  17. */
  18. function DirectionalLight(options) {
  19. //>>includeStart('debug', pragmas.debug);
  20. Check.typeOf.object("options", options);
  21. Check.typeOf.object("options.direction", options.direction);
  22. if (Cartesian3.equals(options.direction, Cartesian3.ZERO)) {
  23. throw new DeveloperError("options.direction cannot be zero-length");
  24. }
  25. //>>includeEnd('debug');
  26. /**
  27. * The direction in which light gets emitted.
  28. * @type {Cartesian3}
  29. */
  30. this.direction = Cartesian3.clone(options.direction);
  31. /**
  32. * The color of the light.
  33. * @type {Color}
  34. * @default Color.WHITE
  35. */
  36. this.color = Color.clone(options.color ?? Color.WHITE);
  37. /**
  38. * The intensity of the light.
  39. * @type {number}
  40. * @default 1.0
  41. */
  42. this.intensity = options.intensity ?? 1.0;
  43. }
  44. export default DirectionalLight;