廖杰:风机状态颜色修复+修复选中模式多次发送请求

This commit is contained in:
Hcat
2024-03-27 16:10:37 +08:00
parent 3e2f453bde
commit ea111a186f
5 changed files with 207 additions and 66 deletions

View File

@@ -185,6 +185,21 @@ function handleFanEqu(
this.fanSpinArray = [];
}
const equMesh = this.equMap.get("equ_fan").clone();
// console.log(this.equMap.get("equ_fan"));
// console.log(this.equMap.get("equ_fan").material.clone());
// equMesh.material = this.equMap.get("equ_fan").material.clone();
// console.log(equMesh);
//深层次克隆
equMesh.children.map(function (item) {
// console.log(item);
if (item.isMesh) {
item.material = item.material.clone();
}
})
// equMesh.geometry = this.equMap.get("equ_fan").geometry.clone();
// console.log(equMesh);
const worldP = targetPoint.getWorldPosition(new this.THREE.Vector3());
equMesh.position.copy(worldP);
equMesh.translateY(-0.6);
@@ -197,10 +212,17 @@ function handleFanEqu(
id: equMesh.id, //模型在场景id
...equipmentInfo,
};
//我们把风机的附着点挂在原型上,这样应该可以进行处理
if (targetPoint.info.equipmentName.slice(0, 1) == '1') {
this.scene.Fan1targetPoint = targetPoint
} else {
this.scene.Fan2targetPoint = targetPoint
}
//这里感觉情况改变风机的颜色
changeFanColor(fanData, targetPoint, this.scene)
// 定义风机旋转
const fanLeaf = equMesh.getObjectByName("fan_leafs");
const fanSpin = new this.TWEEN.Tween({ rotation: 0 });
@@ -285,7 +307,7 @@ function deleteItem(array, item) {
return array
}
//这里是改变风机颜色的代码
// 这里是改变风机颜色的代码
function changeFanColor(fanData, targetPoint, scene) {
if (fanData !== undefined) {
//保证是预览模式才进行这里的操作(!=1