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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. import Cartesian3 from "../Core/Cartesian3.js";
  2. import CesiumMath from "../Core/Math.js";
  3. import DynamicAtmosphereLightingType from "./DynamicAtmosphereLightingType.js";
  4. /**
  5. * Common atmosphere settings used by 3D Tiles and models for rendering sky atmosphere, ground atmosphere, and fog.
  6. *
  7. * <p>
  8. * This class is not to be confused with {@link SkyAtmosphere}, which is responsible for rendering the sky.
  9. * </p>
  10. * <p>
  11. * While the atmosphere settings affect the color of fog, see {@link Fog} to control how fog is rendered.
  12. * </p>
  13. *
  14. * @alias Atmosphere
  15. * @constructor
  16. *
  17. * @example
  18. * // Turn on dynamic atmosphere lighting using the sun direction
  19. * scene.atmosphere.dynamicLighting = Cesium.DynamicAtmosphereLightingType.SUNLIGHT;
  20. *
  21. * @example
  22. * // Turn on dynamic lighting using whatever light source is in the scene
  23. * scene.light = new Cesium.DirectionalLight({
  24. * direction: new Cesium.Cartesian3(1, 0, 0)
  25. * });
  26. * scene.atmosphere.dynamicLighting = Cesium.DynamicAtmosphereLightingType.SCENE_LIGHT;
  27. *
  28. * @example
  29. * // Adjust the color of the atmosphere effects.
  30. * scene.atmosphere.hueShift = 0.4; // Cycle 40% around the color wheel
  31. * scene.atmosphere.brightnessShift = 0.25; // Increase the brightness
  32. * scene.atmosphere.saturationShift = -0.1; // Desaturate the colors
  33. *
  34. * @see SkyAtmosphere
  35. * @see Globe
  36. * @see Fog
  37. */
  38. function Atmosphere() {
  39. /**
  40. * The intensity of the light that is used for computing the ground atmosphere color.
  41. *
  42. * @type {number}
  43. * @default 10.0
  44. */
  45. this.lightIntensity = 10.0;
  46. /**
  47. * The Rayleigh scattering coefficient used in the atmospheric scattering equations for the ground atmosphere.
  48. *
  49. * @type {Cartesian3}
  50. * @default Cartesian3(5.5e-6, 13.0e-6, 28.4e-6)
  51. */
  52. this.rayleighCoefficient = new Cartesian3(5.5e-6, 13.0e-6, 28.4e-6);
  53. /**
  54. * The Mie scattering coefficient used in the atmospheric scattering equations for the ground atmosphere.
  55. *
  56. * @type {Cartesian3}
  57. * @default Cartesian3(21e-6, 21e-6, 21e-6)
  58. */
  59. this.mieCoefficient = new Cartesian3(21e-6, 21e-6, 21e-6);
  60. /**
  61. * The Rayleigh scale height used in the atmospheric scattering equations for the ground atmosphere, in meters.
  62. *
  63. * @type {number}
  64. * @default 10000.0
  65. */
  66. this.rayleighScaleHeight = 10000.0;
  67. /**
  68. * The Mie scale height used in the atmospheric scattering equations for the ground atmosphere, in meters.
  69. *
  70. * @type {number}
  71. * @default 3200.0
  72. */
  73. this.mieScaleHeight = 3200.0;
  74. /**
  75. * The anisotropy of the medium to consider for Mie scattering.
  76. * <p>
  77. * Valid values are between -1.0 and 1.0.
  78. * </p>
  79. *
  80. * @type {number}
  81. * @default 0.9
  82. */
  83. this.mieAnisotropy = 0.9;
  84. /**
  85. * The hue shift to apply to the atmosphere. Defaults to 0.0 (no shift).
  86. * A hue shift of 1.0 indicates a complete rotation of the hues available.
  87. *
  88. * @type {number}
  89. * @default 0.0
  90. */
  91. this.hueShift = 0.0;
  92. /**
  93. * The saturation shift to apply to the atmosphere. Defaults to 0.0 (no shift).
  94. * A saturation shift of -1.0 is monochrome.
  95. *
  96. * @type {number}
  97. * @default 0.0
  98. */
  99. this.saturationShift = 0.0;
  100. /**
  101. * The brightness shift to apply to the atmosphere. Defaults to 0.0 (no shift).
  102. * A brightness shift of -1.0 is complete darkness, which will let space show through.
  103. *
  104. * @type {number}
  105. * @default 0.0
  106. */
  107. this.brightnessShift = 0.0;
  108. /**
  109. * When not DynamicAtmosphereLightingType.NONE, the selected light source will
  110. * be used for dynamically lighting all atmosphere-related rendering effects.
  111. *
  112. * @type {DynamicAtmosphereLightingType}
  113. * @default DynamicAtmosphereLightingType.NONE
  114. */
  115. this.dynamicLighting = DynamicAtmosphereLightingType.NONE;
  116. }
  117. /**
  118. * Returns <code>true</code> if the atmosphere shader requires a color correct step.
  119. * @param {Atmosphere} atmosphere The atmosphere instance to check
  120. * @returns {boolean} true if the atmosphere shader requires a color correct step
  121. */
  122. Atmosphere.requiresColorCorrect = function (atmosphere) {
  123. return !(
  124. CesiumMath.equalsEpsilon(atmosphere.hueShift, 0.0, CesiumMath.EPSILON7) &&
  125. CesiumMath.equalsEpsilon(
  126. atmosphere.saturationShift,
  127. 0.0,
  128. CesiumMath.EPSILON7,
  129. ) &&
  130. CesiumMath.equalsEpsilon(
  131. atmosphere.brightnessShift,
  132. 0.0,
  133. CesiumMath.EPSILON7,
  134. )
  135. );
  136. };
  137. export default Atmosphere;