export function addDev(devId) {
  if (!this.checkDevId) {
    alert("请选择设备");
    return;
  }
  const devModel = this.devMap.get(devId).clone();
  handleLoadedDevice.call(this, devModel);
}

function handleLoadedDevice(model) {
  if (!this.targetPoint) return;
  //获取定位位置
  const wp = this.targetPoint.getWorldPosition(new this.THREE.Vector3());
  model.position.copy(wp);
  this.targetPoint.visible = false;
  model.scale = 0.1

  this.scene.add(model);
  if (model.name === "camera") {
    model.translateX(-5);
    model.translateZ(4);
    model.translateY(-0.5);
  }

  // 添加的信息请求或初始化的信息
  this.targetPoint.info = {
    name: "摄像头",
    state: "未开启",
    devId: model.id,
  };
  this.targetPoint.hasDevice = true;
}
