| @@ -2,7 +2,7 @@ | |||
| * @Author: Caven | |||
| * @Date: 2020-01-03 10:09:19 | |||
| * @Last Modified by: Caven | |||
| * @Last Modified time: 2020-02-25 12:06:47 | |||
| * @Last Modified time: 2020-02-26 23:11:16 | |||
| */ | |||
| import Cesium from '@/namespace' | |||
| @@ -76,7 +76,8 @@ DC.OverlayType = { | |||
| CIRCLE: 'circle', | |||
| RECT: 'rect', | |||
| LABEL: 'label', | |||
| PLANE: 'plane' | |||
| PLANE: 'plane', | |||
| WALL: 'wall' | |||
| } | |||
| DC.OverlayEventType = { | |||
| @@ -91,6 +92,7 @@ DC.OverlayState = { | |||
| DC.EffectType = { | |||
| RAIN: 'rain', | |||
| SNOW: 'snow', | |||
| FOG: 'fog', | |||
| BLOOM: 'bloom', | |||
| CIRCLE_SCAN: 'circleScan', | |||
| RADAR_SCAN: 'radarScan' | |||
| @@ -2,7 +2,7 @@ | |||
| * @Author: Caven | |||
| * @Date: 2019-12-30 09:24:37 | |||
| * @Last Modified by: Caven | |||
| * @Last Modified time: 2020-02-25 10:49:36 | |||
| * @Last Modified time: 2020-02-25 20:38:05 | |||
| */ | |||
| import Cesium from '@/namespace' | |||
| @@ -20,6 +20,7 @@ class ViewerOption { | |||
| ) | |||
| this._viewer.delegate.scene.screenSpaceCameraController.maximumZoomDistance = 40489014.0 | |||
| this._viewer.delegate.scene.backgroundColor = Cesium.Color.TRANSPARENT | |||
| this._viewer.delegate.scene.postProcessStages.fxaa.enabled = true | |||
| } | |||
| _setViewerOption(options) { | |||
| @@ -50,6 +51,11 @@ class ViewerOption { | |||
| true | |||
| ) | |||
| this._viewer.delegate.scene.postProcessStages.fxaa.enabled = Cesium.defaultValue( | |||
| options.fxaa, | |||
| false | |||
| ) | |||
| return this | |||
| } | |||
| @@ -2,7 +2,7 @@ | |||
| * @Author: Caven | |||
| * @Date: 2020-01-19 10:18:23 | |||
| * @Last Modified by: Caven | |||
| * @Last Modified time: 2020-02-20 19:29:15 | |||
| * @Last Modified time: 2020-02-26 12:01:58 | |||
| */ | |||
| import Cesium from '@/namespace' | |||
| @@ -2,7 +2,7 @@ | |||
| * @Author: Caven | |||
| * @Date: 2019-12-27 17:13:24 | |||
| * @Last Modified by: Caven | |||
| * @Last Modified time: 2020-02-25 11:10:11 | |||
| * @Last Modified time: 2020-02-25 12:16:57 | |||
| */ | |||
| import Cesium from '@/namespace' | |||
| @@ -2,7 +2,7 @@ | |||
| * @Author: Caven | |||
| * @Date: 2020-02-20 13:26:49 | |||
| * @Last Modified by: Caven | |||
| * @Last Modified time: 2020-02-24 16:33:50 | |||
| * @Last Modified time: 2020-02-26 23:11:36 | |||
| */ | |||
| import Effect from './Effect' | |||
| @@ -2,13 +2,13 @@ | |||
| * @Author: Caven | |||
| * @Date: 2020-02-24 14:11:22 | |||
| * @Last Modified by: Caven | |||
| * @Last Modified time: 2020-02-24 16:33:44 | |||
| * @Last Modified time: 2020-02-26 23:11:23 | |||
| */ | |||
| import Cesium from '@/namespace' | |||
| import Effect from './Effect' | |||
| let CircleScanShader = require('../shader/CircleScanMaterial.glsl') | |||
| let CircleScanShader = require('../shader/CircleScanShader.glsl') | |||
| DC.CircleScanEffect = class extends Effect { | |||
| constructor(id, position, radius, color, duration) { | |||
| @@ -91,27 +91,4 @@ DC.CircleScanEffect = class extends Effect { | |||
| } | |||
| }) | |||
| } | |||
| /** | |||
| * | |||
| * @param {*} viewer | |||
| * 效果添加的回调函数, | |||
| */ | |||
| _addCallback(viewer) { | |||
| this._viewer = viewer | |||
| this._prepareDelegate() | |||
| if (this._delegate) { | |||
| this._viewer.delegate.scene.postProcessStages.add(this._delegate) | |||
| } | |||
| this._state = DC.EffectState.ADDED | |||
| } | |||
| /** | |||
| * 效果添加的回调函数 | |||
| */ | |||
| _removeCallback() { | |||
| if ((this._viewer, this._delegate)) { | |||
| this._viewer.delegate.scene.postProcessStages.remove(this._delegate) | |||
| } | |||
| this._state = DC.EffectState.REMOVED | |||
| } | |||
| } | |||
| @@ -0,0 +1,38 @@ | |||
| /* | |||
| * @Author: Caven | |||
| * @Date: 2020-02-26 23:05:44 | |||
| * @Last Modified by: Caven | |||
| * @Last Modified time: 2020-02-26 23:10:48 | |||
| */ | |||
| import Cesium from '@/namespace' | |||
| import Effect from './Effect' | |||
| let FogShader = require('../shader/FogShader.glsl') | |||
| DC.FogEffect = class extends Effect { | |||
| constructor(id, color, trength = 1) { | |||
| super(id) | |||
| this._trength = trength || 1 | |||
| this._color = color || new Cesium.Color(0.8, 0.8, 0.8, 0.5) | |||
| this.type = DC.EffectType.FOG | |||
| } | |||
| /** | |||
| * 准备代理 | |||
| */ | |||
| _prepareDelegate() { | |||
| let _this = this | |||
| this._delegate = new Cesium.PostProcessStage({ | |||
| name: this._id, | |||
| fragmentShader: FogShader, | |||
| uniforms: { | |||
| trength: () => { | |||
| return _this.trength | |||
| }, | |||
| fogcolor: () => { | |||
| return _this.color | |||
| } | |||
| } | |||
| }) | |||
| } | |||
| } | |||
| @@ -2,13 +2,13 @@ | |||
| * @Author: Caven | |||
| * @Date: 2020-02-24 14:11:22 | |||
| * @Last Modified by: Caven | |||
| * @Last Modified time: 2020-02-24 16:29:30 | |||
| * @Last Modified time: 2020-02-26 23:11:42 | |||
| */ | |||
| import Cesium from '@/namespace' | |||
| import Effect from './Effect' | |||
| let RadarScanShader = require('../shader/RadarScanMaterial.glsl') | |||
| let RadarScanShader = require('../shader/RadarScanShader.glsl') | |||
| DC.RadarScanEffect = class extends Effect { | |||
| constructor(id, position, radius, color, duration) { | |||
| @@ -155,27 +155,4 @@ DC.RadarScanEffect = class extends Effect { | |||
| } | |||
| }) | |||
| } | |||
| /** | |||
| * | |||
| * @param {*} viewer | |||
| * 效果添加的回调函数, | |||
| */ | |||
| _addCallback(viewer) { | |||
| this._viewer = viewer | |||
| this._prepareDelegate() | |||
| if (this._delegate) { | |||
| this._viewer.delegate.scene.postProcessStages.add(this._delegate) | |||
| } | |||
| this._state = DC.EffectState.ADDED | |||
| } | |||
| /** | |||
| * 效果添加的回调函数 | |||
| */ | |||
| _removeCallback() { | |||
| if ((this._viewer, this._delegate)) { | |||
| this._viewer.delegate.scene.postProcessStages.remove(this._delegate) | |||
| } | |||
| this._state = DC.EffectState.REMOVED | |||
| } | |||
| } | |||
| @@ -2,5 +2,26 @@ | |||
| * @Author: Caven | |||
| * @Date: 2020-01-15 20:23:42 | |||
| * @Last Modified by: Caven | |||
| * @Last Modified time: 2020-02-24 16:33:53 | |||
| * @Last Modified time: 2020-02-26 23:11:47 | |||
| */ | |||
| import Cesium from '@/namespace' | |||
| import Effect from './Effect' | |||
| let RainShader = require('../shader/RainShader.glsl') | |||
| DC.RainEffect = class extends Effect { | |||
| constructor(id) { | |||
| super(id) | |||
| this.type = DC.EffectType.RAIN | |||
| } | |||
| /** | |||
| * 准备代理 | |||
| */ | |||
| _prepareDelegate() { | |||
| this._delegate = new Cesium.PostProcessStage({ | |||
| name: this._id, | |||
| fragmentShader: RainShader | |||
| }) | |||
| } | |||
| } | |||
| @@ -1,6 +1,27 @@ | |||
| /* | |||
| * @Author: Caven | |||
| * @Date: 2020-01-15 20:23:46 | |||
| * @Last Modified by: Caven | |||
| * @Last Modified time: 2020-01-15 20:23:46 | |||
| * @Last Modified by: Caven | |||
| * @Last Modified time: 2020-02-26 23:10:21 | |||
| */ | |||
| import Cesium from '@/namespace' | |||
| import Effect from './Effect' | |||
| let SnowShader = require('../shader/SnowShader.glsl') | |||
| DC.SnowEffect = class extends Effect { | |||
| constructor(id) { | |||
| super(id) | |||
| this.type = DC.EffectType.SNOW | |||
| } | |||
| /** | |||
| * 准备代理 | |||
| */ | |||
| _prepareDelegate() { | |||
| this._delegate = new Cesium.PostProcessStage({ | |||
| name: this._id, | |||
| fragmentShader: SnowShader | |||
| }) | |||
| } | |||
| } | |||
| @@ -1,24 +0,0 @@ | |||
| /* | |||
| * @Author: Caven | |||
| * @Date: 2020-01-14 18:25:41 | |||
| * @Last Modified by: Caven | |||
| * @Last Modified time: 2020-02-24 16:54:24 | |||
| */ | |||
| import Cesium from '@/namespace' | |||
| import Effect from './Effect' | |||
| DC.WaterEffect = class extends Effect { | |||
| constructor(positions) { | |||
| super() | |||
| this._positions = positions | |||
| } | |||
| _prepareDelegate() { | |||
| let geometry = Cesium.PolygonGeometry.fromPositions({}) | |||
| this._delegate = new Cesium.Primitive({ | |||
| geometryInstances: new Cesium.GeometryInstance({ | |||
| geometry | |||
| }) | |||
| }) | |||
| } | |||
| } | |||
| @@ -2,7 +2,7 @@ | |||
| * @Author: Caven | |||
| * @Date: 2020-01-14 18:33:33 | |||
| * @Last Modified by: Caven | |||
| * @Last Modified time: 2020-02-20 14:20:41 | |||
| * @Last Modified time: 2020-02-26 23:12:14 | |||
| */ | |||
| import EffectEvent from '@/core/event/EffectEvent' | |||
| @@ -36,12 +36,25 @@ class Effect { | |||
| * @param {*} viewer | |||
| * 效果添加的回调函数, | |||
| */ | |||
| _addCallback(viewer) {} | |||
| _addCallback(viewer) { | |||
| this._viewer = viewer | |||
| this._prepareDelegate() | |||
| if (this._delegate) { | |||
| this._viewer.delegate.scene.postProcessStages.add(this._delegate) | |||
| } | |||
| this._state = DC.EffectState.ADDED | |||
| } | |||
| /** | |||
| * 效果添加的回调函数 | |||
| */ | |||
| _removeCallback() {} | |||
| _removeCallback() { | |||
| if ((this._viewer, this._delegate)) { | |||
| this._viewer.delegate.scene.postProcessStages.remove(this._delegate) | |||
| this._delegate = undefined | |||
| } | |||
| this._state = DC.EffectState.REMOVED | |||
| } | |||
| /** | |||
| * | |||
| @@ -0,0 +1,71 @@ | |||
| /* | |||
| * @Author: Caven | |||
| * @Date: 2020-02-26 10:15:55 | |||
| * @Last Modified by: Caven | |||
| * @Last Modified time: 2020-02-26 22:43:40 | |||
| */ | |||
| import Cesium from '@/namespace' | |||
| let LineEmissionShader = require('../shader/PolylineEmissionShader.glsl') | |||
| DC.PolylineEmissionMaterialProperty = class { | |||
| constructor(options) { | |||
| options = options || {} | |||
| this._definitionChanged = new Cesium.Event() | |||
| this._color = undefined | |||
| this._colorSubscription = undefined | |||
| this.color = Cesium.defaultValue( | |||
| options.color, | |||
| new Cesium.Color(1.0, 0.0, 0.0, 0.7) | |||
| ) | |||
| } | |||
| get isConstant() { | |||
| return false | |||
| } | |||
| get definitionChanged() { | |||
| return this._definitionChanged | |||
| } | |||
| getType(time) { | |||
| return Cesium.Material.PolylineEmissionType | |||
| } | |||
| getValue(time, result) { | |||
| if (!result) { | |||
| result = {} | |||
| } | |||
| result.color = Cesium.Property.getValueOrUndefined(this._color, time) | |||
| return result | |||
| } | |||
| equals(other) { | |||
| return ( | |||
| this === other || | |||
| (other instanceof DC.PolylineEmissionMaterialProperty && | |||
| Cesium.Property.equals(this._color, other._color)) | |||
| ) | |||
| } | |||
| } | |||
| Cesium.defineProperties(DC.PolylineEmissionMaterialProperty.prototype, { | |||
| color: Cesium.createPropertyDescriptor('color') | |||
| }) | |||
| Cesium.Material.PolylineEmissionType = 'PolylineEmission' | |||
| Cesium.Material._materialCache.addMaterial( | |||
| Cesium.Material.PolylineEmissionType, | |||
| { | |||
| fabric: { | |||
| type: Cesium.Material.PolylineEmissionType, | |||
| uniforms: { | |||
| color: new Cesium.Color(1.0, 0.0, 0.0, 0.7) | |||
| }, | |||
| source: LineEmissionShader | |||
| }, | |||
| translucent: function(material) { | |||
| return true | |||
| } | |||
| } | |||
| ) | |||
| @@ -2,12 +2,12 @@ | |||
| * @Author: Caven | |||
| * @Date: 2020-02-24 13:53:52 | |||
| * @Last Modified by: Caven | |||
| * @Last Modified time: 2020-02-24 13:57:34 | |||
| * @Last Modified time: 2020-02-26 22:43:52 | |||
| */ | |||
| import Cesium from '@/namespace' | |||
| let LineFlowShader = require('../shader/PolylineFlowMaterial.glsl') | |||
| let LineFlowShader = require('../shader/PolylineFlowShader.glsl') | |||
| DC.PolylineFlowMaterialProperty = class { | |||
| constructor(options) { | |||
| @@ -2,7 +2,7 @@ | |||
| * @Author: Caven | |||
| * @Date: 2020-02-24 13:09:09 | |||
| * @Last Modified by: Caven | |||
| * @Last Modified time: 2020-02-24 14:07:45 | |||
| * @Last Modified time: 2020-02-26 22:43:55 | |||
| */ | |||
| import Cesium from '@/namespace' | |||
| @@ -10,7 +10,7 @@ import Cesium from '@/namespace' | |||
| const IMG = | |||
| 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAAgCAYAAABkS8DlAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAADSSURBVHja7NYxEoUgDEDBYM39z2qHtZViwMFxt1FJnF/98ZXWWkRE7LWWOOt5Lsm9q/vsbu9Zdtazs/J19O5bs1XPZrwze/6V31zxbOZs1n905Wt2p3f25GzE7ohv6q3nLQCA3xEAACAAAAABAAAIAABAAAAAAgAAEAAAgAAAAAQAACAAAAABAAAIAABAAAAAAgAAEAAAgAAAAAQAACAAAEAAAAACAAAQAACAAAAABAAAIAAAAAEAAAgAAEAAAAACAAAQAACAAAAA8g4AAAD//wMA4WEFTJOT5UIAAAAASUVORK5CYII=' | |||
| let LineTrailShader = require('../shader/PolylineTrailMaterial.glsl') | |||
| let LineTrailShader = require('../shader/PolylineTrailShader.glsl') | |||
| DC.PolylineTrailMaterialProperty = class { | |||
| constructor(options) { | |||
| @@ -0,0 +1,66 @@ | |||
| /* | |||
| * @Author: Caven | |||
| * @Date: 2020-02-25 22:49:56 | |||
| * @Last Modified by: Caven | |||
| * @Last Modified time: 2020-02-26 22:44:11 | |||
| */ | |||
| import Cesium from '@/namespace' | |||
| DC.RimLightingMaterialProperty = class { | |||
| constructor(options) { | |||
| options = options || {} | |||
| this._definitionChanged = new Cesium.Event() | |||
| this._color = undefined | |||
| this._colorSubscription = undefined | |||
| this.color = Cesium.defaultValue( | |||
| options.color, | |||
| new Cesium.Color(1.0, 0.0, 0.0, 0.7) | |||
| ) | |||
| this._rimColor = undefined | |||
| this._rimColorSubscription = undefined | |||
| this.rimColor = Cesium.defaultValue( | |||
| options.rimColor, | |||
| new Cesium.Color(1.0, 1.0, 1.0, 0.4) | |||
| ) | |||
| this._width = undefined | |||
| this._widthSubscription = undefined | |||
| this.width = Cesium.defaultValue(options.width, 0.3) | |||
| } | |||
| get isConstant() { | |||
| return false | |||
| } | |||
| get definitionChanged() { | |||
| return this._definitionChanged | |||
| } | |||
| getType(time) { | |||
| return Cesium.Material.RimLightingType | |||
| } | |||
| getValue(time, result) { | |||
| if (!result) { | |||
| result = {} | |||
| } | |||
| result.color = Cesium.Property.getValueOrUndefined(this._color, time) | |||
| result.rimColor = Cesium.Property.getValueOrUndefined(this._rimColor, time) | |||
| result.width = Cesium.Property.getValueOrUndefined(this._width, time) | |||
| return result | |||
| } | |||
| equals(other) { | |||
| return ( | |||
| this === other || | |||
| (other instanceof DC.RimLightingMaterialProperty && | |||
| Cesium.Property.equals(this._color, other._color)) | |||
| ) | |||
| } | |||
| } | |||
| Cesium.defineProperties(DC.RimLightingMaterialProperty.prototype, { | |||
| color: Cesium.createPropertyDescriptor('color'), | |||
| rimColor: Cesium.createPropertyDescriptor('rimColor'), | |||
| width: Cesium.createPropertyDescriptor('width') | |||
| }) | |||
| @@ -0,0 +1,98 @@ | |||
| /* | |||
| * @Author: Caven | |||
| * @Date: 2020-02-25 21:16:00 | |||
| * @Last Modified by: Caven | |||
| * @Last Modified time: 2020-02-25 23:14:25 | |||
| */ | |||
| import Cesium from '@/namespace' | |||
| DC.WaterMaterialProperty = class { | |||
| constructor(options) { | |||
| options = options || {} | |||
| this._definitionChanged = new Cesium.Event() | |||
| this._baseWaterColor = undefined | |||
| this._baseWaterColorSubscription = undefined | |||
| this.baseWaterColor = Cesium.defaultValue( | |||
| options.baseWaterColor, | |||
| new Cesium.Color(0.2, 0.3, 0.6, 1.0) | |||
| ) | |||
| this._blendColor = undefined | |||
| this._blendColorSubscription = undefined | |||
| this.blendColor = Cesium.defaultValue( | |||
| options.blendColor, | |||
| new Cesium.Color(0.0, 1.0, 0.699, 1.0) | |||
| ) | |||
| this._specularMap = undefined | |||
| this._specularMapSubscription = undefined | |||
| this.specularMap = Cesium.defaultValue( | |||
| options.specularMap, | |||
| Cesium.Material.DefaultImageId | |||
| ) | |||
| this._normalMap = undefined | |||
| this._normalMapSubscription = undefined | |||
| this.normalMap = Cesium.defaultValue( | |||
| options.normalMap, | |||
| Cesium.Material.DefaultImageId | |||
| ) | |||
| this.frequency = Cesium.defaultValue(options.frequency, 10) | |||
| this.animationSpeed = Cesium.defaultValue(options.animationSpeed, 0.01) | |||
| this.amplitude = Cesium.defaultValue(options.amplitude, 1.0) | |||
| this.specularIntensity = Cesium.defaultValue(options.specularIntensity, 0.5) | |||
| this.fadeFactor = Cesium.defaultValue(options.fadeFactor, 1.0) | |||
| } | |||
| get isConstant() { | |||
| return false | |||
| } | |||
| get definitionChanged() { | |||
| return this._definitionChanged | |||
| } | |||
| getType(time) { | |||
| return Cesium.Material.WaterType | |||
| } | |||
| getValue(time, result) { | |||
| if (!result) { | |||
| result = {} | |||
| } | |||
| result.baseWaterColor = Cesium.Property.getValueOrUndefined( | |||
| this._baseWaterColor, | |||
| time | |||
| ) | |||
| result.blendColor = Cesium.Property.getValueOrUndefined( | |||
| this._blendColor, | |||
| time | |||
| ) | |||
| result.specularMap = Cesium.Property.getValueOrUndefined( | |||
| this._specularMap, | |||
| time | |||
| ) | |||
| result.normalMap = Cesium.Property.getValueOrUndefined( | |||
| this._normalMap, | |||
| time | |||
| ) | |||
| result.frequency = this.frequency | |||
| result.animationSpeed = this.animationSpeed | |||
| result.amplitude = this.amplitude | |||
| result.specularIntensity = this.specularIntensity | |||
| result.fadeFactor = this.fadeFactor | |||
| return result | |||
| } | |||
| equals(other) { | |||
| return ( | |||
| this === other || | |||
| (other instanceof DC.WaterMaterialProperty && | |||
| Cesium.Property.equals(this._baseWaterColor, other._baseWaterColor)) | |||
| ) | |||
| } | |||
| } | |||
| Cesium.defineProperties(DC.WaterMaterialProperty.prototype, { | |||
| baseWaterColor: Cesium.createPropertyDescriptor('baseWaterColor'), | |||
| blendColor: Cesium.createPropertyDescriptor('blendColor'), | |||
| specularMap: Cesium.createPropertyDescriptor('specularMap'), | |||
| normalMap: Cesium.createPropertyDescriptor('normalMap') | |||
| }) | |||
| @@ -2,8 +2,11 @@ | |||
| * @Author: Caven | |||
| * @Date: 2020-02-24 13:28:37 | |||
| * @Last Modified by: Caven | |||
| * @Last Modified time: 2020-02-24 13:57:49 | |||
| * @Last Modified time: 2020-02-26 10:19:38 | |||
| */ | |||
| import './DC.PolylineTrailMaterialProperty' | |||
| import './DC.PolylineFlowMaterialProperty' | |||
| import './DC.PolylineEmissionMaterialProperty' | |||
| import './DC.WaterMaterialProperty' | |||
| import './DC.RimLightingMaterialProperty' | |||
| @@ -0,0 +1,85 @@ | |||
| /* | |||
| * @Author: Caven | |||
| * @Date: 2020-02-25 18:28:36 | |||
| * @Last Modified by: Caven | |||
| * @Last Modified time: 2020-02-25 20:02:19 | |||
| */ | |||
| import Cesium from '@/namespace' | |||
| import Overlay from '../../core/overlay/Overlay' | |||
| DC.Wall = class extends Overlay { | |||
| constructor(positions) { | |||
| if ( | |||
| !positions || | |||
| (typeof positions !== 'string' && !Array.isArray(positions)) | |||
| ) { | |||
| throw new Error('the positions invalid') | |||
| } | |||
| super() | |||
| this._positions = [] | |||
| this._preparePositions(positions) | |||
| this._delegate = new Cesium.Entity() | |||
| this._state = DC.OverlayState.INITIALIZED | |||
| this.type = DC.OverlayType.WALL | |||
| } | |||
| set positions(positions) { | |||
| this._preparePositions(positions) | |||
| } | |||
| get positions() { | |||
| return this._positions | |||
| } | |||
| /** | |||
| * | |||
| * @param {*} positions | |||
| */ | |||
| _preparePositions(positions) { | |||
| if (typeof positions === 'string') { | |||
| if (positions.indexOf('#') >= 0) { | |||
| throw new Error('the positions invalid') | |||
| } | |||
| positions = positions.split(';') | |||
| } | |||
| this._positions = positions.map(item => { | |||
| if (Array.isArray(item)) { | |||
| return DC.Position.fromCoordArray(item) | |||
| } else if (item instanceof DC.Position) { | |||
| return item | |||
| } else { | |||
| return DC.Position.fromCoordString(item) | |||
| } | |||
| }) | |||
| } | |||
| /** | |||
| * prepare entity | |||
| */ | |||
| _prepareDelegate() { | |||
| /** | |||
| * initialize the Overlay parameter | |||
| */ | |||
| this._delegate.wall = { | |||
| ...this._style, | |||
| positions: new Cesium.CallbackProperty(time => { | |||
| return DC.T.transformWSG84ArrayToCartesianArray(this._positions) | |||
| }) | |||
| } | |||
| this._delegate.layer = this._layer | |||
| this._delegate.overlayId = this._id | |||
| } | |||
| /** | |||
| * | |||
| * @param {*} style | |||
| */ | |||
| setStyle(style) { | |||
| if (Object.keys(style).length == 0) { | |||
| return | |||
| } | |||
| this._style = style | |||
| this._delegate.wall && DC.Util.merge(this._delegate.wall, this._style) | |||
| return this | |||
| } | |||
| } | |||
| @@ -1,12 +1,12 @@ | |||
| uniform vec4 color; | |||
| uniform float time; | |||
| uniform float duration; | |||
| czm_material czm_getMaterial(czm_materialInput materialInput){ | |||
| czm_material material = czm_getDefaultMaterial(materialInput); | |||
| material.diffuse = 1.5 * color.rgb; | |||
| vec2 st = materialInput.st; | |||
| float dis = distance(st, vec2(0.5, 0.5)); | |||
| float per = fract(time); | |||
| float per = fract(czm_frameNumber / duration); | |||
| if(dis > per * 0.5){ | |||
| discard; | |||
| }else { | |||
| @@ -0,0 +1,18 @@ | |||
| uniform sampler2D colorTexture; | |||
| uniform sampler2D depthTexture; | |||
| uniform float trength; | |||
| uniform vec4 fogcolor; | |||
| varying vec2 v_textureCoordinates; | |||
| void main(void){ | |||
| vec4 origcolor=texture2D(colorTexture, v_textureCoordinates); | |||
| float depth = czm_readDepth(depthTexture, v_textureCoordinates); | |||
| vec4 depthcolor=texture2D(depthTexture, v_textureCoordinates); | |||
| float f=trength*(depthcolor.r-0.3)/0.2; | |||
| if(f<0.0) { | |||
| f=0.0; | |||
| }else if(f>1.0){ | |||
| f=1.0; | |||
| } | |||
| gl_FragColor = mix(origcolor,fogcolor,f); | |||
| } | |||
| @@ -0,0 +1,11 @@ | |||
| uniform vec4 color; | |||
| czm_material czm_getMaterial(czm_materialInput materialInput){ | |||
| czm_material material = czm_getDefaultMaterial(materialInput); | |||
| vec4 fragColor = color; | |||
| fragColor = czm_gammaCorrect(fragColor); | |||
| material.emission = fragColor.rgb; | |||
| material.diffuse = fragColor.rgb; | |||
| material.alpha = color.a; | |||
| return material; | |||
| } | |||
| @@ -4,7 +4,7 @@ uniform float duration; | |||
| czm_material czm_getMaterial(czm_materialInput materialInput){ | |||
| czm_material material = czm_getDefaultMaterial(materialInput); | |||
| vec2 st = materialInput.st; | |||
| float t = mod(czm_frameNumber, duration) / duration; | |||
| float t =fract(czm_frameNumber / duration); | |||
| t *= 1.03; | |||
| float alpha = smoothstep(t- 0.03, t, st.s) * step(-t, -st.s); | |||
| alpha += 0.1; | |||
| @@ -5,7 +5,7 @@ | |||
| czm_material czm_getMaterial(czm_materialInput materialInput){ | |||
| czm_material material = czm_getDefaultMaterial(materialInput); | |||
| vec2 st = materialInput.st; | |||
| float time = mod(czm_frameNumber, duration) / duration; | |||
| float time = fract(czm_frameNumber / duration); | |||
| vec4 colorImage = texture2D(image, vec2(fract(st.s - time), st.t)); | |||
| material.alpha = colorImage.a * color.a; | |||
| material.diffuse = (colorImage.rgb + color.rgb)/2.0; | |||
| @@ -0,0 +1,21 @@ | |||
| uniform sampler2D colorTexture; | |||
| varying vec2 v_textureCoordinates; | |||
| float hash(float x){ | |||
| return fract(sin(x*23.3)*13.13); | |||
| } | |||
| void main(){ | |||
| float time = czm_frameNumber / 60.0; | |||
| vec2 resolution = czm_viewport.zw; | |||
| vec2 uv=(gl_FragCoord.xy*2.-resolution.xy)/min(resolution.x,resolution.y); | |||
| vec3 c=vec3(.6,.7,.8); | |||
| float a=-.4; | |||
| float si=sin(a),co=cos(a); | |||
| uv*=mat2(co,-si,si,co); | |||
| uv*=length(uv+vec2(0,4.9))*.3+1.; | |||
| float v=1.-sin(hash(floor(uv.x*100.))*2.); | |||
| float b=clamp(abs(sin(20.*time*v+uv.y*(5./(2.+v))))-.95,0.,1.)*20.; | |||
| c*=v*b; | |||
| gl_FragColor = mix(texture2D(colorTexture, v_textureCoordinates), vec4(c,1), 0.5); | |||
| } | |||
| @@ -0,0 +1,37 @@ | |||
| uniform sampler2D colorTexture; | |||
| varying vec2 v_textureCoordinates; | |||
| float snow(vec2 uv,float scale){ | |||
| float time = czm_frameNumber / 60.0; | |||
| float w=smoothstep(1.,0.,-uv.y*(scale/10.)); | |||
| if(w<.1)return 0.; | |||
| uv+=time/scale; | |||
| uv.y+=time*2./scale; | |||
| uv.x+=sin(uv.y+time*.5)/scale; | |||
| uv*=scale; | |||
| vec2 s=floor(uv),f=fract(uv),p; | |||
| float k=3.,d; | |||
| p=.5+.35*sin(11.*fract(sin((s+p+scale)*mat2(7,3,6,5))*5.))-f; | |||
| d=length(p); | |||
| k=min(d,k); | |||
| k=smoothstep(0.,k,sin(f.x+f.y)*0.01); | |||
| return k*w; | |||
| } | |||
| void main(){ | |||
| vec2 resolution = czm_viewport.zw; | |||
| vec2 uv=(gl_FragCoord.xy*2.-resolution.xy)/min(resolution.x,resolution.y); | |||
| vec3 finalColor=vec3(0); | |||
| float c = 0.0; | |||
| c+=snow(uv,30.)*.0; | |||
| c+=snow(uv,20.)*.0; | |||
| c+=snow(uv,15.)*.0; | |||
| c+=snow(uv,10.); | |||
| c+=snow(uv,8.); | |||
| c+=snow(uv,6.); | |||
| c+=snow(uv,5.); | |||
| finalColor=(vec3(c)); | |||
| gl_FragColor = mix(texture2D(colorTexture, v_textureCoordinates), vec4(finalColor,1), 0.3); | |||
| } | |||