|
@@ -2,6 +2,7 @@ import * as THREE from 'three';
|
|
import UseThree from '../../../../utils/threejs/useThree';
|
|
import UseThree from '../../../../utils/threejs/useThree';
|
|
import Fm1 from './gate.threejs.yy';
|
|
import Fm1 from './gate.threejs.yy';
|
|
import Fm3 from './gate.threejs.qd';
|
|
import Fm3 from './gate.threejs.qd';
|
|
|
|
+import FmXR from './gate.threejs.xr';
|
|
import Fm2 from './gate.threejs.three';
|
|
import Fm2 from './gate.threejs.three';
|
|
import { animateCamera } from '/@/utils/threejs/util';
|
|
import { animateCamera } from '/@/utils/threejs/util';
|
|
import useEvent from '../../../../utils/threejs/useEvent';
|
|
import useEvent from '../../../../utils/threejs/useEvent';
|
|
@@ -11,6 +12,7 @@ let model,
|
|
fm1: Fm1,
|
|
fm1: Fm1,
|
|
fm2: Fm2,
|
|
fm2: Fm2,
|
|
fm3: Fm3,
|
|
fm3: Fm3,
|
|
|
|
+ fmXr: FmXR,
|
|
group: THREE.Object3D,
|
|
group: THREE.Object3D,
|
|
fmType = '';
|
|
fmType = '';
|
|
|
|
|
|
@@ -29,6 +31,8 @@ const startAnimation = () => {
|
|
fm2.mouseUpModel.call(fm2);
|
|
fm2.mouseUpModel.call(fm2);
|
|
} else if (fmType === 'fm3') {
|
|
} else if (fmType === 'fm3') {
|
|
fm3.mouseUpModel.call(fm3);
|
|
fm3.mouseUpModel.call(fm3);
|
|
|
|
+ } else if (fmType === 'fmXr') {
|
|
|
|
+ fmXr.mouseUpModel.call(fmXr);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
};
|
|
};
|
|
@@ -43,6 +47,8 @@ const mouseEvent = (event) => {
|
|
fm2.mousedownModel.call(fm2, intersects);
|
|
fm2.mousedownModel.call(fm2, intersects);
|
|
} else if (fmType === 'fm3' && fm3) {
|
|
} else if (fmType === 'fm3' && fm3) {
|
|
fm3.mousedownModel.call(fm3, intersects);
|
|
fm3.mousedownModel.call(fm3, intersects);
|
|
|
|
+ } else if (fmType === 'fmXr' && fmXr) {
|
|
|
|
+ fmXr.mousedownModel.call(fmXr, intersects);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
// console.log('摄像头控制信息', model.orbitControls, model.camera);
|
|
// console.log('摄像头控制信息', model.orbitControls, model.camera);
|
|
@@ -56,6 +62,8 @@ export const addMonitorText = (selectData) => {
|
|
return fm2.addMonitorText.call(fm2, selectData);
|
|
return fm2.addMonitorText.call(fm2, selectData);
|
|
} else if (fmType === 'fm3' && fm3) {
|
|
} else if (fmType === 'fm3' && fm3) {
|
|
return fm3.addMonitorText.call(fm3, selectData);
|
|
return fm3.addMonitorText.call(fm3, selectData);
|
|
|
|
+ } else if (fmType === 'fmXr' && fmXr) {
|
|
|
|
+ return fmXr.addMonitorText.call(fmXr, selectData);
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
@@ -64,6 +72,8 @@ export const deviceDetailCard = () => {
|
|
return fm1.deviceDetailCard.call(fm1);
|
|
return fm1.deviceDetailCard.call(fm1);
|
|
} else if (fmType === 'fm3') {
|
|
} else if (fmType === 'fm3') {
|
|
return fm3.deviceDetailCard.call(fm3);
|
|
return fm3.deviceDetailCard.call(fm3);
|
|
|
|
+ } else if (fmType === 'fmXr') {
|
|
|
|
+ return fmXr.deviceDetailCard.call(fmXr);
|
|
} else {
|
|
} else {
|
|
// return fm2.addMonitorText.call(fm2);
|
|
// return fm2.addMonitorText.call(fm2);
|
|
}
|
|
}
|
|
@@ -76,6 +86,8 @@ export const play = (handlerState, flag?) => {
|
|
return fm2.play.call(fm2, handlerState, flag);
|
|
return fm2.play.call(fm2, handlerState, flag);
|
|
} else if (fmType === 'fm3' && fm3) {
|
|
} else if (fmType === 'fm3' && fm3) {
|
|
return fm3.play.call(fm3, handlerState, flag);
|
|
return fm3.play.call(fm3, handlerState, flag);
|
|
|
|
+ } else if (fmType === 'fmXr' && fmXr) {
|
|
|
|
+ return fmXr.play.call(fmXr, handlerState, flag);
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
@@ -85,12 +97,14 @@ export const setModelType = (type) => {
|
|
return new Promise((resolve) => {
|
|
return new Promise((resolve) => {
|
|
// 暂停风门1动画
|
|
// 暂停风门1动画
|
|
if (fmType === 'fm1' && fm1 && fm1.group) {
|
|
if (fmType === 'fm1' && fm1 && fm1.group) {
|
|
- fm1.clipActionArr.frontDoor.reset();
|
|
|
|
- fm1.clipActionArr.frontDoor.time = 0.5;
|
|
|
|
- fm1.clipActionArr.backDoor.reset();
|
|
|
|
- fm1.clipActionArr.backDoor.time = 0.5;
|
|
|
|
- fm1.clipActionArr.frontDoor.stop();
|
|
|
|
- fm1.clipActionArr.backDoor.stop();
|
|
|
|
|
|
+ if (fm1.clipActionArr.frontDoor && fm1.clipActionArr.backDoor) {
|
|
|
|
+ fm1.clipActionArr.frontDoor.reset();
|
|
|
|
+ fm1.clipActionArr.frontDoor.time = 0.5;
|
|
|
|
+ fm1.clipActionArr.backDoor.reset();
|
|
|
|
+ fm1.clipActionArr.backDoor.time = 0.5;
|
|
|
|
+ fm1.clipActionArr.frontDoor.stop();
|
|
|
|
+ fm1.clipActionArr.backDoor.stop();
|
|
|
|
+ }
|
|
|
|
|
|
if (fm1.frontDamperOpenMesh) fm1.frontDamperOpenMesh.visible = false;
|
|
if (fm1.frontDamperOpenMesh) fm1.frontDamperOpenMesh.visible = false;
|
|
if (fm1.frontDamperClosedMesh) fm1.frontDamperClosedMesh.visible = true;
|
|
if (fm1.frontDamperClosedMesh) fm1.frontDamperClosedMesh.visible = true;
|
|
@@ -106,6 +120,9 @@ export const setModelType = (type) => {
|
|
if (model.scene.getObjectByName('fm3')) {
|
|
if (model.scene.getObjectByName('fm3')) {
|
|
model.scene.remove(fm3.group);
|
|
model.scene.remove(fm3.group);
|
|
}
|
|
}
|
|
|
|
+ if (model.scene.getObjectByName('fmXr')) {
|
|
|
|
+ model.scene.remove(fmXr.group);
|
|
|
|
+ }
|
|
const oldCameraPosition = { x: -1000, y: 100, z: 500 };
|
|
const oldCameraPosition = { x: -1000, y: 100, z: 500 };
|
|
setTimeout(async () => {
|
|
setTimeout(async () => {
|
|
resolve(null);
|
|
resolve(null);
|
|
@@ -120,15 +137,17 @@ export const setModelType = (type) => {
|
|
);
|
|
);
|
|
}, 300);
|
|
}, 300);
|
|
} else if (fmType === 'fm2' && fm2 && fm2.group) {
|
|
} else if (fmType === 'fm2' && fm2 && fm2.group) {
|
|
- fm2.clipActionArr.frontDoor.reset();
|
|
|
|
- fm2.clipActionArr.frontDoor.time = 0.5;
|
|
|
|
- fm2.clipActionArr.backDoor.reset();
|
|
|
|
- fm2.clipActionArr.backDoor.time = 0.5;
|
|
|
|
- fm2.clipActionArr.centerDoor.reset();
|
|
|
|
- fm2.clipActionArr.centerDoor.time = 0.5;
|
|
|
|
- fm2.clipActionArr.frontDoor.stop();
|
|
|
|
- fm2.clipActionArr.backDoor.stop();
|
|
|
|
- fm2.clipActionArr.centerDoor.stop();
|
|
|
|
|
|
+ if (fm2.clipActionArr.frontDoor && fm2.clipActionArr.backDoor) {
|
|
|
|
+ fm2.clipActionArr.frontDoor.reset();
|
|
|
|
+ fm2.clipActionArr.frontDoor.time = 0.5;
|
|
|
|
+ fm2.clipActionArr.backDoor.reset();
|
|
|
|
+ fm2.clipActionArr.backDoor.time = 0.5;
|
|
|
|
+ fm2.clipActionArr.centerDoor.reset();
|
|
|
|
+ fm2.clipActionArr.centerDoor.time = 0.5;
|
|
|
|
+ fm2.clipActionArr.frontDoor.stop();
|
|
|
|
+ fm2.clipActionArr.backDoor.stop();
|
|
|
|
+ fm2.clipActionArr.centerDoor.stop();
|
|
|
|
+ }
|
|
|
|
|
|
// 显示单道风窗
|
|
// 显示单道风窗
|
|
model.startAnimation = fm2.render.bind(fm2);
|
|
model.startAnimation = fm2.render.bind(fm2);
|
|
@@ -139,6 +158,9 @@ export const setModelType = (type) => {
|
|
if (model.scene.getObjectByName('fm3')) {
|
|
if (model.scene.getObjectByName('fm3')) {
|
|
model.scene.remove(fm3.group);
|
|
model.scene.remove(fm3.group);
|
|
}
|
|
}
|
|
|
|
+ if (model.scene.getObjectByName('fmXr')) {
|
|
|
|
+ model.scene.remove(fmXr.group);
|
|
|
|
+ }
|
|
const oldCameraPosition = { x: -761, y: 569, z: 871 };
|
|
const oldCameraPosition = { x: -761, y: 569, z: 871 };
|
|
setTimeout(async () => {
|
|
setTimeout(async () => {
|
|
resolve(null);
|
|
resolve(null);
|
|
@@ -154,12 +176,14 @@ export const setModelType = (type) => {
|
|
);
|
|
);
|
|
}, 300);
|
|
}, 300);
|
|
} else if (fmType === 'fm3' && fm3 && fm3.group) {
|
|
} else if (fmType === 'fm3' && fm3 && fm3.group) {
|
|
- fm3.clipActionArr.frontDoor.reset();
|
|
|
|
- fm3.clipActionArr.frontDoor.time = 0.5;
|
|
|
|
- fm3.clipActionArr.backDoor.reset();
|
|
|
|
- fm3.clipActionArr.backDoor.time = 0.5;
|
|
|
|
- fm3.clipActionArr.frontDoor.stop();
|
|
|
|
- fm3.clipActionArr.backDoor.stop();
|
|
|
|
|
|
+ if (fm3.clipActionArr.frontDoor && fm3.clipActionArr.backDoor) {
|
|
|
|
+ fm3.clipActionArr.frontDoor.reset();
|
|
|
|
+ fm3.clipActionArr.frontDoor.time = 0.5;
|
|
|
|
+ fm3.clipActionArr.backDoor.reset();
|
|
|
|
+ fm3.clipActionArr.backDoor.time = 0.5;
|
|
|
|
+ fm3.clipActionArr.frontDoor.stop();
|
|
|
|
+ fm3.clipActionArr.backDoor.stop();
|
|
|
|
+ }
|
|
|
|
|
|
if (fm3.frontDamperOpenMesh) fm3.frontDamperOpenMesh.visible = false;
|
|
if (fm3.frontDamperOpenMesh) fm3.frontDamperOpenMesh.visible = false;
|
|
if (fm3.frontDamperClosedMesh) fm3.frontDamperClosedMesh.visible = true;
|
|
if (fm3.frontDamperClosedMesh) fm3.frontDamperClosedMesh.visible = true;
|
|
@@ -175,6 +199,9 @@ export const setModelType = (type) => {
|
|
if (model.scene.getObjectByName('fm1')) {
|
|
if (model.scene.getObjectByName('fm1')) {
|
|
model.scene.remove(fm1.group);
|
|
model.scene.remove(fm1.group);
|
|
}
|
|
}
|
|
|
|
+ if (model.scene.getObjectByName('fmXr')) {
|
|
|
|
+ model.scene.remove(fmXr.group);
|
|
|
|
+ }
|
|
const oldCameraPosition = { x: -1000, y: 100, z: 500 };
|
|
const oldCameraPosition = { x: -1000, y: 100, z: 500 };
|
|
setTimeout(async () => {
|
|
setTimeout(async () => {
|
|
resolve(null);
|
|
resolve(null);
|
|
@@ -188,6 +215,46 @@ export const setModelType = (type) => {
|
|
0.8
|
|
0.8
|
|
);
|
|
);
|
|
}, 300);
|
|
}, 300);
|
|
|
|
+ } else if (fmType === 'fmXr' && fmXr && fmXr.group) {
|
|
|
|
+ if (fmXr.clipActionArr.frontDoor && fmXr.clipActionArr.backDoor) {
|
|
|
|
+ fmXr.clipActionArr.frontDoor.reset();
|
|
|
|
+ fmXr.clipActionArr.frontDoor.time = 0.5;
|
|
|
|
+ fmXr.clipActionArr.backDoor.reset();
|
|
|
|
+ fmXr.clipActionArr.backDoor.time = 0.5;
|
|
|
|
+ fmXr.clipActionArr.frontDoor.stop();
|
|
|
|
+ fmXr.clipActionArr.backDoor.stop();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (fmXr.frontDamperOpenMesh) fmXr.frontDamperOpenMesh.visible = false;
|
|
|
|
+ if (fmXr.frontDamperClosedMesh) fmXr.frontDamperClosedMesh.visible = true;
|
|
|
|
+ if (fmXr.backDamperOpenMesh) fmXr.backDamperOpenMesh.visible = false;
|
|
|
|
+ if (fmXr.backDamperClosedMesh) fmXr.backDamperClosedMesh.visible = true;
|
|
|
|
+
|
|
|
|
+ model.startAnimation = fmXr.render.bind(fmXr);
|
|
|
|
+ group = fmXr.group;
|
|
|
|
+ group.rotation.y = 0;
|
|
|
|
+ if (model.scene.getObjectByName('fm2')) {
|
|
|
|
+ model.scene.remove(fm2.group);
|
|
|
|
+ }
|
|
|
|
+ if (model.scene.getObjectByName('fm1')) {
|
|
|
|
+ model.scene.remove(fm1.group);
|
|
|
|
+ }
|
|
|
|
+ if (model.scene.getObjectByName('fm3')) {
|
|
|
|
+ model.scene.remove(fm3.group);
|
|
|
|
+ }
|
|
|
|
+ const oldCameraPosition = { x: -1000, y: 100, z: 500 };
|
|
|
|
+ setTimeout(async () => {
|
|
|
|
+ resolve(null);
|
|
|
|
+ model.scene.add(fmXr.group);
|
|
|
|
+ await animateCamera(
|
|
|
|
+ oldCameraPosition,
|
|
|
|
+ { x: 0, y: 0, z: 0 },
|
|
|
|
+ { x: 50.99, y: 69.32, z: 93.61 },
|
|
|
|
+ { x: -10.04, y: -14.38, z: -31.4 },
|
|
|
|
+ model,
|
|
|
|
+ 0.8
|
|
|
|
+ );
|
|
|
|
+ }, 300);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
};
|
|
};
|
|
@@ -199,6 +266,8 @@ export const initCameraCanvas = async (playerVal1) => {
|
|
return fm2.initCamera.call(fm2, playerVal1);
|
|
return fm2.initCamera.call(fm2, playerVal1);
|
|
} else if (fmType === 'fm3' && fm3) {
|
|
} else if (fmType === 'fm3' && fm3) {
|
|
return fm3.initCamera.call(fm3, playerVal1);
|
|
return fm3.initCamera.call(fm3, playerVal1);
|
|
|
|
+ } else if (fmType === 'fmXr' && fmXr) {
|
|
|
|
+ return fmXr.initCamera.call(fmXr, playerVal1);
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
@@ -206,17 +275,19 @@ export const mountedThree = (playerDom) => {
|
|
return new Promise(async (resolve) => {
|
|
return new Promise(async (resolve) => {
|
|
model = new UseThree('#damper3D', '', '#deviceDetail');
|
|
model = new UseThree('#damper3D', '', '#deviceDetail');
|
|
model.setEnvMap('test1');
|
|
model.setEnvMap('test1');
|
|
|
|
+ resolve(null);
|
|
model.renderer.toneMappingExposure = 1.0;
|
|
model.renderer.toneMappingExposure = 1.0;
|
|
model.camera.position.set(100, 0, 1000);
|
|
model.camera.position.set(100, 0, 1000);
|
|
// 单道、 双道
|
|
// 单道、 双道
|
|
fm1 = new Fm1(model);
|
|
fm1 = new Fm1(model);
|
|
- await fm1.mountedThree(playerDom);
|
|
|
|
|
|
+ fm1.mountedThree(playerDom);
|
|
fm2 = new Fm2(model);
|
|
fm2 = new Fm2(model);
|
|
- await fm2.mountedThree(playerDom);
|
|
|
|
|
|
+ fm2.mountedThree(playerDom);
|
|
fm3 = new Fm3(model);
|
|
fm3 = new Fm3(model);
|
|
- await fm3.mountedThree(playerDom);
|
|
|
|
|
|
+ fm3.mountedThree(playerDom);
|
|
|
|
+ fmXr = new FmXR(model);
|
|
|
|
+ fmXr.mountedThree(playerDom);
|
|
model.animate();
|
|
model.animate();
|
|
- resolve(null);
|
|
|
|
startAnimation();
|
|
startAnimation();
|
|
});
|
|
});
|
|
};
|
|
};
|
|
@@ -227,9 +298,11 @@ export const destroy = () => {
|
|
if (fm1) fm1.destroy();
|
|
if (fm1) fm1.destroy();
|
|
if (fm2) fm2.destroy();
|
|
if (fm2) fm2.destroy();
|
|
if (fm3) fm3.destroy();
|
|
if (fm3) fm3.destroy();
|
|
|
|
+ if (fmXr) fmXr.destroy();
|
|
fm1 = null;
|
|
fm1 = null;
|
|
fm2 = null;
|
|
fm2 = null;
|
|
fm3 = null;
|
|
fm3 = null;
|
|
|
|
+ fmXr = null;
|
|
group = null;
|
|
group = null;
|
|
model.mixers = [];
|
|
model.mixers = [];
|
|
model.destroy();
|
|
model.destroy();
|