From efb3b5e84ed4493f82f30ed3c3dcdff0fd5a8083 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Fri, 16 Jan 2026 10:55:55 +0800
Subject: [PATCH] feat:任务工单后台地图
---
applications/task-work-order/src/utils/cesium/Material/index.js | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/applications/task-work-order/src/utils/cesium/Material/index.js b/applications/task-work-order/src/utils/cesium/Material/index.js
index f96f7a8..d5aff41 100644
--- a/applications/task-work-order/src/utils/cesium/Material/index.js
+++ b/applications/task-work-order/src/utils/cesium/Material/index.js
@@ -54,6 +54,7 @@
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
@@ -64,6 +65,9 @@
this.opacity = options.opacity || 0.5
this.alphaPower = options.alphaPower || 1.5
this.speed = options.speed || 5
+ this.xRepeatCount = options.xRepeatCount || 1
+
+
}
get isConstant () {
@@ -132,15 +136,17 @@
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);
@@ -150,7 +156,7 @@
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) {
@@ -182,6 +188,8 @@
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
}
@@ -191,7 +199,8 @@
(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))
)
}
}
@@ -200,6 +209,7 @@
color: Cesium.createPropertyDescriptor('color'),
opacity: Cesium.createPropertyDescriptor('opacity'),
speed: Cesium.createPropertyDescriptor('speed'),
+ xRepeatCount: Cesium.createPropertyDescriptor('xRepeatCount'),
})
--
Gitblit v1.9.3