修改间距大值 缓冲区bug
This commit is contained in:
@ -12,7 +12,7 @@ function FlowDashedLine() {
|
||||
this._dashSize = 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.01;//速度
|
||||
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;
|
||||
@ -105,15 +105,16 @@ function FlowDashedLine() {
|
||||
czm_material material = czm_getDefaultMaterial(materialInput);
|
||||
vec2 st = materialInput.st;
|
||||
|
||||
// 计算流动虚线
|
||||
float dashSize = 0.03;
|
||||
// float gapSize = 0.01;
|
||||
// float dashSize = dashSize;
|
||||
float dashSize = 0.1;
|
||||
float gapSize = space;
|
||||
float progress = fract(speed * czm_frameNumber * 0.01); // 时间控制流动
|
||||
float pattern = fract(st.x / (dashSize + gapSize) + progress);
|
||||
float dash1 = step(0.1, pattern) - step(0.9, pattern);
|
||||
float dash2 = smoothstep(0.0, 0.4, pattern) - smoothstep(0.6, 1.0, pattern);
|
||||
// speed现在表示完成一次完整动画循环的秒数
|
||||
float progress = speed==0.0 ? 0.0 : fract(frameNumber / 1000.0 / speed);
|
||||
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) -
|
||||
smoothstep(1.0/(1.0 + gapSize),
|
||||
1.0/(1.0 + gapSize) + 0.2,
|
||||
pattern);
|
||||
float dash = (float(uType) != 1.0)?dash1:dash2;
|
||||
material.alpha = dash;
|
||||
material.diffuse = color.rgb;
|
||||
@ -129,8 +130,9 @@ function FlowDashedLine() {
|
||||
uniforms: {
|
||||
color: new Cesium.Color(1.0, 1.0, 1.0, 1.0),
|
||||
speed: 1,
|
||||
space: 0.01,
|
||||
space: 0.0,
|
||||
dashSize: 0.03,
|
||||
frameNumber: Cesium.getTimestamp(),
|
||||
uType: 1,
|
||||
lineBackAlpha: 0.05,
|
||||
},
|
||||
|
Reference in New Issue
Block a user