|
|
@@ -75,7 +75,22 @@ export const play = (handlerState, flag?) => {
|
|
|
|
|
|
// 切换风门类型
|
|
|
export const setModelType = (type) => {
|
|
|
+ // 重置动画
|
|
|
+ if (fhmType === 'fireDoor' && fireDoor) {
|
|
|
+ fireDoor.resetAnimate();
|
|
|
+ }
|
|
|
+ if (fhmType === 'fireDoorF' && fireDoorF) {
|
|
|
+ fireDoorF.resetAnimate();
|
|
|
+ }
|
|
|
+ if (fhmType === 'fireDoorSsl' && fireDoorSsl) {
|
|
|
+ fireDoorSsl.resetAnimate();
|
|
|
+ }
|
|
|
+ if (fhmType === 'fireDoorRed' && fireDoorRed) {
|
|
|
+ fireDoorRed.resetAnimate();
|
|
|
+ }
|
|
|
+
|
|
|
fhmType = type;
|
|
|
+
|
|
|
const fhmConfigurations = {
|
|
|
fireDoor: {
|
|
|
render: fireDoor ? () => fireDoor.render() : null,
|
|
|
@@ -98,95 +113,29 @@ export const setModelType = (type) => {
|
|
|
fireDoorRed: {
|
|
|
render: fireDoorRed ? () => fireDoorRed.render() : null,
|
|
|
group: fireDoorRed ? fireDoorRed.group : null,
|
|
|
- newP: { x: 66.257, y: 57.539, z: 94.313 },
|
|
|
- newT: { x: -2.28, y: -0.91, z: -5.68 },
|
|
|
+ newP: { x: 66.14, y: 52.98, z: 112.23 },
|
|
|
+ newT: { x: 6.049, y: 7.907, z: -25.566 },
|
|
|
},
|
|
|
};
|
|
|
+
|
|
|
+ if (type == 'fireDoor' || type == 'fireDoorF') {
|
|
|
+ model.orbitControls.maxPolarAngle = Math.PI / 2;
|
|
|
+ model.orbitControls.minPolarAngle = Math.PI / 3;
|
|
|
+ model.orbitControls.minDistance = 600;
|
|
|
+ model.orbitControls.maxDistance = 900;
|
|
|
+ model.orbitControls.update();
|
|
|
+ } else if (type == 'fireDoorRed' || type == 'fireDoorSsl') {
|
|
|
+ model.orbitControls.maxPolarAngle = Math.PI;
|
|
|
+ model.orbitControls.minPolarAngle = 0;
|
|
|
+ model.orbitControls.enableRotate = true;
|
|
|
+ model.orbitControls.minDistance = 0;
|
|
|
+ model.orbitControls.maxDistance = Infinity;
|
|
|
+ model.orbitControls.update();
|
|
|
+ }
|
|
|
+
|
|
|
const config = fhmConfigurations[fhmType];
|
|
|
const oldCameraPosition = { x: -1000, y: 100, z: 500 };
|
|
|
return new Promise((resolve) => {
|
|
|
- // 暂停风门1动画
|
|
|
- // if (fhmType === 'fireDoor' && fireDoor && fireDoor.group) {
|
|
|
- // if (fireDoor.clipActionArr.door) {
|
|
|
- // fireDoor.clipActionArr.door.reset();
|
|
|
- // fireDoor.clipActionArr.door.time = 0.5;
|
|
|
- // fireDoor.clipActionArr.door.stop();
|
|
|
- // }
|
|
|
-
|
|
|
- // if (fireDoor.damperOpenMesh) fireDoor.damperOpenMesh.visible = false;
|
|
|
- // if (fireDoor.damperClosedMesh) fireDoor.damperClosedMesh.visible = true;
|
|
|
- // model.scene.remove(group);
|
|
|
- // model.startAnimation = fireDoor.render.bind(fireDoor);
|
|
|
- // group = fireDoor.group;
|
|
|
- // group.rotation.y = 0;
|
|
|
- // const oldCameraPosition = { x: -1000, y: 100, z: 500 };
|
|
|
- // setTimeout(async () => {
|
|
|
- // resolve(null);
|
|
|
- // model.scene.add(fireDoor.group);
|
|
|
- // await animateCamera(
|
|
|
- // oldCameraPosition,
|
|
|
- // { x: 0, y: 0, z: 0 },
|
|
|
- // { x: -654.2006991449887, y: 103.16181473511944, z: -30.348656073478562 },
|
|
|
- // { x: -7.380506513422206, y: 56.36967052459397, z: -29.230675020846963 },
|
|
|
- // model,
|
|
|
- // 0.8
|
|
|
- // );
|
|
|
- // }, 300);
|
|
|
- // } else if (fhmType === 'fireDoorF' && fireDoorF && fireDoorF.group) {
|
|
|
- // if (fireDoorF.clipActionArr.door) {
|
|
|
- // fireDoorF.clipActionArr.door.reset();
|
|
|
- // fireDoorF.clipActionArr.door.time = 0;
|
|
|
- // fireDoorF.clipActionArr.door.stop();
|
|
|
- // }
|
|
|
- // model.scene.remove(group);
|
|
|
- // model.startAnimation = fireDoorF.render.bind(fireDoorF);
|
|
|
- // group = fireDoorF.group;
|
|
|
- // group.rotation.y = 0;
|
|
|
- // const oldCameraPosition = { x: -1000, y: 100, z: 500 };
|
|
|
- // setTimeout(async () => {
|
|
|
- // resolve(null);
|
|
|
- // model.scene.add(fireDoorF.group);
|
|
|
- // await animateCamera(
|
|
|
- // oldCameraPosition,
|
|
|
- // { x: 0, y: 0, z: 0 },
|
|
|
- // { x: -655.0169729333649, y: 47.24181078408825, z: -9.781926649842067 },
|
|
|
- // { x: -7.380506513422206, y: 47.24181078408821, z: -37.9244016972381 },
|
|
|
- // model,
|
|
|
- // 0.8
|
|
|
- // );
|
|
|
- // }, 300);
|
|
|
- // } else if (fhmType === 'fireDoorSsl' && fireDoorSsl && fireDoorSsl.group) {
|
|
|
- // // if (fireDoorSsl.clipActionArr.door) {
|
|
|
- // // fireDoorSsl.clipActionArr.door.reset();
|
|
|
- // // fireDoorSsl.clipActionArr.door.time = 0;
|
|
|
- // // fireDoorSsl.clipActionArr.door.stop();
|
|
|
- // // }
|
|
|
- // // model.scene.remove(group);
|
|
|
- // // model.startAnimation = fireDoorSsl.render.bind(fireDoorSsl);
|
|
|
- // group = fireDoorSsl.group;
|
|
|
- // group.rotation.y = 0;
|
|
|
- // const oldCameraPosition = { x: -1000, y: 100, z: 500 };
|
|
|
- // setTimeout(async () => {
|
|
|
- // resolve(null);
|
|
|
- // model.scene.add(fireDoorSsl.group);
|
|
|
- // await animateCamera(
|
|
|
- // oldCameraPosition,
|
|
|
- // { x: 0, y: 0, z: 0 },
|
|
|
- // {
|
|
|
- // x: 342.74781900192056,
|
|
|
- // y: 183.50210411099545,
|
|
|
- // z: 451.0806333923029,
|
|
|
- // },
|
|
|
- // {
|
|
|
- // x: 72.33938301176254,
|
|
|
- // y: -35.03891296652319,
|
|
|
- // z: -37.91742549963208,
|
|
|
- // },
|
|
|
- // model,
|
|
|
- // 0.8
|
|
|
- // );
|
|
|
- // }, 300);
|
|
|
- // }
|
|
|
if (config && config.group) {
|
|
|
model.startAnimation = config.render;
|
|
|
group = config.group;
|
|
|
@@ -214,14 +163,6 @@ export const initCameraCanvas = async (playerVal1) => {
|
|
|
return await fireDoorRed.initCamera.call(fireDoorRed, playerVal1);
|
|
|
}
|
|
|
};
|
|
|
-const setControls = () => {
|
|
|
- if (model && model.orbitControls) {
|
|
|
- model.orbitControls.maxPolarAngle = Math.PI / 2;
|
|
|
- model.orbitControls.minPolarAngle = Math.PI / 3;
|
|
|
- model.orbitControls.minDistance = 600;
|
|
|
- model.orbitControls.maxDistance = 900;
|
|
|
- }
|
|
|
-};
|
|
|
|
|
|
const loadModel = (code): Promise<any> => {
|
|
|
if (code === 'fireDoor') return import('./fireDoor.threejs.fire').then((r) => r.default);
|
|
|
@@ -271,7 +212,6 @@ export const mountedThree = () => {
|
|
|
fireDoorRed.mountedThree();
|
|
|
}
|
|
|
resolve(null);
|
|
|
- setControls();
|
|
|
model.animate();
|
|
|
startAnimation();
|
|
|
});
|