线贴图 速度相同 切换有问题

This commit is contained in:
2025-07-14 18:05:19 +08:00
parent c03cd63532
commit f24a95ab32
12 changed files with 38 additions and 16 deletions

View File

@ -585,8 +585,6 @@ class Tools {
getMaterial(color = '#2ab0c2', type = 0, entity = null, newParam = {}) {
let material = ''
switch (Number(type)) {
case 1: //虚线
@ -645,8 +643,18 @@ class Tools {
space: newParam.space,
speed: newParam.speed
}
let arr = [7, 8, 9, 10, 11]
let arr = {
'7': 10,
'8': 3,
'9': 4,
'10': 4,
'11': 4,
'12': 2
}
param.speed = newParam.rotate ? param.speed : 0 - param.speed
console.log(entity.polyline.oriWidth, arr[type + ''], type, 'oriWidth')
entity.polyline.width = entity.polyline.oriWidth + arr[type + '']
this.getFlowTexture(this, param, entity)
break
@ -683,6 +691,8 @@ class Tools {
// let repeat = getRepeat()
// }, false)
entity.polyline.material.oriRepeat = undefined
entity.polyline.material.oriSpeed = undefined
entity.polyline.material = new Cesium.LineTextureMaterialProperty(
{
color: options.color,
@ -696,8 +706,8 @@ class Tools {
var positions = positionProperty.getValue(that.sdk.viewer.clock.currentTime);
if (!Cesium.defined(positions)) {
// return new Cesium.Cartesian2(1.0, 1.0);
return 1.0;
return new Cesium.Cartesian2(1.0, 1.0);
// return 1.0;
}
var distance = 0;
@ -721,14 +731,21 @@ class Tools {
var groundResolution = that.sdk.viewer.scene.camera.getPixelSize(boundingSphere, drawingBufferWidth, drawingBufferHeight)
// repeatX *= groundResolution / cameraHeight / ((myImg.width / myImg.height * 5) + 1);
repeatX *= groundResolution / cameraHeight / (options.space * (canvasEle.width / canvasEle.height * 5) + 1);
let speed
if (entity.polyline.material.oriRepeat) {
speed = repeatX / entity.polyline.material.oriRepeat
} else {
entity.polyline.material.oriRepeat = repeatX
}
// if (repeatX < 3) {
// repeatX = 3
// }
// return new Cesium.Cartesian2(repeatX, 1.0);
return repeatX;
return new Cesium.Cartesian2(repeatX, speed || 1.0);
// return repeatX;
})
}
)
entity.polyline.material.oriSpeed = options.speed
}
}