线贴图 速度bug修改

This commit is contained in:
2025-07-15 18:23:31 +08:00
parent 2fd421e637
commit a82a8abf65
4 changed files with 188 additions and 46 deletions

View File

@ -10,12 +10,14 @@ function FlowDashedLine() {
this._uType = undefined;
this._space = undefined;
this._dashSize = undefined;
this._scale = undefined;
this.color = new Cesium.Color.fromCssColorString(options.color || "rgba(255,255,255,1)");
this.speed = options.speed != undefined ? options.speed : 1.0;//速度
this.space = options.space || 0.0;//速度
this.dashSize = options.dashSize || 0.03;//速度
this.uType = options.uType === undefined ? 1 : options.uType;//类型0普通流动线 1虚化虚线
this.lineBackAlpha = options.lineBackAlpha || 0.05;
this.scale = options.scale || 1.0;
}
get isConstant() {
@ -65,6 +67,12 @@ function FlowDashedLine() {
1,
result.uType
);
result.scale = Cesium.Property.getValueOrDefault(
this._scale,
time,
1.0,
result.scale
);
result.lineBackAlpha = this.lineBackAlpha;
result.frameNumber = Cesium.getTimestamp();
return result;
@ -77,7 +85,8 @@ function FlowDashedLine() {
Cesium.Property.equals(this._color, other._color) &&
Cesium.Property.equals(this._speed, other.speed) &&
Cesium.Property.equals(this._uType, other.uType) &&
Cesium.Property.equals(this.lineBackAlpha, other.lineBackAlpha))
Cesium.Property.equals(this._lineBackAlpha, other.lineBackAlpha) &&
Cesium.Property.equals(this._scale, other.scale))
);
}
}
@ -89,6 +98,7 @@ function FlowDashedLine() {
dashSize: Cesium.createPropertyDescriptor("dashSize"),
uType: Cesium.createPropertyDescriptor("uType"),
transparency: Cesium.createPropertyDescriptor("lineBackAlpha"),
scale: Cesium.createPropertyDescriptor("scale"),
});
Cesium.FlowDashedLineFlowMaterialProperty = FlowDashedLineFlowMaterialProperty;
@ -108,7 +118,7 @@ function FlowDashedLine() {
float dashSize = 0.1;
float gapSize = space;
// speed现在表示完成一次完整动画循环的秒数
float progress = speed==0.0 ? 0.0 : fract(frameNumber / 1000.0 / speed);
float progress = speed==0.0 ? 0.0 : fract(frameNumber / 1000.0 / speed * scale);
float pattern = fract(st.x / dashSize * (1.0 + gapSize) + progress / dashSize * (1.0 + gapSize));
float dash1 = step(0.0, pattern) - step(1.0/(1.0 + gapSize), pattern);
float dash2 = smoothstep(0.0, 0.2, pattern) -
@ -131,6 +141,7 @@ function FlowDashedLine() {
color: new Cesium.Color(1.0, 1.0, 1.0, 1.0),
speed: 1,
space: 0.0,
scale: 1.0,
dashSize: 0.03,
frameNumber: Cesium.getTimestamp(),
uType: 1,