new PostProcessStageLibrary()
用于创建后处理特效的扩展库
Example
// ES5引入方式
const { PostProcessStageLibrary } = zondy
// ES6引入方式
import { PostProcessStageLibrary } from "@mapgis/webclient-cesium-plugin"
Methods
-
PostProcessStageLibrary.createAtmosphereFogStage(options){Cesium.PostProcessStage}
engineExtensions/effects/PostProcessStageLibrary.js, line 497 -
创建大气雾后处理特效对象
Name Type Description optionsObject 附加参数
Name Type Default Description viewerCesium.Viewer 场景视图对象
lightDensityNumber 0.5 可选 光强度,取值范围为[0, 1],值越大大气雾效果越亮
rayleighCoefficientNumber 0.2 可选 瑞利散射系数,取值范围为[0, 1],值越大,散射越强
mieCoefficientNumber 0.2 可选 米氏散射系数,取值范围为[0, 1],值越大,散射越强
absorbCoefficientNumber 0.0 可选 大气吸收系数,取值范围为[0, 1],值越大,吸收越强
Returns:
Type Description Cesium.PostProcessStage 大气雾后处理特效对象 Example
创建大气雾后处理特效对象 const atmosphereFog = viewer.scene.postProcessStages.add(PostProcessStageLibrary.createAtmosphereFogStage({ viewer })) atmosphereFog.enabled = false // 关闭后处理特效 atmosphereFog.uniforms.lightDensity = 0.4 // 修改相关参数 -
PostProcessStageLibrary.createCustomAtmosphereStage(options){Cesium.PostProcessStage}
engineExtensions/effects/PostProcessStageLibrary.js, line 545 -
创建自定义大气层后处理特效对象
Name Type Description optionsObject 附加参数
Name Type Default Description viewerCesium.Viewer 场景视图对象
heightNumber 0.2 可选 自定义大气层的厚度,取值范围为[0, 1],为0时大气层厚度为0, 为1时大气层厚度为支持的最大厚度
colorCesium.Color new Cesium.Color(1.0, 1.0, 1.0, 1.0) 可选 自定义大气层的颜色,默认为白色,从地表到顶部颜色透明度渐变渲染
Returns:
Type Description Cesium.PostProcessStage 自定义大气层后处理特效对象 Example
创建自定义大气层后处理特效对象 const customAtmosphere = viewer.scene.postProcessStages.add(PostProcessStageLibrary.createCustomAtmosphereStage({ viewer })) customAtmosphere.enabled = false // 关闭后处理特效 customAtmosphere.uniforms.height = 0.5 // 修改相关参数 -
PostProcessStageLibrary.createDepthOfFieldStage(options){Cesium.PostProcessStage}
engineExtensions/effects/PostProcessStageLibrary.js, line 357 -
创建景深移轴后处理特效对象
Name Type Description optionsObject 附加参数
Name Type Default Description viewerCesium.Viewer 场景视图对象
frontFocalDistanceNumber 100 可选 景深移轴效果的前景深距离,即在镜头中处于对焦点之前的清晰距离
backFocalDistanceNumber 300 可选 景深移轴效果的后景深距离,即在镜头中处于对焦点之后的模糊距离
focalPointCesium.Cartesian3 new Cesium.Cartesian3() 可选 景深移轴效果的对焦点
deltaNumber 1 可选 高斯模糊的采样步长因子,控制相邻采样点之间的距离,影响模糊的扩散程度
sigmaNumber 2 可选 高斯模糊的高斯分布标准差,决定权重分布的宽度,值越大模糊区域越广
stepSizeNumber 1 可选 高斯模糊的采样步长,控制采样点的稀疏程度,影响模糊质量和性能平衡
Returns:
Type Description Cesium.PostProcessStage 景深移轴后处理特效对象 Example
创建景深移轴后处理特效对象 const dof = viewer.scene.postProcessStages.add(PostProcessStageLibrary.createDepthOfFieldStage({ viewer })) dof.enabled = false // 关闭后处理特效 dof.uniforms.frontFocalDistance = 10 // 修改相关参数 dof.uniforms.backFocalDistance = 400 // 修改相关参数 -
PostProcessStageLibrary.createFogStage(options){Cesium.PostProcessStage}
engineExtensions/effects/PostProcessStageLibrary.js, line 138 -
创建场景雾后处理特效对象
Name Type Description optionsObject 附加参数
Name Type Default Description viewerCesium.Viewer 场景视图对象
alphaNumber 1.0 可选 场景雾的整体透明度,取值范围为[0, 1]
fogcolorCesium.Color Cesium.Color.WHITE 可选 场景雾的颜色
fogByDistanceCesium.Cartesian4 new Cesium.Cartesian4(10.0, 0.0, 500.0, 0.9) 可选 场景雾在不同距离下的透明度,Cesium.Cartesian4的四个分量表示:(近段距离, 近段透明度, 远端距离, 远端透明度)
Returns:
Type Description Cesium.PostProcessStage 场景雾后处理特效对象 Example
创建场景雾后处理特效对象 const fog = viewer.scene.postProcessStages.add(PostProcessStageLibrary.createFogStage({ viewer, alpha: 0.1, })) fog.enabled = false // 关闭后处理特效 fog.uniforms.alpha = 0.7 // 修改相关参数 -
PostProcessStageLibrary.createGodRayStage(options){Cesium.PostProcessStage}
engineExtensions/effects/PostProcessStageLibrary.js, line 262 -
创建体积光后处理特效对象
Name Type Description optionsObject 附加参数
Name Type Default Description viewerCesium.Viewer 场景视图对象
alphaNumber 0.9 可选 体积光的透明程度,取值范围为[0, 1]
intensityNumber 0.95 可选 体积光的强度,建议取值范围为[0, 10]
sampleCountNumber 300 可选 体积光径向模糊采样次数,采样次数越多则光线变化越平滑
Returns:
Type Description Cesium.PostProcessStage 体积光后处理特效对象 Example
创建体积光后处理特效对象 const godRay = viewer.scene.postProcessStages.add(PostProcessStageLibrary.createGodRayStage({ viewer, intensity: 2.6, })) godRay.enabled = false // 关闭后处理特效 godRay.uniforms.alpha = 0.5 // 修改相关参数 godRay.uniforms.sampleCount = 400 // 修改相关参数 -
PostProcessStageLibrary.createHeightFogStage(options){Cesium.PostProcessStage}
engineExtensions/effects/PostProcessStageLibrary.js, line 217 -
创建场景高度雾后处理特效对象
Name Type Description optionsObject 附加参数
Name Type Default Description viewerCesium.Viewer 场景视图对象
heightNumber 1000 可选 场景高度雾的高度
densityNumber 0.1 可选 场景高度雾的浓度
colorCesium.Color new Cesium.Color(0.9,0.9,0.9,1.0) 可选 场景高度雾的颜色
Returns:
Type Description Cesium.PostProcessStage 场景高度雾后处理特效对象 Example
创建场景高度雾后处理特效对象 const heightFog = viewer.scene.postProcessStages.add(PostProcessStageLibrary.createHeightFogStage({ viewer, density: 0.1, })) heightFog.enabled = false // 关闭后处理特效 heightFog.uniforms.density = 0.5 // 修改相关参数 heightFog.uniforms.height = 700 // 修改相关参数 -
PostProcessStageLibrary.createLensFlareStage(options){Cesium.PostProcessStage}
engineExtensions/effects/PostProcessStageLibrary.js, line 455 -
创建镜头光斑后处理特效对象
Name Type Description optionsObject 附加参数
Name Type Default Description viewerCesium.Viewer 场景视图对象
alphaNumber 1 可选 镜头光斑的透明度,取值范围为[0, 1]
intensityNumber 2.6 可选 镜头光斑的光亮强度,建议取值范围为[0, 5]
scaleNumber 0.5 可选 镜头光斑的缩放比例,建议取值范围为[0, 1]
Returns:
Type Description Cesium.PostProcessStage 景镜头光斑后处理特效对象 Example
创建镜头光斑后处理特效对象 const lensFlare = viewer.scene.postProcessStages.add(PostProcessStageLibrary.createLensFlareStage({ viewer })) lensFlare.enabled = false // 关闭后处理特效 lensFlare.uniforms.alpha = 0.5 // 修改相关参数 lensFlare.uniforms.intensity = 2 // 修改相关参数 -
PostProcessStageLibrary.createRainStage(options){Cesium.PostProcessStage}
engineExtensions/effects/PostProcessStageLibrary.js, line 94 -
创建降雨后处理特效对象
Name Type Description optionsObject 附加参数
Name Type Default Description viewerCesium.Viewer 场景视图对象
alphaNumber 0.3 可选 雨滴的透明度,取值范围为[0, 1]
angleNumber 0.0 可选 雨滴下落的倾斜角度,单位度,该值为正值时雨滴向左倾斜,该值为负值时雨滴向右倾斜,默认值为0,表示垂直下落
speedNumber 15.0 可选 雨滴下落的速度
rainLengthNumber 0.0 可选 雨滴下落的拖尾长度
factorNumber 0.1 可选 降雨特效与场景的混合程度,取值范围为[0, 1]
intensityNumber 1.0 可选 降雨的强度,取值范围为[0, 1]
Returns:
Type Description Cesium.PostProcessStage 降雨后处理特效对象 Example
创建降雨后处理特效对象 const rain = viewer.scene.postProcessStages.add(PostProcessStageLibrary.createRainStage({ viewer, alpha: 0.1, speed: 5 })) rain.enabled = false // 关闭后处理特效 rain.uniforms.alpha = 0.7 // 修改相关参数 rain.uniforms.speed = 20 // 修改相关参数 -
PostProcessStageLibrary.createSnowpackStage(options){Cesium.PostProcessStage}
engineExtensions/effects/PostProcessStageLibrary.js, line 181 -
创建积雪后处理特效对象
Name Type Description optionsObject 附加参数
Name Type Default Description viewerCesium.Viewer 场景视图对象
densityNumber 0.15 可选 积雪的厚度程度
alphaNumber 1.0 可选 积雪的透明度
Returns:
Type Description Cesium.PostProcessStage 积雪后处理特效对象 Example
创建积雪后处理特效对象 const snowpack = viewer.scene.postProcessStages.add(PostProcessStageLibrary.createSnowpackStage({ viewer, density: 0.7, alpha: 1.0, })) snowpack.enabled = false // 关闭后处理特效 snowpack.uniforms.density = 0.5 // 修改相关参数 -
PostProcessStageLibrary.createSnowStage(options){Cesium.PostProcessStage}
engineExtensions/effects/PostProcessStageLibrary.js, line 50 -
创建降雪后处理特效对象
Name Type Description optionsObject 附加参数
Name Type Default Description viewerCesium.Viewer 场景视图对象
sizeNumber 5 可选 雪花的大小
scaleNumber 5 可选 降雪场景的缩放系数
speedNumber 5 可选 雪花下降的速度
showIceFogNumber true 可选 是否开启场景冰雾效果(该效果表达的是一种悬浮在空气中的大量微小冰晶组成的雾,可以使降雪场景更加逼真)
Returns:
Type Description Cesium.PostProcessStage 降雪后处理特效对象 Example
创建降雪后处理特效对象 const snow = viewer.scene.postProcessStages.add(PostProcessStageLibrary.createSnowStage({ viewer, size: 5, scale: 5, speed: 5 })) snow.enabled = false // 关闭后处理特效 snow.uniforms.size = 10 // 修改相关参数 snow.uniforms.scale = 3 // 修改相关参数 snow.uniforms.speed = 3 // 修改相关参数