| | |
| | | this._opacity = undefined |
| | | this._alphaPower = undefined |
| | | this._speed = undefined |
| | | this._xRepeatCount = undefined |
| | | |
| | | this.color = options.color || Cesium.Color.fromBytes(0, 255, 255, 255) |
| | | this.glowPower = .25 |
| | |
| | | this.opacity = options.opacity || 0.5 |
| | | this.alphaPower = options.alphaPower || 1.5 |
| | | this.speed = options.speed || 5 |
| | | this.xRepeatCount = options.xRepeatCount || 1 |
| | | |
| | | |
| | | } |
| | | |
| | | get isConstant () { |
| | |
| | | color: new Cesium.Color(1.0, 1.0, 0.0, 0.7), |
| | | bgColor: new Cesium.Color(0.0, 1.0, 0.0, 0.0), |
| | | speed: 5, |
| | | globalAlpha: 1.0 |
| | | globalAlpha: 1.0, |
| | | xRepeatCount: 1.0 |
| | | }, |
| | | source: ` |
| | | uniform vec4 bgColor; |
| | | uniform vec4 color; |
| | | uniform float speed; |
| | | uniform float globalAlpha; |
| | | uniform float xRepeatCount; // 新增的 uniform 在着色器中 |
| | | |
| | | czm_material czm_getMaterial(czm_materialInput materialInput) { |
| | | czm_material czm_getMaterial(czm_materialInput materialInput) { |
| | | czm_material material = czm_getDefaultMaterial(materialInput); |
| | | vec2 st = materialInput.st; |
| | | float time = fract(czm_frameNumber * speed / 1000.0); |
| | |
| | | colorMars3D = vec3(1.0); |
| | | } |
| | | |
| | | material.alpha = color.a * 1.5 * smoothstep(0.0, 1.0, fract(st.s - time)); |
| | | material.alpha = color.a * 1.5 * smoothstep(0.0, 1.0, fract(st.s * xRepeatCount - time)); // 使用 xRepeatCount 来调整纹理重复 |
| | | material.diffuse = max(colorMars3D.rgb * material.alpha, colorMars3D.rgb); |
| | | |
| | | if (material.alpha < bgColor.a) { |
| | |
| | | result.color = Cesium.Property.getValueOrUndefined(this._color, time) |
| | | result.globalAlpha = Cesium.Property.getValueOrUndefined(this._opacity, time) |
| | | result.speed = Cesium.Property.getValueOrUndefined(this._speed, time) |
| | | result.xRepeatCount = Cesium.Property.getValueOrUndefined(this._xRepeatCount, time) |
| | | |
| | | return result |
| | | } |
| | | |
| | |
| | | (other instanceof LineTrailMaterial && |
| | | Cesium.Property.equals(this._color, other._color) && |
| | | Cesium.Property.equals(this._opacity, other._opacity) && |
| | | Cesium.Property.equals(this._speed, other._speed)) |
| | | Cesium.Property.equals(this._speed, other._speed) && |
| | | Cesium.Property.equals(this._xRepeatCount, other._xRepeatCount)) |
| | | ) |
| | | } |
| | | } |
| | |
| | | color: Cesium.createPropertyDescriptor('color'), |
| | | opacity: Cesium.createPropertyDescriptor('opacity'), |
| | | speed: Cesium.createPropertyDescriptor('speed'), |
| | | xRepeatCount: Cesium.createPropertyDescriptor('xRepeatCount'), |
| | | }) |
| | | |
| | | |