/**
 *
 * @param {*} Vec3  保存单前摄像机位置状态
 */
export function saveState() {
  //  保存当前摄像机位置
  if (this.viewSate && this.viewSate.isSave) return;
  this.viewSate = {
    position: this.camera.position.clone(),
    isSave: true,
  };
}
/**
 * 恢复摄像机状态
 */
export function resetState() {
  if (this.viewSate && this.viewSate.isSave) {
    this.viewSate.isSave = false;
    //恢复原始的镜头指向
    this.camera.lookAt(0, 0, 0);
    this.orbitControls.target.set(0, 0, 0);
    //创建动画
    this.viewSateResetAnimation = new this.TWEEN.Tween(this.camera.position);
    this.viewSateResetAnimation.to(this.viewSate.position, 800);
    this.viewSateResetAnimation.start();
    //清空boxHelper
    this.scene.remove(this.scene.getObjectByName("boxHelper"));
  }
}
