123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621 |
- import * as THREE from 'three';
- import UseThree from '../../../../utils/threejs/useThree';
- import Fm1 from './gate.threejs.yy';
- import Fm3 from './gate.threejs.qd';
- import FmXR from './gate.threejs.xr';
- import Fm2 from './gate.threejs.three';
- import FmTwoSs from './gate.threejs.two.ss';
- import FmThreeTl from './gate.threejs.three.tl';
- import FmDc from './gate.threejs.window';
- import FmDcHJG from './gate.threejs.window.hjg';
- import { animateCamera } from '/@/utils/threejs/util';
- import useEvent from '../../../../utils/threejs/useEvent';
- import { getDictItemsByCode } from '/@/utils/dict';
- import { useGlobSetting } from '/@/hooks/setting';
- // 模型对象、 文字对象
- let model,
- fm1, //液压风门
- fm2, //三道风门收缩
- fm3, //气动风门
- fmXr: FmXR, //行人风门
- fmTwoSs, //
- fmThreeTl, // 三道推拉
- fmWindowHjg, // 带风窗
- fmWindow, // 带风窗
- group: THREE.Object3D,
- fmType = '',
- windowType = 'singleWindow';
- const rotationParam = {
- frontLeftDeg0: 0, // 前门初始
- frontLeftDeg1: 0, // 前门目标
- backLeftDeg0: 0, // 后门初始
- backLeftDeg1: 0, // 后门目标
- frontRightDeg0: 0, // 前门初始
- frontRightDeg1: 0, // 前门目标
- backRightDeg0: 0, // 后门初始
- backRightDeg1: 0, // 后门目标
- };
- const { mouseDownFn } = useEvent();
- // 初始化左右摇摆动画
- const startAnimation = () => {
- // 定义鼠标点击事件
- model.canvasContainer?.addEventListener('mousedown', mouseEvent.bind(null));
- model.canvasContainer?.addEventListener('pointerup', (event) => {
- event.stopPropagation();
- // 单道、 双道
- if (fmType === 'fm1') {
- fm1?.mouseUpModel.call(fm1);
- } else if (fmType === 'fm2') {
- fm2?.mouseUpModel.call(fm2);
- } else if (fmType === 'fmThreeTl') {
- fmThreeTl?.mouseUpModel.call(fmThreeTl);
- } else if (fmType === 'fm3') {
- fm3?.mouseUpModel.call(fm3);
- } else if (fmType === 'fmXr') {
- fmXr?.mouseUpModel.call(fmXr);
- } else if (fmType === 'fmTwoSs') {
- fmTwoSs?.mouseUpModel.call(fmTwoSs);
- } else if (fmType === 'fmWindow') {
- fmWindow.mouseUpModel.call(fmWindow);
- } else if (fmType === 'fmWindowHjg') {
- fmWindowHjg.mouseUpModel();
- }
- });
- };
- // 鼠标点击、松开事件
- const mouseEvent = (event) => {
- if (event.button == 0) {
- mouseDownFn(model, group, event, (intersects) => {
- if (fmType === 'fm1' && fm1) {
- fm1?.mousedownModel.call(fm1, intersects);
- } else if (fmType === 'fm2' && fm2) {
- fm2?.mousedownModel.call(fm2, intersects);
- } else if (fmType === 'fm3' && fm3) {
- fm3?.mousedownModel.call(fm3, intersects);
- } else if (fmType === 'fmXr' && fmXr) {
- fmXr?.mousedownModel.call(fmXr, intersects);
- } else if (fmType === 'fmTwoSs' && fmTwoSs) {
- fmTwoSs?.mousedownModel.call(fmTwoSs, intersects);
- } else if (fmType === 'fmThreeTl') {
- fmThreeTl?.mousedownModel.call(fmThreeTl, intersects);
- } else if (fmType === 'fmWindow' && fmWindow) {
- fmWindow.mousedownModel.call(fmWindow, intersects);
- } else if (fmType === 'fmWindowHjg' && fmWindowHjg) {
- fmWindowHjg.mousedownModel(intersects);
- }
- });
- console.log('摄像头控制信息', model.orbitControls, model.camera);
- }
- };
- export const addMonitorText = (selectData) => {
- if (fmType === 'fm1' && fm1) {
- return fm1?.addMonitorText.call(fm1, selectData);
- } else if (fmType === 'fm2' && fm2) {
- return fm2?.addMonitorText.call(fm2, selectData);
- } else if (fmType === 'fm3' && fm3) {
- return fm3?.addMonitorText.call(fm3, selectData);
- } else if (fmType === 'fmXr' && fmXr) {
- return fmXr?.addMonitorText.call(fmXr, selectData);
- } else if (fmType === 'fmTwoSs' && fmTwoSs) {
- return fmTwoSs?.addMonitorText.call(fmTwoSs, selectData);
- } else if (fmType === 'fmThreeTl') {
- fmThreeTl?.addMonitorText.call(fmThreeTl, selectData);
- } else if (fmType === 'fmWindow' && fmWindow) {
- fmWindow.addMonitorText.call(fmWindow, selectData);
- } else if (fmType === 'fmWindowHjg' && fmWindowHjg) {
- fmWindowHjg.addMonitorText(selectData);
- }
- };
- export const deviceDetailCard = () => {
- if (fmType === 'fm1') {
- return fm1?.deviceDetailCard.call(fm1);
- } else if (fmType === 'fm3') {
- return fm3?.deviceDetailCard.call(fm3);
- } else if (fmType === 'fmXr') {
- return fmXr?.deviceDetailCard.call(fmXr);
- } else {
- // return fm2.addMonitorText.call(fm2);
- }
- };
- export const play = (handlerState, flag?) => {
- if (fmType === 'fm1' && fm1) {
- return fm1.play.call(fm1, handlerState, flag);
- } else if (fmType === 'fm2' && fm2) {
- return fm2.play.call(fm2, handlerState, flag);
- } else if (fmType === 'fmWindow' && fmWindow) {
- return fmWindow.play.call(fmWindow, handlerState, flag);
- } else if (fmType === 'fmWindowHjg' && fmWindowHjg) {
- return fmWindowHjg.play.call(fmWindowHjg, handlerState, flag);
- } else if (fmType === 'fm3' && fm3) {
- return fm3.play.call(fm3, handlerState, flag);
- } else if (fmType === 'fmXr' && fmXr) {
- return fmXr.play.call(fmXr, handlerState, flag);
- } else if (fmType === 'fmTwoSs' && fmTwoSs) {
- return fmTwoSs.play.call(fmTwoSs, handlerState, flag);
- } else if (fmType === 'fmThreeTl') {
- fmThreeTl?.play.call(fmThreeTl, handlerState, flag);
- }
- };
- // export const playWindow = (rotationParam, flag) => {
- // if (fmType === 'fmWindow' && fmWindow) {
- // return fmWindow.playWindow.call(fmWindow, rotationParam, flag);
- // } else if (fmType === 'fmWindowHjg' && fmWindowHjg) {
- // return fmWindowHjg.playWindow.call(fmWindowHjg, rotationParam, flag);
- // }
- // };
- export function computePlay(data, maxarea, isFirst = false) {
- // 前门后窗 rearPresentValue1
- // 前门前窗 frontPresentValue1
- // 后门后窗 rearPresentValue2
- // 后门前窗 frontPresentValue2
- // data['frontArea'] = 70;
- // data['rearArea'] = 40;
- if (data.rearPresentValue1 || data.frontPresentValue1 || data.rearPresentValue2 || data.frontPresentValue2) {
- maxarea = 90;
- rotationParam.frontLeftDeg0 = (90 / maxarea) * Number(isFirst ? 0 : data.frontPresentValue1);
- rotationParam.frontRightDeg0 = (90 / maxarea) * Number(isFirst ? 0 : data.rearPresentValue1);
- rotationParam.frontLeftDeg1 = (90 / maxarea) * Number(data.frontPresentValue1) || 0;
- rotationParam.frontRightDeg1 = (90 / maxarea) * Number(data.rearPresentValue1) || 0;
- rotationParam.backLeftDeg0 = (90 / maxarea) * Number(isFirst ? 0 : data.frontPresentValue2);
- rotationParam.backRightDeg0 = (90 / maxarea) * Number(isFirst ? 0 : data.rearPresentValue2);
- rotationParam.backLeftDeg1 = (90 / maxarea) * Number(data.frontPresentValue2) || 0;
- rotationParam.backRightDeg1 = (90 / maxarea) * Number(data.rearPresentValue2) || 0;
- // rotationParam.backLeftDeg1 = 90;
- if (fmType === 'fmWindowHjg' && fmWindowHjg) {
- fmWindowHjg.playWindow(rotationParam, 1);
- fmWindowHjg.playWindow(rotationParam, 2);
- fmWindowHjg.playWindow(rotationParam, 3);
- fmWindowHjg.playWindow(rotationParam, 4);
- }
- } else if (data.frontArea && data.rearArea) {
- maxarea = 90;
- rotationParam.frontLeftDeg0 = (90 / maxarea) * Number(isFirst ? 0 : data.frontArea);
- rotationParam.frontRightDeg0 = (90 / maxarea) * Number(isFirst ? 0 : data.frontArea);
- rotationParam.frontLeftDeg1 = (90 / maxarea) * Number(data.frontArea) || 0;
- rotationParam.frontRightDeg1 = (90 / maxarea) * Number(data.frontArea) || 0;
- rotationParam.backLeftDeg0 = (90 / maxarea) * Number(isFirst ? 0 : data.rearArea);
- rotationParam.backRightDeg0 = (90 / maxarea) * Number(isFirst ? 0 : data.rearArea);
- rotationParam.backLeftDeg1 = (90 / maxarea) * Number(data.rearArea) || 0;
- rotationParam.backRightDeg1 = (90 / maxarea) * Number(data.rearArea) || 0;
- if (fmType === 'fmWindow' && fmWindow) {
- fmWindow.playWindow(rotationParam, 1);
- fmWindow.playWindow(rotationParam, 2);
- fmWindow.playWindow(rotationParam, 3);
- fmWindow.playWindow(rotationParam, 4);
- }
- }
- }
- // 切换风门类型
- export const setModelType = (type) => {
- fmType = type;
- return new Promise((resolve) => {
- // 暂停风门1动画
- if (fmType === 'fm1' && fm1 && fm1.group) {
- 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.frontDamperClosedMesh) fm1.frontDamperClosedMesh.visible = true;
- if (fm1.backDamperOpenMesh) fm1.backDamperOpenMesh.visible = false;
- if (fm1.backDamperClosedMesh) fm1.backDamperClosedMesh.visible = true;
- model.scene.remove(group);
- model.startAnimation = fm1.render.bind(fm1);
- group = fm1.group;
- group.rotation.y = 0;
- const oldCameraPosition = { x: -1000, y: 100, z: 500 };
- setTimeout(async () => {
- resolve(null);
- model.scene.add(fm1.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);
- } else if (fmType === 'fm2' && fm2 && fm2.group) {
- 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.scene.remove(group);
- group = fm2.group;
- const oldCameraPosition = { x: -761, y: 569, z: 871 };
- setTimeout(async () => {
- resolve(null);
- model.scene.add(fm2.group);
- const position = { x: -2.28, y: -0.91, z: -5.68 };
- await animateCamera(
- oldCameraPosition,
- { x: -2.27, y: -0.91, z: -5.67 },
- { x: 66.257, y: 57.539, z: 94.313 },
- { x: position.x, y: position.y, z: position.z },
- model,
- 0.6
- );
- }, 300);
- } else if (fmType === 'fmWindow' && fmWindow && fmWindow.group) {
- if (fmWindow.clipActionArr.frontDoor && fmWindow.clipActionArr.backDoor) {
- fmWindow.clipActionArr.frontDoor.reset();
- fmWindow.clipActionArr.frontDoor.time = 0.5;
- fmWindow.clipActionArr.backDoor.reset();
- fmWindow.clipActionArr.backDoor.time = 0.5;
- fmWindow.clipActionArr.frontDoor.stop();
- fmWindow.clipActionArr.backDoor.stop();
- }
- model.startAnimation = fmWindow.render.bind(fmWindow);
- model.scene.remove(group);
- group = fmWindow.group;
- const oldCameraPosition = { x: -761, y: 569, z: 871 };
- setTimeout(async () => {
- resolve(null);
- model.scene.add(fmWindow.group);
- const position = { x: -2.28, y: -0.91, z: -5.68 };
- await animateCamera(
- oldCameraPosition,
- { x: -2.27, y: -0.91, z: -5.67 },
- { x: 66.257, y: 57.539, z: 94.313 },
- { x: position.x, y: position.y, z: position.z },
- model,
- 0.6
- );
- }, 300);
- } else if (fmType === 'fmWindowHjg' && fmWindowHjg && fmWindowHjg.group) {
- if (fmWindowHjg.clipActionArr.frontDoor && fmWindowHjg.clipActionArr.backDoor) {
- fmWindowHjg.clipActionArr.frontDoor.reset();
- fmWindowHjg.clipActionArr.frontDoor.time = 0.5;
- fmWindowHjg.clipActionArr.backDoor.reset();
- fmWindowHjg.clipActionArr.backDoor.time = 0.5;
- fmWindowHjg.clipActionArr.frontDoor.stop();
- fmWindowHjg.clipActionArr.backDoor.stop();
- }
- model.startAnimation = fmWindowHjg.render.bind(fmWindowHjg);
- model.scene.remove(group);
- group = fmWindowHjg.group;
- const oldCameraPosition = { x: -761, y: 569, z: 871 };
- setTimeout(async () => {
- resolve(null);
- model.scene.add(fmWindowHjg.group);
- const position = { x: -2.28, y: -0.91, z: -5.68 };
- await animateCamera(
- oldCameraPosition,
- { x: -2.27, y: -0.91, z: -5.67 },
- { x: 66.257, y: 57.539, z: 94.313 },
- { x: position.x, y: position.y, z: position.z },
- model,
- 0.6
- );
- }, 300);
- } else if (fmType === 'fmThreeTl' && fmThreeTl && fmThreeTl.group) {
- if (fmThreeTl.clipActionArr.frontDoor && fmThreeTl.clipActionArr.backDoor && fmThreeTl.clipActionArr.centerDoor) {
- fmThreeTl.clipActionArr.frontDoor.reset();
- fmThreeTl.clipActionArr.frontDoor.time = 0.5;
- fmThreeTl.clipActionArr.backDoor.reset();
- fmThreeTl.clipActionArr.backDoor.time = 0.5;
- fmThreeTl.clipActionArr.centerDoor.reset();
- fmThreeTl.clipActionArr.centerDoor.time = 0.5;
- fmThreeTl.clipActionArr.frontDoor.stop();
- fmThreeTl.clipActionArr.backDoor.stop();
- fmThreeTl.clipActionArr.centerDoor.stop();
- }
- if (fmThreeTl.frontDamperOpenMesh) fmThreeTl.frontDamperOpenMesh.visible = false;
- if (fmThreeTl.frontDamperClosedMesh) fmThreeTl.frontDamperClosedMesh.visible = true;
- if (fmThreeTl.centerDamperOpenMesh) fmThreeTl.centerDamperOpenMesh.visible = false;
- if (fmThreeTl.centerDamperClosedMesh) fmThreeTl.centerDamperClosedMesh.visible = true;
- if (fmThreeTl.backDamperOpenMesh) fmThreeTl.backDamperOpenMesh.visible = false;
- if (fmThreeTl.backDamperClosedMesh) fmThreeTl.backDamperClosedMesh.visible = true;
- // 显示单道风窗
- model.startAnimation = fmThreeTl.render.bind(fmThreeTl);
- model.scene.remove(group);
- group = fmThreeTl.group;
- const oldCameraPosition = { x: -761, y: 569, z: 871 };
- setTimeout(async () => {
- resolve(null);
- model.scene.add(fmThreeTl.group);
- const position = { x: 31.873075535732386, y: -3.501715880262631, z: -15.490295891616942 };
- await animateCamera(
- oldCameraPosition,
- { x: -2.27, y: -0.91, z: -5.67 },
- { x: 88.60102093060523, y: 53.89462381404774, z: 109.90762232602137 },
- { x: position.x, y: position.y, z: position.z },
- model,
- 0.6
- );
- }, 300);
- } else if (fmType === 'fm3' && fm3 && fm3.group) {
- 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.frontDamperClosedMesh) fm3.frontDamperClosedMesh.visible = true;
- if (fm3.backDamperOpenMesh) fm3.backDamperOpenMesh.visible = false;
- if (fm3.backDamperClosedMesh) fm3.backDamperClosedMesh.visible = true;
- model.scene.remove(group);
- model.startAnimation = fm3.render.bind(fm3);
- group = fm3.group;
- group.rotation.y = 0;
- const oldCameraPosition = { x: -1000, y: 100, z: 500 };
- setTimeout(async () => {
- resolve(null);
- model.scene.add(fm3.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);
- } 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);
- model.scene.remove(group);
- group = fmXr.group;
- group.rotation.y = 0;
- 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);
- } else if (fmType === 'fmTwoSs' && fmTwoSs && fmTwoSs.group) {
- if (fmTwoSs.clipActionArr.frontDoor && fmTwoSs.clipActionArr.backDoor) {
- fmTwoSs.clipActionArr.frontDoor.reset();
- fmTwoSs.clipActionArr.frontDoor.time = 0.5;
- fmTwoSs.clipActionArr.backDoor.reset();
- fmTwoSs.clipActionArr.backDoor.time = 0.5;
- fmTwoSs.clipActionArr.frontDoor.stop();
- fmTwoSs.clipActionArr.backDoor.stop();
- }
- if (fmTwoSs.frontDamperOpenMesh) fmTwoSs.frontDamperOpenMesh.visible = false;
- if (fmTwoSs.frontDamperClosedMesh) fmTwoSs.frontDamperClosedMesh.visible = true;
- if (fmTwoSs.backDamperOpenMesh) fmTwoSs.backDamperOpenMesh.visible = false;
- if (fmTwoSs.backDamperClosedMesh) fmTwoSs.backDamperClosedMesh.visible = true;
- model.startAnimation = fmTwoSs.render.bind(fmTwoSs);
- model.scene.remove(group);
- group = fmTwoSs.group;
- group.rotation.y = 0;
- const oldCameraPosition = { x: -1000, y: 100, z: 500 };
- setTimeout(async () => {
- resolve(null);
- model.scene.add(fmTwoSs.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);
- }
- });
- };
- export const initCameraCanvas = async (playerVal1) => {
- if (fmType === 'fm1' && fm1) {
- return await fm1.initCamera.call(fm1, playerVal1);
- } else if (fmType === 'fm2' && fm2) {
- return fm2.initCamera.call(fm2, playerVal1);
- } else if (fmType === 'fm3' && fm3) {
- return fm3.initCamera.call(fm3, playerVal1);
- } else if (fmType === 'fmXr' && fmXr) {
- return fmXr.initCamera.call(fmXr, playerVal1);
- }
- };
- export const mountedThree = (playerDom) => {
- const { sysOrgCode } = useGlobSetting();
- debugger;
- // const sysOrgCode = 'gsgszdek';
- return new Promise(async (resolve) => {
- model = new UseThree('#damper3D', '', '#deviceDetail');
- model.setEnvMap('test1.hdr');
- model.renderer.toneMappingExposure = 0.9;
- model.camera.position.set(100, 0, 1000);
- switch (sysOrgCode) {
- case 'yjmdsankuang': //窑街三矿
- case 'yjmdhswmk': //窑街海石湾
- case 'yjmdjhmk': //窑街金河矿
- const FmYj = await import('./gate.threejs.yj');
- if (FmYj) fm3 = new FmYj.default(model);
- if (fm3) fm3.mountedThree(playerDom);
- const FmTwoYj = await import('./gate.threejs.two.yj');
- if (FmTwoYj) fmTwoSs = new FmTwoYj.default(model);
- fmTwoSs.mountedThree(playerDom);
- fmXr = new FmXR(model);
- fmXr.mountedThree(playerDom);
- break;
- case 'zmjthjg': //黄家沟
- const FmNoSubStation = await import('./gate.threejs.noStation');
- if (FmNoSubStation) fm3 = new FmNoSubStation.default(model);
- if (fm3) fm3.mountedThree(playerDom);
- fmXr = new FmXR(model);
- fmXr.mountedThree(playerDom);
- break;
- case 'gsgszdek': //大海则
- fmWindowHjg = new FmDc(model);
- if (fmWindowHjg) fmWindowHjg.mountedThree(playerDom);
- fm3 = new Fm3(model);
- fm3.mountedThree(playerDom);
- fmXr = new FmXR(model);
- fmXr.mountedThree(playerDom);
- break;
- case 'sdmtjtbltmk': //补连塔
- fm3 = new Fm3(model);
- fm3.mountedThree(playerDom);
- fmXr = new FmXR(model);
- fmXr.mountedThree(playerDom);
- // 三道门
- fmThreeTl = new FmThreeTl(model);
- if (fmThreeTl) fmThreeTl.mountedThree(playerDom);
- break;
- default:
- debugger;
- // 根据字典加载模型
- const dictCodes = getDictItemsByCode('gateStyle');
- if (dictCodes.length > 0) {
- for (let i = 0; i < dictCodes.length; i++) {
- const dict = dictCodes[i];
- switch (dict.value) {
- case 'fmXr':
- fmXr = new FmXR(model);
- fmXr.mountedThree(playerDom);
- break;
- case 'fmYy':
- fm1 = new Fm1(model);
- fm1.mountedThree(playerDom);
- break;
- case 'gate_qd':
- fm3 = new Fm3(model);
- await fm3.mountedThree();
- break;
- case 'fmSs':
- fmTwoSs = new FmTwoSs(model);
- await fmTwoSs.mountedThree();
- break;
- case 'fmtl3':
- fmThreeTl = new FmThreeTl(model);
- await fmThreeTl.mountedThree();
- break;
- case 'fmSs3':
- fm2 = new Fm2(model);
- await fm2.mountedThree();
- break;
- case 'fm_fc_hjg':
- fmWindowHjg = new FmDcHJG(model);
- await fmWindowHjg.mountedThree();
- break;
- case 'fm_fc':
- fmWindow = new FmDc(model);
- await fmWindow.mountedThree();
- break;
- }
- }
- resolve(null);
- } else {
- fm3 = new Fm3(model);
- fm3.mountedThree(playerDom);
- fmTwoSs = new FmTwoSs(model);
- fmTwoSs.mountedThree(playerDom);
- fm2 = new Fm2(model);
- fm2.mountedThree(playerDom);
- // 三道门
- fmThreeTl = new FmThreeTl(model);
- if (fmThreeTl) fmThreeTl.mountedThree(playerDom);
- fmXr = new FmXR(model);
- fmXr.mountedThree(playerDom);
- // 液压风门
- fm1 = new Fm1(model);
- fm1.mountedThree(playerDom);
- resolve(null);
- break;
- }
- }
- model.animate();
- startAnimation();
- });
- };
- export const destroy = () => {
- if (model) {
- model.isRender = false;
- if (fm1) fm1.destroy();
- if (fm2) fm2.destroy();
- if (fm3) fm3.destroy();
- if (fmXr) fmXr.destroy();
- if (fmTwoSs) fmTwoSs.destroy();
- if (fmWindowHjg) fmWindowHjg.destroy();
- if (fmWindow) fmWindow.destroy();
- if (fmThreeTl) fmThreeTl.destroy();
- fm1 = null;
- fm2 = null;
- fm3 = null;
- fmXr = null;
- fmWindow = null;
- fmWindowHjg = null;
- fmThreeTl = null;
- fmTwoSs = null;
- group = null;
- model.mixers = [];
- model.destroy();
- }
- model = null;
- };
|