@geoblocks/cesium-post-process 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -1
- package/dist/analog-video.d.ts +71 -0
- package/dist/analog-video.d.ts.map +1 -0
- package/dist/analog-video.js +128 -0
- package/dist/analog-video.js.map +1 -0
- package/dist/blur.d.ts +13 -0
- package/dist/blur.d.ts.map +1 -0
- package/dist/blur.js +36 -0
- package/dist/blur.js.map +1 -0
- package/dist/cesium-post-process.d.ts +30 -0
- package/dist/cesium-post-process.d.ts.map +1 -0
- package/dist/cesium-post-process.js +31 -0
- package/dist/cesium-post-process.js.map +1 -0
- package/dist/cloud-cover.d.ts +28 -0
- package/dist/cloud-cover.d.ts.map +1 -0
- package/dist/cloud-cover.js +45 -0
- package/dist/cloud-cover.js.map +1 -0
- package/dist/cloud-map.d.ts +7 -0
- package/dist/cloud-map.d.ts.map +1 -0
- package/dist/cloud-map.js +118 -0
- package/dist/cloud-map.js.map +1 -0
- package/dist/cloud-noise.d.ts +13 -0
- package/dist/cloud-noise.d.ts.map +1 -0
- package/dist/cloud-noise.js +222 -0
- package/dist/cloud-noise.js.map +1 -0
- package/dist/clouds.d.ts +275 -0
- package/dist/clouds.d.ts.map +1 -0
- package/dist/clouds.js +642 -0
- package/dist/clouds.js.map +1 -0
- package/dist/color-isolation.d.ts +38 -0
- package/dist/color-isolation.d.ts.map +1 -0
- package/dist/color-isolation.js +61 -0
- package/dist/color-isolation.js.map +1 -0
- package/dist/depth-test.d.ts +9 -0
- package/dist/depth-test.d.ts.map +1 -0
- package/dist/depth-test.js +35 -0
- package/dist/depth-test.js.map +1 -0
- package/dist/digital-video.d.ts +47 -0
- package/dist/digital-video.d.ts.map +1 -0
- package/dist/digital-video.js +102 -0
- package/dist/digital-video.js.map +1 -0
- package/dist/drone-display.d.ts +70 -0
- package/dist/drone-display.d.ts.map +1 -0
- package/dist/drone-display.js +158 -0
- package/dist/drone-display.js.map +1 -0
- package/dist/dufour.d.ts +108 -0
- package/dist/dufour.d.ts.map +1 -0
- package/dist/dufour.js +201 -0
- package/dist/dufour.js.map +1 -0
- package/dist/effect.d.ts +33 -0
- package/dist/effect.d.ts.map +1 -0
- package/dist/effect.js +60 -0
- package/dist/effect.js.map +1 -0
- package/dist/focus.d.ts +11 -0
- package/dist/focus.d.ts.map +1 -0
- package/dist/focus.js +23 -0
- package/dist/focus.js.map +1 -0
- package/dist/frame-clock.d.ts +11 -0
- package/dist/frame-clock.d.ts.map +1 -0
- package/dist/frame-clock.js +57 -0
- package/dist/frame-clock.js.map +1 -0
- package/dist/height.d.ts +12 -0
- package/dist/height.d.ts.map +1 -0
- package/dist/height.js +22 -0
- package/dist/height.js.map +1 -0
- package/dist/infrared.d.ts +23 -0
- package/dist/infrared.d.ts.map +1 -0
- package/dist/infrared.js +36 -0
- package/dist/infrared.js.map +1 -0
- package/dist/jello.d.ts +52 -0
- package/dist/jello.d.ts.map +1 -0
- package/dist/jello.js +136 -0
- package/dist/jello.js.map +1 -0
- package/dist/lens-distortion.d.ts +33 -0
- package/dist/lens-distortion.d.ts.map +1 -0
- package/dist/lens-distortion.js +61 -0
- package/dist/lens-distortion.js.map +1 -0
- package/dist/lightning.d.ts +124 -0
- package/dist/lightning.d.ts.map +1 -0
- package/dist/lightning.js +301 -0
- package/dist/lightning.js.map +1 -0
- package/dist/local-frame.d.ts +38 -0
- package/dist/local-frame.d.ts.map +1 -0
- package/dist/local-frame.js +52 -0
- package/dist/local-frame.js.map +1 -0
- package/dist/motion-blur.d.ts +50 -0
- package/dist/motion-blur.d.ts.map +1 -0
- package/dist/motion-blur.js +108 -0
- package/dist/motion-blur.js.map +1 -0
- package/dist/precipitation.d.ts +146 -0
- package/dist/precipitation.d.ts.map +1 -0
- package/dist/precipitation.js +454 -0
- package/dist/precipitation.js.map +1 -0
- package/dist/rain-rings.d.ts +100 -0
- package/dist/rain-rings.d.ts.map +1 -0
- package/dist/rain-rings.js +181 -0
- package/dist/rain-rings.js.map +1 -0
- package/dist/shaders/Alpenglow.d.ts +3 -0
- package/dist/shaders/Alpenglow.d.ts.map +1 -0
- package/dist/shaders/Alpenglow.js +3 -0
- package/dist/shaders/Alpenglow.js.map +1 -0
- package/dist/shaders/AnalogVideo.d.ts +3 -0
- package/dist/shaders/AnalogVideo.d.ts.map +1 -0
- package/dist/shaders/AnalogVideo.js +3 -0
- package/dist/shaders/AnalogVideo.js.map +1 -0
- package/dist/shaders/Beam.d.ts +3 -0
- package/dist/shaders/Beam.d.ts.map +1 -0
- package/dist/shaders/Beam.js +3 -0
- package/dist/shaders/Beam.js.map +1 -0
- package/dist/shaders/CloudsBlur.d.ts +3 -0
- package/dist/shaders/CloudsBlur.d.ts.map +1 -0
- package/dist/shaders/CloudsBlur.js +3 -0
- package/dist/shaders/CloudsBlur.js.map +1 -0
- package/dist/shaders/CloudsComposite.d.ts +3 -0
- package/dist/shaders/CloudsComposite.d.ts.map +1 -0
- package/dist/shaders/CloudsComposite.js +3 -0
- package/dist/shaders/CloudsComposite.js.map +1 -0
- package/dist/shaders/CloudsDensity.d.ts +3 -0
- package/dist/shaders/CloudsDensity.d.ts.map +1 -0
- package/dist/shaders/CloudsDensity.js +3 -0
- package/dist/shaders/CloudsDensity.js.map +1 -0
- package/dist/shaders/CloudsDepth.d.ts +3 -0
- package/dist/shaders/CloudsDepth.d.ts.map +1 -0
- package/dist/shaders/CloudsDepth.js +3 -0
- package/dist/shaders/CloudsDepth.js.map +1 -0
- package/dist/shaders/CloudsMarch.d.ts +3 -0
- package/dist/shaders/CloudsMarch.d.ts.map +1 -0
- package/dist/shaders/CloudsMarch.js +3 -0
- package/dist/shaders/CloudsMarch.js.map +1 -0
- package/dist/shaders/CloudsResolve.d.ts +3 -0
- package/dist/shaders/CloudsResolve.d.ts.map +1 -0
- package/dist/shaders/CloudsResolve.js +3 -0
- package/dist/shaders/CloudsResolve.js.map +1 -0
- package/dist/shaders/CloudsShadow.d.ts +3 -0
- package/dist/shaders/CloudsShadow.d.ts.map +1 -0
- package/dist/shaders/CloudsShadow.js +3 -0
- package/dist/shaders/CloudsShadow.js.map +1 -0
- package/dist/shaders/CloudsShadowMap.d.ts +3 -0
- package/dist/shaders/CloudsShadowMap.d.ts.map +1 -0
- package/dist/shaders/CloudsShadowMap.js +3 -0
- package/dist/shaders/CloudsShadowMap.js.map +1 -0
- package/dist/shaders/CloudsSlab.d.ts +3 -0
- package/dist/shaders/CloudsSlab.d.ts.map +1 -0
- package/dist/shaders/CloudsSlab.js +3 -0
- package/dist/shaders/CloudsSlab.js.map +1 -0
- package/dist/shaders/ColorIsolation.d.ts +3 -0
- package/dist/shaders/ColorIsolation.d.ts.map +1 -0
- package/dist/shaders/ColorIsolation.js +3 -0
- package/dist/shaders/ColorIsolation.js.map +1 -0
- package/dist/shaders/DepthEdges.d.ts +3 -0
- package/dist/shaders/DepthEdges.d.ts.map +1 -0
- package/dist/shaders/DepthEdges.js +3 -0
- package/dist/shaders/DepthEdges.js.map +1 -0
- package/dist/shaders/DigitalVideo.d.ts +3 -0
- package/dist/shaders/DigitalVideo.d.ts.map +1 -0
- package/dist/shaders/DigitalVideo.js +3 -0
- package/dist/shaders/DigitalVideo.js.map +1 -0
- package/dist/shaders/DroneDisplay.d.ts +3 -0
- package/dist/shaders/DroneDisplay.d.ts.map +1 -0
- package/dist/shaders/DroneDisplay.js +3 -0
- package/dist/shaders/DroneDisplay.js.map +1 -0
- package/dist/shaders/Dufour.d.ts +3 -0
- package/dist/shaders/Dufour.d.ts.map +1 -0
- package/dist/shaders/Dufour.js +3 -0
- package/dist/shaders/Dufour.js.map +1 -0
- package/dist/shaders/EyeFromDepth.d.ts +3 -0
- package/dist/shaders/EyeFromDepth.d.ts.map +1 -0
- package/dist/shaders/EyeFromDepth.js +3 -0
- package/dist/shaders/EyeFromDepth.js.map +1 -0
- package/dist/shaders/Filmic.d.ts +3 -0
- package/dist/shaders/Filmic.d.ts.map +1 -0
- package/dist/shaders/Filmic.js +3 -0
- package/dist/shaders/Filmic.js.map +1 -0
- package/dist/shaders/Flashlight.d.ts +3 -0
- package/dist/shaders/Flashlight.d.ts.map +1 -0
- package/dist/shaders/Flashlight.js +3 -0
- package/dist/shaders/Flashlight.js.map +1 -0
- package/dist/shaders/Fog.d.ts +3 -0
- package/dist/shaders/Fog.d.ts.map +1 -0
- package/dist/shaders/Fog.js +3 -0
- package/dist/shaders/Fog.js.map +1 -0
- package/dist/shaders/Frame.d.ts +3 -0
- package/dist/shaders/Frame.d.ts.map +1 -0
- package/dist/shaders/Frame.js +3 -0
- package/dist/shaders/Frame.js.map +1 -0
- package/dist/shaders/Hash.d.ts +3 -0
- package/dist/shaders/Hash.d.ts.map +1 -0
- package/dist/shaders/Hash.js +3 -0
- package/dist/shaders/Hash.js.map +1 -0
- package/dist/shaders/Height.d.ts +3 -0
- package/dist/shaders/Height.d.ts.map +1 -0
- package/dist/shaders/Height.js +3 -0
- package/dist/shaders/Height.js.map +1 -0
- package/dist/shaders/Infrared.d.ts +3 -0
- package/dist/shaders/Infrared.d.ts.map +1 -0
- package/dist/shaders/Infrared.js +3 -0
- package/dist/shaders/Infrared.js.map +1 -0
- package/dist/shaders/Jello.d.ts +3 -0
- package/dist/shaders/Jello.d.ts.map +1 -0
- package/dist/shaders/Jello.js +3 -0
- package/dist/shaders/Jello.js.map +1 -0
- package/dist/shaders/LensDistortion.d.ts +3 -0
- package/dist/shaders/LensDistortion.d.ts.map +1 -0
- package/dist/shaders/LensDistortion.js +3 -0
- package/dist/shaders/LensDistortion.js.map +1 -0
- package/dist/shaders/Lightning.d.ts +3 -0
- package/dist/shaders/Lightning.d.ts.map +1 -0
- package/dist/shaders/Lightning.js +3 -0
- package/dist/shaders/Lightning.js.map +1 -0
- package/dist/shaders/MotionBlur.d.ts +3 -0
- package/dist/shaders/MotionBlur.d.ts.map +1 -0
- package/dist/shaders/MotionBlur.js +3 -0
- package/dist/shaders/MotionBlur.js.map +1 -0
- package/dist/shaders/MotionBlurVelocity.d.ts +3 -0
- package/dist/shaders/MotionBlurVelocity.d.ts.map +1 -0
- package/dist/shaders/MotionBlurVelocity.js +3 -0
- package/dist/shaders/MotionBlurVelocity.js.map +1 -0
- package/dist/shaders/Noise.d.ts +3 -0
- package/dist/shaders/Noise.d.ts.map +1 -0
- package/dist/shaders/Noise.js +3 -0
- package/dist/shaders/Noise.js.map +1 -0
- package/dist/shaders/Normal.d.ts +3 -0
- package/dist/shaders/Normal.d.ts.map +1 -0
- package/dist/shaders/Normal.js +3 -0
- package/dist/shaders/Normal.js.map +1 -0
- package/dist/shaders/Phase.d.ts +3 -0
- package/dist/shaders/Phase.d.ts.map +1 -0
- package/dist/shaders/Phase.js +3 -0
- package/dist/shaders/Phase.js.map +1 -0
- package/dist/shaders/Precipitation.d.ts +3 -0
- package/dist/shaders/Precipitation.d.ts.map +1 -0
- package/dist/shaders/Precipitation.js +3 -0
- package/dist/shaders/Precipitation.js.map +1 -0
- package/dist/shaders/PrecipitationShaftBlur.d.ts +3 -0
- package/dist/shaders/PrecipitationShaftBlur.d.ts.map +1 -0
- package/dist/shaders/PrecipitationShaftBlur.js +3 -0
- package/dist/shaders/PrecipitationShaftBlur.js.map +1 -0
- package/dist/shaders/PrecipitationShafts.d.ts +3 -0
- package/dist/shaders/PrecipitationShafts.d.ts.map +1 -0
- package/dist/shaders/PrecipitationShafts.js +3 -0
- package/dist/shaders/PrecipitationShafts.js.map +1 -0
- package/dist/shaders/PrecipitationWind.d.ts +3 -0
- package/dist/shaders/PrecipitationWind.d.ts.map +1 -0
- package/dist/shaders/PrecipitationWind.js +3 -0
- package/dist/shaders/PrecipitationWind.js.map +1 -0
- package/dist/shaders/RainHaze.d.ts +3 -0
- package/dist/shaders/RainHaze.d.ts.map +1 -0
- package/dist/shaders/RainHaze.js +3 -0
- package/dist/shaders/RainHaze.js.map +1 -0
- package/dist/shaders/RainRings.d.ts +3 -0
- package/dist/shaders/RainRings.d.ts.map +1 -0
- package/dist/shaders/RainRings.js +3 -0
- package/dist/shaders/RainRings.js.map +1 -0
- package/dist/shaders/Shockwave.d.ts +3 -0
- package/dist/shaders/Shockwave.d.ts.map +1 -0
- package/dist/shaders/Shockwave.js +3 -0
- package/dist/shaders/Shockwave.js.map +1 -0
- package/dist/shaders/SkyTable.d.ts +3 -0
- package/dist/shaders/SkyTable.d.ts.map +1 -0
- package/dist/shaders/SkyTable.js +3 -0
- package/dist/shaders/SkyTable.js.map +1 -0
- package/dist/shaders/SnowLine.d.ts +3 -0
- package/dist/shaders/SnowLine.d.ts.map +1 -0
- package/dist/shaders/SnowLine.js +3 -0
- package/dist/shaders/SnowLine.js.map +1 -0
- package/dist/shaders/SpeedLines.d.ts +3 -0
- package/dist/shaders/SpeedLines.d.ts.map +1 -0
- package/dist/shaders/SpeedLines.js +3 -0
- package/dist/shaders/SpeedLines.js.map +1 -0
- package/dist/shaders/Spotlight.d.ts +3 -0
- package/dist/shaders/Spotlight.d.ts.map +1 -0
- package/dist/shaders/Spotlight.js +3 -0
- package/dist/shaders/Spotlight.js.map +1 -0
- package/dist/shaders/SpotlightBeam.d.ts +3 -0
- package/dist/shaders/SpotlightBeam.d.ts.map +1 -0
- package/dist/shaders/SpotlightBeam.js +3 -0
- package/dist/shaders/SpotlightBeam.js.map +1 -0
- package/dist/shaders/SpotlightBeamBlur.d.ts +3 -0
- package/dist/shaders/SpotlightBeamBlur.d.ts.map +1 -0
- package/dist/shaders/SpotlightBeamBlur.js +3 -0
- package/dist/shaders/SpotlightBeamBlur.js.map +1 -0
- package/dist/shaders/SpotlightCone.d.ts +3 -0
- package/dist/shaders/SpotlightCone.d.ts.map +1 -0
- package/dist/shaders/SpotlightCone.js +3 -0
- package/dist/shaders/SpotlightCone.js.map +1 -0
- package/dist/shaders/Super8.d.ts +3 -0
- package/dist/shaders/Super8.d.ts.map +1 -0
- package/dist/shaders/Super8.js +3 -0
- package/dist/shaders/Super8.js.map +1 -0
- package/dist/shaders/Technicolor.d.ts +3 -0
- package/dist/shaders/Technicolor.d.ts.map +1 -0
- package/dist/shaders/Technicolor.js +3 -0
- package/dist/shaders/Technicolor.js.map +1 -0
- package/dist/shaders/TiltShift.d.ts +3 -0
- package/dist/shaders/TiltShift.d.ts.map +1 -0
- package/dist/shaders/TiltShift.js +3 -0
- package/dist/shaders/TiltShift.js.map +1 -0
- package/dist/shaders/Toy.d.ts +3 -0
- package/dist/shaders/Toy.d.ts.map +1 -0
- package/dist/shaders/Toy.js +3 -0
- package/dist/shaders/Toy.js.map +1 -0
- package/dist/shaders/Trails.d.ts +3 -0
- package/dist/shaders/Trails.d.ts.map +1 -0
- package/dist/shaders/Trails.js +3 -0
- package/dist/shaders/Trails.js.map +1 -0
- package/dist/shaders/ValleyFog.d.ts +3 -0
- package/dist/shaders/ValleyFog.d.ts.map +1 -0
- package/dist/shaders/ValleyFog.js +3 -0
- package/dist/shaders/ValleyFog.js.map +1 -0
- package/dist/shaders/WeatherMap.d.ts +3 -0
- package/dist/shaders/WeatherMap.d.ts.map +1 -0
- package/dist/shaders/WeatherMap.js +3 -0
- package/dist/shaders/WeatherMap.js.map +1 -0
- package/dist/shaders/WhiteModel.d.ts +3 -0
- package/dist/shaders/WhiteModel.d.ts.map +1 -0
- package/dist/shaders/WhiteModel.js +3 -0
- package/dist/shaders/WhiteModel.js.map +1 -0
- package/dist/snow-line.d.ts +117 -0
- package/dist/snow-line.d.ts.map +1 -0
- package/dist/snow-line.js +201 -0
- package/dist/snow-line.js.map +1 -0
- package/dist/speed-lines.d.ts +36 -0
- package/dist/speed-lines.d.ts.map +1 -0
- package/dist/speed-lines.js +65 -0
- package/dist/speed-lines.js.map +1 -0
- package/dist/spotlight.d.ts +84 -0
- package/dist/spotlight.d.ts.map +1 -0
- package/dist/spotlight.js +175 -0
- package/dist/spotlight.js.map +1 -0
- package/dist/strikes.d.ts +17 -0
- package/dist/strikes.d.ts.map +1 -0
- package/dist/strikes.js +30 -0
- package/dist/strikes.js.map +1 -0
- package/dist/super8.d.ts +78 -0
- package/dist/super8.d.ts.map +1 -0
- package/dist/super8.js +146 -0
- package/dist/super8.js.map +1 -0
- package/dist/technicolor.d.ts +32 -0
- package/dist/technicolor.d.ts.map +1 -0
- package/dist/technicolor.js +51 -0
- package/dist/technicolor.js.map +1 -0
- package/dist/tilt-shift.d.ts +60 -0
- package/dist/tilt-shift.d.ts.map +1 -0
- package/dist/tilt-shift.js +112 -0
- package/dist/tilt-shift.js.map +1 -0
- package/dist/toy.d.ts +110 -0
- package/dist/toy.d.ts.map +1 -0
- package/dist/toy.js +173 -0
- package/dist/toy.js.map +1 -0
- package/dist/valley-fog.d.ts +56 -0
- package/dist/valley-fog.d.ts.map +1 -0
- package/dist/valley-fog.js +94 -0
- package/dist/valley-fog.js.map +1 -0
- package/dist/weather-map.d.ts +132 -0
- package/dist/weather-map.d.ts.map +1 -0
- package/dist/weather-map.js +266 -0
- package/dist/weather-map.js.map +1 -0
- package/dist/white-model.d.ts +70 -0
- package/dist/white-model.d.ts.map +1 -0
- package/dist/white-model.js +94 -0
- package/dist/white-model.js.map +1 -0
- package/package.json +19 -40
- package/{cesium-post-process.js → src/cesium-post-process.js} +2 -0
- package/src/local-frame.js +57 -0
- package/{rain-rings.js → src/rain-rings.js} +14 -28
- package/src/shaders/AnalogVideo.glsl +132 -0
- package/src/shaders/Beam.glsl +108 -0
- package/src/shaders/CloudsBlur.glsl +30 -0
- package/src/shaders/CloudsComposite.glsl +59 -0
- package/src/shaders/CloudsDensity.glsl +129 -0
- package/src/shaders/CloudsDepth.glsl +26 -0
- package/src/shaders/CloudsMarch.glsl +174 -0
- package/src/shaders/CloudsResolve.glsl +46 -0
- package/src/shaders/CloudsShadow.glsl +50 -0
- package/src/shaders/CloudsShadowMap.glsl +68 -0
- package/src/shaders/CloudsSlab.glsl +58 -0
- package/src/shaders/ColorIsolation.glsl +26 -0
- package/src/shaders/DepthEdges.glsl +81 -0
- package/src/shaders/DigitalVideo.glsl +65 -0
- package/src/shaders/DroneDisplay.glsl +337 -0
- package/src/shaders/Dufour.glsl +109 -0
- package/src/shaders/EyeFromDepth.glsl +36 -0
- package/src/shaders/Filmic.glsl +5 -0
- package/src/shaders/Fog.glsl +18 -0
- package/src/shaders/Frame.glsl +10 -0
- package/src/shaders/Hash.glsl +12 -0
- package/src/shaders/Height.glsl +25 -0
- package/src/shaders/Infrared.glsl +44 -0
- package/src/shaders/Jello.glsl +41 -0
- package/src/shaders/LensDistortion.glsl +24 -0
- package/src/shaders/Lightning.glsl +257 -0
- package/src/shaders/MotionBlur.glsl +71 -0
- package/src/shaders/MotionBlurVelocity.glsl +31 -0
- package/src/shaders/Noise.glsl +43 -0
- package/src/shaders/Normal.glsl +21 -0
- package/src/shaders/Phase.glsl +6 -0
- package/src/shaders/Precipitation.glsl +199 -0
- package/src/shaders/PrecipitationShaftBlur.glsl +21 -0
- package/src/shaders/PrecipitationShafts.glsl +84 -0
- package/src/shaders/PrecipitationWind.glsl +33 -0
- package/src/shaders/RainHaze.glsl +145 -0
- package/src/shaders/RainRings.glsl +64 -0
- package/src/shaders/SkyTable.glsl +23 -0
- package/src/shaders/SnowLine.glsl +97 -0
- package/src/shaders/SnowLine.js +2 -0
- package/src/shaders/SpeedLines.glsl +61 -0
- package/src/shaders/Spotlight.glsl +89 -0
- package/src/shaders/SpotlightBeam.glsl +49 -0
- package/src/shaders/SpotlightBeamBlur.glsl +27 -0
- package/src/shaders/SpotlightCone.glsl +37 -0
- package/src/shaders/Super8.glsl +90 -0
- package/src/shaders/Technicolor.glsl +30 -0
- package/src/shaders/TiltShift.glsl +34 -0
- package/src/shaders/Toy.glsl +46 -0
- package/src/shaders/ValleyFog.glsl +40 -0
- package/src/shaders/WeatherMap.glsl +33 -0
- package/src/shaders/WhiteModel.glsl +108 -0
- package/{snow-line.js → src/snow-line.js} +71 -3
- package/local-frame.js +0 -15
- package/shaders/SnowLine.js +0 -2
- /package/{analog-video.js → src/analog-video.js} +0 -0
- /package/{blur.js → src/blur.js} +0 -0
- /package/{cloud-cover.js → src/cloud-cover.js} +0 -0
- /package/{cloud-map.js → src/cloud-map.js} +0 -0
- /package/{cloud-noise.js → src/cloud-noise.js} +0 -0
- /package/{clouds.js → src/clouds.js} +0 -0
- /package/{color-isolation.js → src/color-isolation.js} +0 -0
- /package/{depth-test.js → src/depth-test.js} +0 -0
- /package/{digital-video.js → src/digital-video.js} +0 -0
- /package/{drone-display.js → src/drone-display.js} +0 -0
- /package/{dufour.js → src/dufour.js} +0 -0
- /package/{effect.js → src/effect.js} +0 -0
- /package/{focus.js → src/focus.js} +0 -0
- /package/{frame-clock.js → src/frame-clock.js} +0 -0
- /package/{height.js → src/height.js} +0 -0
- /package/{infrared.js → src/infrared.js} +0 -0
- /package/{jello.js → src/jello.js} +0 -0
- /package/{lens-distortion.js → src/lens-distortion.js} +0 -0
- /package/{lightning.js → src/lightning.js} +0 -0
- /package/{motion-blur.js → src/motion-blur.js} +0 -0
- /package/{precipitation.js → src/precipitation.js} +0 -0
- /package/{shaders → src/shaders}/Alpenglow.js +0 -0
- /package/{shaders → src/shaders}/AnalogVideo.js +0 -0
- /package/{shaders → src/shaders}/Beam.js +0 -0
- /package/{shaders → src/shaders}/CloudsBlur.js +0 -0
- /package/{shaders → src/shaders}/CloudsComposite.js +0 -0
- /package/{shaders → src/shaders}/CloudsDensity.js +0 -0
- /package/{shaders → src/shaders}/CloudsDepth.js +0 -0
- /package/{shaders → src/shaders}/CloudsMarch.js +0 -0
- /package/{shaders → src/shaders}/CloudsResolve.js +0 -0
- /package/{shaders → src/shaders}/CloudsShadow.js +0 -0
- /package/{shaders → src/shaders}/CloudsShadowMap.js +0 -0
- /package/{shaders → src/shaders}/CloudsSlab.js +0 -0
- /package/{shaders → src/shaders}/ColorIsolation.js +0 -0
- /package/{shaders → src/shaders}/DepthEdges.js +0 -0
- /package/{shaders → src/shaders}/DigitalVideo.js +0 -0
- /package/{shaders → src/shaders}/DroneDisplay.js +0 -0
- /package/{shaders → src/shaders}/Dufour.js +0 -0
- /package/{shaders → src/shaders}/EyeFromDepth.js +0 -0
- /package/{shaders → src/shaders}/Filmic.js +0 -0
- /package/{shaders → src/shaders}/Flashlight.js +0 -0
- /package/{shaders → src/shaders}/Fog.js +0 -0
- /package/{shaders → src/shaders}/Frame.js +0 -0
- /package/{shaders → src/shaders}/Hash.js +0 -0
- /package/{shaders → src/shaders}/Height.js +0 -0
- /package/{shaders → src/shaders}/Infrared.js +0 -0
- /package/{shaders → src/shaders}/Jello.js +0 -0
- /package/{shaders → src/shaders}/LensDistortion.js +0 -0
- /package/{shaders → src/shaders}/Lightning.js +0 -0
- /package/{shaders → src/shaders}/MotionBlur.js +0 -0
- /package/{shaders → src/shaders}/MotionBlurVelocity.js +0 -0
- /package/{shaders → src/shaders}/Noise.js +0 -0
- /package/{shaders → src/shaders}/Normal.js +0 -0
- /package/{shaders → src/shaders}/Phase.js +0 -0
- /package/{shaders → src/shaders}/Precipitation.js +0 -0
- /package/{shaders → src/shaders}/PrecipitationShaftBlur.js +0 -0
- /package/{shaders → src/shaders}/PrecipitationShafts.js +0 -0
- /package/{shaders → src/shaders}/PrecipitationWind.js +0 -0
- /package/{shaders → src/shaders}/RainHaze.js +0 -0
- /package/{shaders → src/shaders}/RainRings.js +0 -0
- /package/{shaders → src/shaders}/Shockwave.js +0 -0
- /package/{shaders → src/shaders}/SkyTable.js +0 -0
- /package/{shaders → src/shaders}/SpeedLines.js +0 -0
- /package/{shaders → src/shaders}/Spotlight.js +0 -0
- /package/{shaders → src/shaders}/SpotlightBeam.js +0 -0
- /package/{shaders → src/shaders}/SpotlightBeamBlur.js +0 -0
- /package/{shaders → src/shaders}/SpotlightCone.js +0 -0
- /package/{shaders → src/shaders}/Super8.js +0 -0
- /package/{shaders → src/shaders}/Technicolor.js +0 -0
- /package/{shaders → src/shaders}/TiltShift.js +0 -0
- /package/{shaders → src/shaders}/Toy.js +0 -0
- /package/{shaders → src/shaders}/Trails.js +0 -0
- /package/{shaders → src/shaders}/ValleyFog.js +0 -0
- /package/{shaders → src/shaders}/WeatherMap.js +0 -0
- /package/{shaders → src/shaders}/WhiteModel.js +0 -0
- /package/{speed-lines.js → src/speed-lines.js} +0 -0
- /package/{spotlight.js → src/spotlight.js} +0 -0
- /package/{strikes.js → src/strikes.js} +0 -0
- /package/{super8.js → src/super8.js} +0 -0
- /package/{technicolor.js → src/technicolor.js} +0 -0
- /package/{tilt-shift.js → src/tilt-shift.js} +0 -0
- /package/{toy.js → src/toy.js} +0 -0
- /package/{valley-fog.js → src/valley-fog.js} +0 -0
- /package/{weather-map.js → src/weather-map.js} +0 -0
- /package/{white-model.js → src/white-model.js} +0 -0
package/dist/clouds.js
ADDED
|
@@ -0,0 +1,642 @@
|
|
|
1
|
+
import { Cartesian3, Ellipsoid, Matrix4, PixelDatatype, Rectangle, Math as CesiumMath } from '@cesium/core';
|
|
2
|
+
import { PostProcessStage, PostProcessStageComposite, TextureMagnificationFilter, TextureMinificationFilter } from '@cesium/engine';
|
|
3
|
+
// @ts-expect-error the engine exports its 3D textures and samplers, but does not type them
|
|
4
|
+
import { Sampler, Texture3D, TextureWrap } from '@cesium/engine';
|
|
5
|
+
// @ts-expect-error the engine exports its textures, framebuffers and render states, but does not type them
|
|
6
|
+
import { Framebuffer, RenderState, Texture } from '@cesium/engine';
|
|
7
|
+
import { acquireCloudCover, releaseCloudCover } from './cloud-cover.js';
|
|
8
|
+
import createCloudMap from './cloud-map.js';
|
|
9
|
+
import createCloudNoise, { createMapNoise } from './cloud-noise.js';
|
|
10
|
+
import { acquireTerrainDepth, releaseTerrainDepth } from './depth-test.js';
|
|
11
|
+
import Effect from './effect.js';
|
|
12
|
+
import { acquireFrames, releaseFrames } from './frame-clock.js';
|
|
13
|
+
import { heightUniforms } from './height.js';
|
|
14
|
+
import CloudsBlur from './shaders/CloudsBlur.js';
|
|
15
|
+
import CloudsComposite from './shaders/CloudsComposite.js';
|
|
16
|
+
import CloudsDensity from './shaders/CloudsDensity.js';
|
|
17
|
+
import CloudsDepth from './shaders/CloudsDepth.js';
|
|
18
|
+
import CloudsMarch from './shaders/CloudsMarch.js';
|
|
19
|
+
import CloudsResolve from './shaders/CloudsResolve.js';
|
|
20
|
+
import CloudsShadow from './shaders/CloudsShadow.js';
|
|
21
|
+
import CloudsShadowMap from './shaders/CloudsShadowMap.js';
|
|
22
|
+
import CloudsSlab from './shaders/CloudsSlab.js';
|
|
23
|
+
import EyeFromDepth from './shaders/EyeFromDepth.js';
|
|
24
|
+
import Fog from './shaders/Fog.js';
|
|
25
|
+
import Height from './shaders/Height.js';
|
|
26
|
+
import Phase from './shaders/Phase.js';
|
|
27
|
+
import RainHaze from './shaders/RainHaze.js';
|
|
28
|
+
import WeatherMapShader from './shaders/WeatherMap.js';
|
|
29
|
+
import WeatherMap from './weather-map.js';
|
|
30
|
+
// the clouds are kilometers wide and soft: a quarter of the resolution, a 16th of the pixels, is
|
|
31
|
+
// enough for their raymarch (CloudsComposite.glsl's CLOUD_SCALE)
|
|
32
|
+
const CLOUD_SCALE = 0.25;
|
|
33
|
+
// voxels along each side of the noise, CloudsDensity.glsl's NOISE_VOXELS
|
|
34
|
+
const NOISE_SIZE = 64;
|
|
35
|
+
// the share of the previous frames in each frame's clouds, about 10 frames' worth (Hillaire 2016,
|
|
36
|
+
// sec. 5.5.3, blends 0.1 of the current one)
|
|
37
|
+
const HISTORY_WEIGHT = 0.9;
|
|
38
|
+
// after the camera, the clock or the map changes, the scene renders this long, in milliseconds, at
|
|
39
|
+
// this frame rate, for the accumulation to settle, also in requestRenderMode
|
|
40
|
+
const SETTLE_TIME = 500;
|
|
41
|
+
const SETTLE_RATE = 30;
|
|
42
|
+
// with a drift, the clouds move all the time: the scene renders at this frame rate while they are
|
|
43
|
+
// active, also in requestRenderMode
|
|
44
|
+
const DRIFT_RATE = 30;
|
|
45
|
+
// the shadow map: its texels across, over a square centered on the ground point under the camera,
|
|
46
|
+
// this many times as wide as the camera is high, between these sides, in meters, so that it covers
|
|
47
|
+
// the view from high above; drawn again once that point moves a 40th of it, its side changes by a
|
|
48
|
+
// quarter, or the clock or the clouds change, rather than at each frame
|
|
49
|
+
const SHADOW_SIZE = 512;
|
|
50
|
+
const SHADOW_SPREAD = 4;
|
|
51
|
+
const SHADOW_EXTENTS = [80000, 800000];
|
|
52
|
+
const SHADOW_MOVE = 1 / 40;
|
|
53
|
+
const SHADOW_RESIZE = 0.25;
|
|
54
|
+
// and at most once in this many milliseconds, while they keep changing, as during playback: a
|
|
55
|
+
// redraw takes as long as a frame of the clouds or longer
|
|
56
|
+
const SHADOW_INTERVAL = 250;
|
|
57
|
+
// the history is a copy of the resolve's output, drawn rather than copied: Cesium does not copy
|
|
58
|
+
// from a framebuffer into a texture of half floats
|
|
59
|
+
const COPY = `precision highp sampler2D;
|
|
60
|
+
uniform sampler2D source;
|
|
61
|
+
in vec2 v_textureCoordinates;
|
|
62
|
+
void main() {
|
|
63
|
+
out_FragColor = texture(source, v_textureCoordinates);
|
|
64
|
+
}
|
|
65
|
+
`;
|
|
66
|
+
// the clouds over the lightest rain are this thick, in meters, CloudsDensity.glsl's THIN_DEPTH
|
|
67
|
+
const THIN_DEPTH = 1500;
|
|
68
|
+
// the wind's offset of the noise wraps at this many meters, a period of its tile, CloudsMarch.glsl's
|
|
69
|
+
// NOISE_TILE, and of its larger lookup, the tile over LARGE_SCALE (0.27): single precision would
|
|
70
|
+
// lose the offset after days of wind
|
|
71
|
+
const WIND_PERIOD = 100 * 16000;
|
|
72
|
+
/**
|
|
73
|
+
* The noise's voxels, made once for all the clouds of the page: about a third of a second.
|
|
74
|
+
* @type {Uint8Array | undefined}
|
|
75
|
+
*/
|
|
76
|
+
let noise;
|
|
77
|
+
/**
|
|
78
|
+
* The noise over the clouds' map, made once for all the clouds of the page.
|
|
79
|
+
* @type {Uint8Array | undefined}
|
|
80
|
+
*/
|
|
81
|
+
let mapNoise;
|
|
82
|
+
// texels along each side of the map's noise
|
|
83
|
+
const MAP_NOISE_SIZE = 256;
|
|
84
|
+
/**
|
|
85
|
+
* Clouds from a map of the rain: a slab above the cloud base where the map
|
|
86
|
+
* has rain, a flat layer over drizzle and towers up to the cloud top over the
|
|
87
|
+
* heaviest rain, eroded by noise, lit by the sun with a silver lining toward
|
|
88
|
+
* it and by the sky, brighter at their top. Seen from far above they are
|
|
89
|
+
* cloud tops; the camera flies into them as it comes down. Activated before
|
|
90
|
+
* Precipitation, the rain, its shafts and its haze are drawn over them, so
|
|
91
|
+
* from below the cloud base they are seen through the rain. They are
|
|
92
|
+
* raymarched at a quarter of
|
|
93
|
+
* the resolution, accumulated over the frames, and upscaled by the scene's
|
|
94
|
+
* depth. Their noise drifts with the wind by the scene's clock, and with a
|
|
95
|
+
* drift by the real time; after a change, the scene renders for half a second
|
|
96
|
+
* for them to settle, then rests, unless they drift.
|
|
97
|
+
* Without a map, there are no clouds.
|
|
98
|
+
*/
|
|
99
|
+
export default class Clouds extends Effect {
|
|
100
|
+
/**
|
|
101
|
+
* @param {import('@cesium/engine').CesiumWidget} viewer
|
|
102
|
+
* @param {{map?: import('./weather-map.js').WeatherMapOptions, cloudBase?: number, cloudTop?: number, density?: number, wind?: number, drift?: number}} [options]
|
|
103
|
+
*/
|
|
104
|
+
constructor(viewer, options = {}) {
|
|
105
|
+
super(viewer);
|
|
106
|
+
this.cloudBase_ = options.cloudBase ?? 2500;
|
|
107
|
+
this.cloudTop_ = options.cloudTop ?? 9000;
|
|
108
|
+
this.density_ = options.density ?? 1;
|
|
109
|
+
this.wind_ = options.wind ?? 10;
|
|
110
|
+
this.drift_ = options.drift ?? 0;
|
|
111
|
+
// without a map, no clouds
|
|
112
|
+
this.weatherMap_ = new WeatherMap(0);
|
|
113
|
+
// the maps of the rain, from which the clouds' maps are made
|
|
114
|
+
/** @type {import('./weather-map.js').WeatherMapOptions | undefined} */
|
|
115
|
+
this.map_ = options.map;
|
|
116
|
+
/** @type {import('./weather-map.js').WeatherMapOptions | undefined} */
|
|
117
|
+
this.nextMap_ = undefined;
|
|
118
|
+
this.weatherMap_.map = options.map && createCloudMap(options.map);
|
|
119
|
+
// the map's intensity at the camera when it is inside the clouds, read each frame
|
|
120
|
+
this.localDensity_ = 0;
|
|
121
|
+
// made when the clouds are first drawn, as the map's texture
|
|
122
|
+
/** @type {any} */
|
|
123
|
+
this.noiseTexture_ = undefined;
|
|
124
|
+
/** @type {any} */
|
|
125
|
+
this.mapNoiseTexture_ = undefined;
|
|
126
|
+
// the accumulation over the frames: the frames drawn, the previous frames' clouds, their share,
|
|
127
|
+
// the previous frame's view and projection, and what makes the scene render until it settles
|
|
128
|
+
this.frame_ = 0;
|
|
129
|
+
/** @type {any} */
|
|
130
|
+
this.history_ = undefined;
|
|
131
|
+
/** @type {any} */
|
|
132
|
+
this.historyFramebuffer_ = undefined;
|
|
133
|
+
/** @type {any} */
|
|
134
|
+
this.copy_ = undefined;
|
|
135
|
+
/** @type {any} */
|
|
136
|
+
this.copySource_ = undefined;
|
|
137
|
+
this.historyWeight_ = 0;
|
|
138
|
+
this.previousViewProjection_ = new Matrix4();
|
|
139
|
+
this.reprojection_ = new Matrix4();
|
|
140
|
+
this.lastView_ = new Matrix4();
|
|
141
|
+
this.lastTime_ = { dayNumber: 0, secondsOfDay: 0 };
|
|
142
|
+
this.changed_ = false;
|
|
143
|
+
this.settling_ = false;
|
|
144
|
+
this.settleUntil_ = 0;
|
|
145
|
+
// the shadow map, its ground point and time, and whether the clouds changed since it was drawn
|
|
146
|
+
/** @type {any} */
|
|
147
|
+
this.shadow_ = undefined;
|
|
148
|
+
/** @type {any} */
|
|
149
|
+
this.shadowFramebuffer_ = undefined;
|
|
150
|
+
/** @type {any} */
|
|
151
|
+
this.shadowCommand_ = undefined;
|
|
152
|
+
this.shadowCenter_ = new Cartesian3();
|
|
153
|
+
this.shadowExtent_ = SHADOW_EXTENTS[0];
|
|
154
|
+
this.shadowTime_ = { dayNumber: 0, secondsOfDay: 0 };
|
|
155
|
+
this.shadowDrawnAt_ = -Infinity;
|
|
156
|
+
this.shadowChanged_ = true;
|
|
157
|
+
// for Precipitation, which lights its haze through it
|
|
158
|
+
/** @type {import('./cloud-cover.js').CloudShadow} */
|
|
159
|
+
this.shadowSource_ = { texture: () => this.shadow_, center: this.shadowCenter_, extent: () => this.shadowExtent_, base: () => this.cloudBase_, top: () => this.slabTop_() };
|
|
160
|
+
this.onPreRender_ = () => {
|
|
161
|
+
const { camera } = this.viewer.scene;
|
|
162
|
+
this.drawShadow_(this.viewer.scene);
|
|
163
|
+
const { longitude, latitude, height } = camera.positionCartographic;
|
|
164
|
+
const inside = height >= this.cloudBase_ && height <= this.cloudTop_;
|
|
165
|
+
this.localDensity_ = inside ? this.weatherMap_.intensityAt(longitude, latitude) : 0;
|
|
166
|
+
const time = this.viewer.clock.currentTime;
|
|
167
|
+
if (this.changed_ || !Matrix4.equals(camera.viewMatrix, this.lastView_) || time.dayNumber !== this.lastTime_.dayNumber || time.secondsOfDay !== this.lastTime_.secondsOfDay) {
|
|
168
|
+
this.changed_ = false;
|
|
169
|
+
Matrix4.clone(camera.viewMatrix, this.lastView_);
|
|
170
|
+
this.lastTime_ = { dayNumber: time.dayNumber, secondsOfDay: time.secondsOfDay };
|
|
171
|
+
this.settleUntil_ = Date.now() + SETTLE_TIME;
|
|
172
|
+
if (!this.settling_) {
|
|
173
|
+
this.settling_ = true;
|
|
174
|
+
acquireFrames(this.viewer.scene, SETTLE_RATE);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
this.onPostRender_ = () => {
|
|
179
|
+
const { scene } = this.viewer;
|
|
180
|
+
this.keepHistory_(scene);
|
|
181
|
+
Matrix4.multiply(scene.camera.frustum.projectionMatrix, scene.camera.viewMatrix, this.previousViewProjection_);
|
|
182
|
+
this.frame_ = (this.frame_ + 1) % 1024;
|
|
183
|
+
if (this.settling_ && Date.now() > this.settleUntil_) {
|
|
184
|
+
this.settling_ = false;
|
|
185
|
+
releaseFrames(scene, SETTLE_RATE);
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* @override
|
|
191
|
+
* @param {import('@cesium/engine').Scene} scene
|
|
192
|
+
*/
|
|
193
|
+
createStage_(scene) {
|
|
194
|
+
// the farthest depth of each block of pixels of the march, at its resolution
|
|
195
|
+
const depth = new PostProcessStage({
|
|
196
|
+
fragmentShader: EyeFromDepth + CloudsDepth,
|
|
197
|
+
textureScale: CLOUD_SCALE,
|
|
198
|
+
pixelDatatype: PixelDatatype.FLOAT,
|
|
199
|
+
});
|
|
200
|
+
const march = new PostProcessStage({
|
|
201
|
+
fragmentShader: EyeFromDepth + Height + CloudsSlab + WeatherMapShader + CloudsDensity + Fog + Phase + RainHaze + CloudsMarch,
|
|
202
|
+
uniforms: {
|
|
203
|
+
...this.slabUniforms_(scene),
|
|
204
|
+
// @ts-expect-error the scene's context is not typed
|
|
205
|
+
...this.densityUniforms_(scene.context),
|
|
206
|
+
cloudDepth: depth.name,
|
|
207
|
+
// @ts-expect-error the scene's context is not typed
|
|
208
|
+
maxMap: () => this.weatherMap_.maxTexture(scene.context),
|
|
209
|
+
frame: () => this.frame_,
|
|
210
|
+
skyLightIntensity: () => scene.skyAtmosphere?.atmosphereLightIntensity ?? 50,
|
|
211
|
+
},
|
|
212
|
+
textureScale: CLOUD_SCALE,
|
|
213
|
+
});
|
|
214
|
+
// accumulated over the frames
|
|
215
|
+
const resolve = new PostProcessStage({
|
|
216
|
+
fragmentShader: EyeFromDepth + Height + CloudsSlab + CloudsResolve,
|
|
217
|
+
uniforms: {
|
|
218
|
+
...this.slabUniforms_(scene),
|
|
219
|
+
cloudDepth: depth.name,
|
|
220
|
+
cloudTexture: march.name,
|
|
221
|
+
// @ts-expect-error the scene's context is not typed
|
|
222
|
+
historyTexture: () => this.history_ ?? scene.context.defaultTexture,
|
|
223
|
+
reprojection: () => Matrix4.multiply(this.previousViewProjection_, scene.camera.inverseViewMatrix, this.reprojection_),
|
|
224
|
+
historyWeight: () => (this.history_ ? this.historyWeight_ : 0),
|
|
225
|
+
},
|
|
226
|
+
textureScale: CLOUD_SCALE,
|
|
227
|
+
pixelDatatype: PixelDatatype.HALF_FLOAT,
|
|
228
|
+
});
|
|
229
|
+
// blurred at the same resolution
|
|
230
|
+
const blurred = new PostProcessStage({
|
|
231
|
+
fragmentShader: CloudsBlur,
|
|
232
|
+
uniforms: { cloudTexture: resolve.name, cloudDepth: depth.name },
|
|
233
|
+
textureScale: CLOUD_SCALE,
|
|
234
|
+
});
|
|
235
|
+
return new PostProcessStageComposite({
|
|
236
|
+
stages: [
|
|
237
|
+
depth,
|
|
238
|
+
march,
|
|
239
|
+
resolve,
|
|
240
|
+
blurred,
|
|
241
|
+
new PostProcessStage({
|
|
242
|
+
fragmentShader: EyeFromDepth + CloudsShadow + CloudsComposite,
|
|
243
|
+
uniforms: {
|
|
244
|
+
...this.shadowUniforms_(scene),
|
|
245
|
+
cloudTexture: blurred.name,
|
|
246
|
+
cloudDepth: depth.name,
|
|
247
|
+
},
|
|
248
|
+
}),
|
|
249
|
+
],
|
|
250
|
+
// the clouds are drawn over the scene, not over the march
|
|
251
|
+
inputPreviousStageTexture: false,
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* The top of the tallest cloud the map makes, as CloudsDensity.glsl's cloudDensity makes the
|
|
256
|
+
* clouds of its tallest type, over its heaviest rain: from above, the march starts there rather than at the cloud
|
|
257
|
+
* top, so that its steps are in the clouds rather than in the empty air over them.
|
|
258
|
+
*/
|
|
259
|
+
slabTop_() {
|
|
260
|
+
// the clouds' map's tallest type, in blue
|
|
261
|
+
const type = this.weatherMap_.maxValues[2];
|
|
262
|
+
return this.cloudBase_ + THIN_DEPTH + (this.cloudTop_ - this.cloudBase_ - THIN_DEPTH) * type;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* The direction the wind blows toward, in world coordinates: the east at the map's center, fixed
|
|
266
|
+
* for the map rather than turning with the camera, which would shift the drifted noise.
|
|
267
|
+
*/
|
|
268
|
+
windDirection_() {
|
|
269
|
+
const rectangle = this.weatherMap_.map?.rectangle;
|
|
270
|
+
if (!rectangle) {
|
|
271
|
+
return Cartesian3.ZERO;
|
|
272
|
+
}
|
|
273
|
+
const up = Ellipsoid.WGS84.geodeticSurfaceNormalCartographic(Rectangle.center(rectangle));
|
|
274
|
+
return Cartesian3.normalize(Cartesian3.cross(Cartesian3.UNIT_Z, up, new Cartesian3()), new Cartesian3());
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* How far the wind has carried the noise by the scene's clock, still while it is paused, and the
|
|
278
|
+
* drift by the real time, in world coordinates, in double precision and wrapped at WIND_PERIOD.
|
|
279
|
+
* @param {number} [seconds] the real time
|
|
280
|
+
*/
|
|
281
|
+
windOffset_(seconds = performance.now() / 1000) {
|
|
282
|
+
const { dayNumber, secondsOfDay } = this.viewer.clock.currentTime;
|
|
283
|
+
const distance = this.wind_ * (dayNumber * 86400 + secondsOfDay) + this.drift_ * seconds;
|
|
284
|
+
const offset = Cartesian3.multiplyByScalar(this.windDirection_(), distance, new Cartesian3());
|
|
285
|
+
return new Cartesian3(offset.x % WIND_PERIOD, offset.y % WIND_PERIOD, offset.z % WIND_PERIOD);
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* The uniforms of CloudsSlab.glsl, with Height.glsl's it needs.
|
|
289
|
+
* @param {import('@cesium/engine').Scene} scene
|
|
290
|
+
*/
|
|
291
|
+
slabUniforms_(scene) {
|
|
292
|
+
return { ...heightUniforms(scene), cloudBase: () => this.cloudBase_, slabTop: () => this.slabTop_() };
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* The uniforms of CloudsDensity.glsl, with WeatherMap.glsl's it needs.
|
|
296
|
+
* @param {any} context the scene's context
|
|
297
|
+
*/
|
|
298
|
+
densityUniforms_(context) {
|
|
299
|
+
return {
|
|
300
|
+
map: () => this.weatherMap_.texture(context),
|
|
301
|
+
nextMap: () => this.weatherMap_.nextTexture(context),
|
|
302
|
+
mapBlend: () => this.weatherMap_.blend,
|
|
303
|
+
mapBounds: () => this.weatherMap_.bounds,
|
|
304
|
+
cloudNoise: () => this.createNoiseTexture_(context),
|
|
305
|
+
mapNoise: () => this.createMapNoiseTexture_(context),
|
|
306
|
+
cloudTop: () => this.cloudTop_,
|
|
307
|
+
density: () => this.density_,
|
|
308
|
+
windDirection: () => this.windDirection_(),
|
|
309
|
+
windOffset: () => this.windOffset_(),
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* The uniforms of CloudsShadow.glsl, for the stages that read the shadow map.
|
|
314
|
+
* @param {import('@cesium/engine').Scene} scene
|
|
315
|
+
*/
|
|
316
|
+
shadowUniforms_(scene) {
|
|
317
|
+
return {
|
|
318
|
+
// @ts-expect-error the scene's context is not typed
|
|
319
|
+
shadowMap: () => this.shadow_ ?? scene.context.defaultTexture,
|
|
320
|
+
shadowCenter: () => this.shadowCenter_,
|
|
321
|
+
shadowExtent: () => this.shadowExtent_,
|
|
322
|
+
shadowBase: () => this.cloudBase_,
|
|
323
|
+
shadowTop: () => this.slabTop_(),
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* The shadow map's side, in meters, for a camera this high.
|
|
328
|
+
* @param {number} height meters
|
|
329
|
+
*/
|
|
330
|
+
shadowExtentFor_(height) {
|
|
331
|
+
return CesiumMath.clamp(SHADOW_SPREAD * height, SHADOW_EXTENTS[0], SHADOW_EXTENTS[1]);
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Whether the shadow map, drawn around a ground point at a time, is to be drawn again.
|
|
335
|
+
* @param {Cartesian3} ground the ground point under the camera, in world coordinates
|
|
336
|
+
* @param {{dayNumber: number, secondsOfDay: number}} time the clock's
|
|
337
|
+
* @param {number} [extent] the side it would have now, in meters
|
|
338
|
+
*/
|
|
339
|
+
shadowStale_(ground, time, extent = this.shadowExtent_) {
|
|
340
|
+
return (this.shadowChanged_ ||
|
|
341
|
+
time.dayNumber !== this.shadowTime_.dayNumber ||
|
|
342
|
+
time.secondsOfDay !== this.shadowTime_.secondsOfDay ||
|
|
343
|
+
Cartesian3.distance(ground, this.shadowCenter_) > SHADOW_MOVE * this.shadowExtent_ ||
|
|
344
|
+
Math.abs(extent - this.shadowExtent_) > SHADOW_RESIZE * this.shadowExtent_ ||
|
|
345
|
+
// the drifting clouds, at every frame
|
|
346
|
+
this.drift_ > 0);
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Whether the shadow map is to be drawn again now: stale, and not drawn in the last
|
|
350
|
+
* SHADOW_INTERVAL.
|
|
351
|
+
* @param {Cartesian3} ground
|
|
352
|
+
* @param {{dayNumber: number, secondsOfDay: number}} time
|
|
353
|
+
* @param {number} now milliseconds
|
|
354
|
+
* @param {number} [extent] the side it would have now, in meters
|
|
355
|
+
*/
|
|
356
|
+
shadowDue_(ground, time, now, extent) {
|
|
357
|
+
return this.shadowStale_(ground, time, extent) && now - this.shadowDrawnAt_ >= SHADOW_INTERVAL;
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* @param {Cartesian3} ground
|
|
361
|
+
* @param {{dayNumber: number, secondsOfDay: number}} time
|
|
362
|
+
* @param {number} [now] milliseconds
|
|
363
|
+
* @param {number} [extent] its side, in meters
|
|
364
|
+
*/
|
|
365
|
+
shadowDrawn_(ground, time, now = Date.now(), extent = this.shadowExtent_) {
|
|
366
|
+
Cartesian3.clone(ground, this.shadowCenter_);
|
|
367
|
+
this.shadowExtent_ = extent;
|
|
368
|
+
this.shadowTime_ = { dayNumber: time.dayNumber, secondsOfDay: time.secondsOfDay };
|
|
369
|
+
this.shadowDrawnAt_ = now;
|
|
370
|
+
this.shadowChanged_ = false;
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Draws the shadow map into its own texture before the stages run, when it is due: the
|
|
374
|
+
* stages' textures are sized after the screen. A redraw put off renders after the change
|
|
375
|
+
* settles, in the frames the accumulation asks for.
|
|
376
|
+
* @param {import('@cesium/engine').Scene} scene
|
|
377
|
+
*/
|
|
378
|
+
drawShadow_(scene) {
|
|
379
|
+
const ground = Ellipsoid.WGS84.scaleToGeodeticSurface(scene.camera.positionWC, new Cartesian3());
|
|
380
|
+
const time = this.viewer.clock.currentTime;
|
|
381
|
+
const now = Date.now();
|
|
382
|
+
const extent = this.shadowExtentFor_(scene.camera.positionCartographic.height);
|
|
383
|
+
if (!ground || !this.shadowDue_(ground, time, now, extent)) {
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
this.shadowDrawn_(ground, time, now, extent);
|
|
387
|
+
// @ts-expect-error the scene's context is not typed
|
|
388
|
+
const context = scene.context;
|
|
389
|
+
if (!context) {
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
if (!this.shadow_) {
|
|
393
|
+
this.shadow_ = new Texture({ context, width: SHADOW_SIZE, height: SHADOW_SIZE, pixelDatatype: PixelDatatype.HALF_FLOAT });
|
|
394
|
+
this.shadowFramebuffer_ = new Framebuffer({ context, colorTextures: [this.shadow_], destroyAttachments: false });
|
|
395
|
+
this.shadowCommand_ = context.createViewportQuadCommand(Height + CloudsSlab + WeatherMapShader + CloudsDensity + CloudsShadow + CloudsShadowMap, {
|
|
396
|
+
framebuffer: this.shadowFramebuffer_,
|
|
397
|
+
renderState: RenderState.fromCache({ viewport: { x: 0, y: 0, width: SHADOW_SIZE, height: SHADOW_SIZE } }),
|
|
398
|
+
uniformMap: {
|
|
399
|
+
...this.slabUniforms_(scene),
|
|
400
|
+
...this.densityUniforms_(context),
|
|
401
|
+
maxMap: () => this.weatherMap_.maxTexture(context),
|
|
402
|
+
shadowCenter: () => this.shadowCenter_,
|
|
403
|
+
shadowExtent: () => this.shadowExtent_,
|
|
404
|
+
},
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
this.shadowCommand_.execute(context);
|
|
408
|
+
}
|
|
409
|
+
destroyShadow_() {
|
|
410
|
+
this.shadowCommand_?.shaderProgram?.destroy();
|
|
411
|
+
this.shadowCommand_ = undefined;
|
|
412
|
+
this.shadowFramebuffer_ = this.shadowFramebuffer_?.destroy();
|
|
413
|
+
this.shadow_ = this.shadow_?.destroy();
|
|
414
|
+
this.shadowChanged_ = true;
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Keeps this frame's accumulated clouds for the next one, drawn into the history at the size of
|
|
418
|
+
* the resolve's output, made again when it changes.
|
|
419
|
+
* @param {import('@cesium/engine').Scene} scene
|
|
420
|
+
*/
|
|
421
|
+
keepHistory_(scene) {
|
|
422
|
+
// @ts-expect-error the collection's output textures are not typed
|
|
423
|
+
const output = this.stage_ && scene.postProcessStages.getOutputTexture?.(this.stage_.get(2).name);
|
|
424
|
+
if (!output) {
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
427
|
+
// @ts-expect-error the scene's context is not typed
|
|
428
|
+
const context = scene.context;
|
|
429
|
+
if (!this.history_ || this.history_.width !== output.width || this.history_.height !== output.height) {
|
|
430
|
+
this.destroyHistory_();
|
|
431
|
+
this.history_ = new Texture({ context, width: output.width, height: output.height, pixelDatatype: PixelDatatype.HALF_FLOAT });
|
|
432
|
+
this.historyFramebuffer_ = new Framebuffer({ context, colorTextures: [this.history_], destroyAttachments: false });
|
|
433
|
+
this.historyWeight_ = 0;
|
|
434
|
+
}
|
|
435
|
+
this.copySource_ = output;
|
|
436
|
+
this.copy_ ??= context.createViewportQuadCommand(COPY, { uniformMap: { source: () => this.copySource_ } });
|
|
437
|
+
this.copy_.framebuffer = this.historyFramebuffer_;
|
|
438
|
+
this.copy_.renderState = RenderState.fromCache({ viewport: { x: 0, y: 0, width: output.width, height: output.height } });
|
|
439
|
+
this.copy_.execute(context);
|
|
440
|
+
this.historyWeight_ = HISTORY_WEIGHT;
|
|
441
|
+
}
|
|
442
|
+
destroyHistory_() {
|
|
443
|
+
this.historyFramebuffer_ = this.historyFramebuffer_?.destroy();
|
|
444
|
+
this.history_ = this.history_?.destroy();
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* The noise's texture, repeating in every direction, with its mipmaps for the far clouds.
|
|
448
|
+
* @param {any} context the scene's context
|
|
449
|
+
*/
|
|
450
|
+
createNoiseTexture_(context) {
|
|
451
|
+
if (!this.noiseTexture_) {
|
|
452
|
+
noise ??= createCloudNoise(NOISE_SIZE);
|
|
453
|
+
this.noiseTexture_ = new Texture3D({
|
|
454
|
+
context,
|
|
455
|
+
flipY: false,
|
|
456
|
+
source: { width: NOISE_SIZE, height: NOISE_SIZE, depth: NOISE_SIZE, arrayBufferView: noise },
|
|
457
|
+
sampler: new Sampler({
|
|
458
|
+
wrapS: TextureWrap.REPEAT,
|
|
459
|
+
wrapT: TextureWrap.REPEAT,
|
|
460
|
+
wrapR: TextureWrap.REPEAT,
|
|
461
|
+
minificationFilter: TextureMinificationFilter.LINEAR_MIPMAP_LINEAR,
|
|
462
|
+
magnificationFilter: TextureMagnificationFilter.LINEAR,
|
|
463
|
+
}),
|
|
464
|
+
});
|
|
465
|
+
this.noiseTexture_.generateMipmap();
|
|
466
|
+
}
|
|
467
|
+
return this.noiseTexture_;
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* The noise over the clouds' map, repeating.
|
|
471
|
+
* @param {any} context the scene's context
|
|
472
|
+
*/
|
|
473
|
+
createMapNoiseTexture_(context) {
|
|
474
|
+
if (!this.mapNoiseTexture_) {
|
|
475
|
+
mapNoise ??= createMapNoise(MAP_NOISE_SIZE);
|
|
476
|
+
this.mapNoiseTexture_ = new Texture({
|
|
477
|
+
context,
|
|
478
|
+
flipY: false,
|
|
479
|
+
source: { width: MAP_NOISE_SIZE, height: MAP_NOISE_SIZE, arrayBufferView: mapNoise },
|
|
480
|
+
sampler: new Sampler({
|
|
481
|
+
wrapS: TextureWrap.REPEAT,
|
|
482
|
+
wrapT: TextureWrap.REPEAT,
|
|
483
|
+
minificationFilter: TextureMinificationFilter.LINEAR,
|
|
484
|
+
magnificationFilter: TextureMagnificationFilter.LINEAR,
|
|
485
|
+
}),
|
|
486
|
+
});
|
|
487
|
+
}
|
|
488
|
+
return this.mapNoiseTexture_;
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* @override
|
|
492
|
+
* @param {import('@cesium/engine').Scene} scene
|
|
493
|
+
*/
|
|
494
|
+
activated_(scene) {
|
|
495
|
+
if (this.drift_ > 0) {
|
|
496
|
+
acquireFrames(scene, DRIFT_RATE);
|
|
497
|
+
}
|
|
498
|
+
scene.preRender.addEventListener(this.onPreRender_);
|
|
499
|
+
scene.postRender.addEventListener(this.onPostRender_);
|
|
500
|
+
acquireTerrainDepth(scene);
|
|
501
|
+
acquireCloudCover(scene, this.shadowSource_);
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* @override
|
|
505
|
+
* @param {import('@cesium/engine').Scene} scene
|
|
506
|
+
*/
|
|
507
|
+
deactivating_(scene) {
|
|
508
|
+
releaseCloudCover(scene, this.shadowSource_);
|
|
509
|
+
releaseTerrainDepth(scene);
|
|
510
|
+
scene.preRender.removeEventListener(this.onPreRender_);
|
|
511
|
+
scene.postRender.removeEventListener(this.onPostRender_);
|
|
512
|
+
if (this.settling_) {
|
|
513
|
+
this.settling_ = false;
|
|
514
|
+
releaseFrames(scene, SETTLE_RATE);
|
|
515
|
+
}
|
|
516
|
+
if (this.drift_ > 0) {
|
|
517
|
+
releaseFrames(scene, DRIFT_RATE);
|
|
518
|
+
}
|
|
519
|
+
this.destroyHistory_();
|
|
520
|
+
this.destroyShadow_();
|
|
521
|
+
this.copy_?.shaderProgram?.destroy();
|
|
522
|
+
this.copy_ = undefined;
|
|
523
|
+
this.weatherMap_.destroy();
|
|
524
|
+
this.noiseTexture_ = this.noiseTexture_?.destroy();
|
|
525
|
+
this.mapNoiseTexture_ = this.mapNoiseTexture_?.destroy();
|
|
526
|
+
}
|
|
527
|
+
/**
|
|
528
|
+
* Where it rains, or undefined for no clouds: an image whose red channel
|
|
529
|
+
* is the local intensity, 0 to 1, over a rectangle of longitudes and
|
|
530
|
+
* latitudes, north up, as Precipitation's map. Set it again after drawing
|
|
531
|
+
* on the image, which is read then.
|
|
532
|
+
*/
|
|
533
|
+
get map() {
|
|
534
|
+
return this.map_;
|
|
535
|
+
}
|
|
536
|
+
set map(value) {
|
|
537
|
+
this.map_ = value;
|
|
538
|
+
this.weatherMap_.map = value && createCloudMap(value);
|
|
539
|
+
this.shadowChanged_ = true;
|
|
540
|
+
// the previous map's clouds would linger
|
|
541
|
+
this.historyWeight_ = 0;
|
|
542
|
+
this.changed_ = true;
|
|
543
|
+
this.viewer.scene.requestRender();
|
|
544
|
+
}
|
|
545
|
+
/**
|
|
546
|
+
* The map the clouds crossfade to by the map blend, over the same
|
|
547
|
+
* rectangle, as the radar's next hour, or undefined for none.
|
|
548
|
+
*/
|
|
549
|
+
get nextMap() {
|
|
550
|
+
return this.nextMap_;
|
|
551
|
+
}
|
|
552
|
+
set nextMap(value) {
|
|
553
|
+
this.nextMap_ = value;
|
|
554
|
+
this.weatherMap_.nextMap = value && createCloudMap(value);
|
|
555
|
+
this.shadowChanged_ = true;
|
|
556
|
+
this.viewer.scene.requestRender();
|
|
557
|
+
}
|
|
558
|
+
/**
|
|
559
|
+
* From the map, 0, to the next map, 1.
|
|
560
|
+
*/
|
|
561
|
+
get mapBlend() {
|
|
562
|
+
return this.weatherMap_.blend;
|
|
563
|
+
}
|
|
564
|
+
set mapBlend(value) {
|
|
565
|
+
this.weatherMap_.blend = value;
|
|
566
|
+
this.shadowChanged_ = true;
|
|
567
|
+
this.viewer.scene.requestRender();
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* Altitude of the cloud base, in meters above the ellipsoid, as
|
|
571
|
+
* Precipitation's.
|
|
572
|
+
*/
|
|
573
|
+
get cloudBase() {
|
|
574
|
+
return this.cloudBase_;
|
|
575
|
+
}
|
|
576
|
+
set cloudBase(value) {
|
|
577
|
+
this.cloudBase_ = value;
|
|
578
|
+
this.shadowChanged_ = true;
|
|
579
|
+
this.viewer.scene.requestRender();
|
|
580
|
+
}
|
|
581
|
+
/**
|
|
582
|
+
* Altitude of the highest cloud tops, over the heaviest rain, in meters
|
|
583
|
+
* above the ellipsoid; over drizzle the clouds are 1500 m thick.
|
|
584
|
+
*/
|
|
585
|
+
get cloudTop() {
|
|
586
|
+
return this.cloudTop_;
|
|
587
|
+
}
|
|
588
|
+
set cloudTop(value) {
|
|
589
|
+
this.cloudTop_ = value;
|
|
590
|
+
this.shadowChanged_ = true;
|
|
591
|
+
this.viewer.scene.requestRender();
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* Scale of the clouds' opacity: 1 for solid clouds over heavy rain.
|
|
595
|
+
*/
|
|
596
|
+
get density() {
|
|
597
|
+
return this.density_;
|
|
598
|
+
}
|
|
599
|
+
set density(value) {
|
|
600
|
+
this.density_ = value;
|
|
601
|
+
this.shadowChanged_ = true;
|
|
602
|
+
this.viewer.scene.requestRender();
|
|
603
|
+
}
|
|
604
|
+
/**
|
|
605
|
+
* Speed of the wind that carries the clouds' noise toward the east, in m/s,
|
|
606
|
+
* by the scene's clock: a time-lapse while it runs faster, still while it
|
|
607
|
+
* is paused.
|
|
608
|
+
*/
|
|
609
|
+
get wind() {
|
|
610
|
+
return this.wind_;
|
|
611
|
+
}
|
|
612
|
+
set wind(value) {
|
|
613
|
+
this.wind_ = value;
|
|
614
|
+
this.shadowChanged_ = true;
|
|
615
|
+
this.viewer.scene.requestRender();
|
|
616
|
+
}
|
|
617
|
+
/**
|
|
618
|
+
* Speed of the drift of the clouds' noise toward the east, in m/s, by the
|
|
619
|
+
* real time rather than the scene's clock: the clouds move while the clock
|
|
620
|
+
* is paused, and the scene renders all the time while they are active. 0,
|
|
621
|
+
* by default, for none.
|
|
622
|
+
*/
|
|
623
|
+
get drift() {
|
|
624
|
+
return this.drift_;
|
|
625
|
+
}
|
|
626
|
+
set drift(value) {
|
|
627
|
+
const drifting = this.drift_ > 0;
|
|
628
|
+
this.drift_ = value;
|
|
629
|
+
if (this.stage_ && drifting !== value > 0) {
|
|
630
|
+
(value > 0 ? acquireFrames : releaseFrames)(this.viewer.scene, DRIFT_RATE);
|
|
631
|
+
}
|
|
632
|
+
this.viewer.scene.requestRender();
|
|
633
|
+
}
|
|
634
|
+
/**
|
|
635
|
+
* The map's intensity at the camera when it is inside the clouds, 0 to 1,
|
|
636
|
+
* read each frame while active; 0 outside them.
|
|
637
|
+
*/
|
|
638
|
+
get localDensity() {
|
|
639
|
+
return this.localDensity_;
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
//# sourceMappingURL=clouds.js.map
|