中化加油站项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

42 lines
954 B

import { ArcRotateCamera, Vector3 } from "@babylonjs/core";
import { Type } from "class-transformer";
/**
* 自由旋转相机的数据
*/
export class ArcRotateCameraData {
@Type(() => Vector3)
target: Vector3;
radius: number;
alpha: number;
beta: number;
constructor() {
this.target = new Vector3();
}
/**
* 将数据设置到相机上
* @param camera
*/
setDataToCamera(camera: ArcRotateCamera) {
camera._scene.stopAnimation(camera);
camera.target = this.target.clone();
camera.radius = this.radius;
camera.alpha = this.alpha;
camera.beta = this.beta;
}
/**
* 将摄像机的数据记录下来
* @param camera
*/
getDataFromCamera(camera: ArcRotateCamera) {
this.target = camera.target.clone();
this.radius = camera.radius;
this.alpha = camera.alpha;
this.beta = camera.beta;
}
}