gate.threejs.ts 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030
  1. import * as THREE from 'three';
  2. import UseThree from '../../../../utils/threejs/useThree';
  3. // import Fm1 from './gate.threejs.yy';
  4. // import Fm3 from './gate.threejs.qd';
  5. import FmXR from './gate.threejs.xr';
  6. // import Fm2 from './gate.threejs.three';
  7. // import FmTwoSs from './gate.threejs.two.ss';
  8. // import FmThreeTl from './gate.threejs.three.tl';
  9. // import FmDc from './gate.threejs.window';
  10. // import FmDcHJG from './gate.threejs.window.hjg';
  11. // import FmDcZHQ from './gate.threejs.window.zhq';
  12. // import FmHsw3 from './gate.threejs.three.hsw';
  13. // import FmYjXr from './gate.threejs.two.yj'; // 窑街行人
  14. // import FmYj from './gate.threejs.yj'; // 窑街
  15. // import FmSp1 from './gate.threejs.one.sp';
  16. import { animateCamera } from '/@/utils/threejs/util';
  17. import useEvent from '../../../../utils/threejs/useEvent';
  18. import { useModelFileStore } from '/@/store/modules/modelFile';
  19. import { getDictItemsByCode } from '/@/utils/dict';
  20. // import { useGlobSetting } from '/@/hooks/setting';
  21. // 模型对象、 文字对象
  22. let model,
  23. fm1, //液压风门
  24. fm2, //三道风门收缩
  25. fm3, //气动风门
  26. fmXr: FmXR, //行人风门
  27. fmTwoSs, //
  28. fmThreeTl, // 三道推拉
  29. fmWindowHjg, // 带风窗
  30. fmWindowZhq, // 带风窗 沼和泉
  31. fmWindow, // 带风窗
  32. fmHsw3, // 海石湾拱形三道风门
  33. fmYjXr, // 窑街拱形行人风门
  34. fmYj, // 窑街拱形行车风门
  35. fmSp1, // 沙坪一道风门
  36. fmDcBd, // 带风窗
  37. fmSsl, // 思山岭双道蓝色风门
  38. fm_fc_ssl, // 带风窗
  39. group: THREE.Object3D,
  40. fmType = '',
  41. windowType = 'singleWindow';
  42. const rotationParam = {
  43. frontLeftDeg0: 0, // 前门初始
  44. frontLeftDeg1: 0, // 前门目标
  45. backLeftDeg0: 0, // 后门初始
  46. backLeftDeg1: 0, // 后门目标
  47. frontRightDeg0: 0, // 前门初始
  48. frontRightDeg1: 0, // 前门目标
  49. backRightDeg0: 0, // 后门初始
  50. backRightDeg1: 0, // 后门目标
  51. frontDeg0: 0,
  52. frontDeg1: 0,
  53. backDeg0: 0,
  54. backDeg1: 0,
  55. };
  56. const { mouseDownFn } = useEvent();
  57. // 初始化左右摇摆动画
  58. const startAnimation = () => {
  59. if (!model) return;
  60. // 定义鼠标点击事件
  61. model.canvasContainer?.addEventListener('mousedown', mouseEvent.bind(null));
  62. model.canvasContainer?.addEventListener('pointerup', (event) => {
  63. event.stopPropagation();
  64. // 单道、 双道
  65. if (fmType === 'fm1') {
  66. fm1?.mouseUpModel.call(fm1);
  67. } else if (fmType === 'fm2') {
  68. fm2?.mouseUpModel.call(fm2);
  69. } else if (fmType === 'fmThreeTl') {
  70. fmThreeTl?.mouseUpModel.call(fmThreeTl);
  71. } else if (fmType === 'fm3') {
  72. fm3?.mouseUpModel.call(fm3);
  73. } else if (fmType === 'fmXr') {
  74. fmXr?.mouseUpModel.call(fmXr);
  75. } else if (fmType === 'fmTwoSs') {
  76. fmTwoSs?.mouseUpModel.call(fmTwoSs);
  77. } else if (fmType === 'fmWindow') {
  78. fmWindow.mouseUpModel.call(fmWindow);
  79. } else if (fmType === 'fmWindowHjg') {
  80. fmWindowHjg.mouseUpModel();
  81. } else if (fmType === 'fmWindowZhq') {
  82. fmWindowZhq.mouseUpModel();
  83. } else if (fmType === 'fmHsw3') {
  84. fmHsw3.mouseUpModel();
  85. } else if (fmType === 'fmYjXr') {
  86. fmYjXr.mouseUpModel();
  87. } else if (fmType === 'fmYj') {
  88. fmYj.mouseUpModel();
  89. } else if (fmType === 'fmSp1') {
  90. fmSp1.mouseUpModel();
  91. } else if (fmType === 'fm_fc_bd') {
  92. fmDcBd.mouseUpModel();
  93. } else if (fmType === 'fmSsl') {
  94. fmSsl.mouseUpModel();
  95. } else if (fmType === 'fm_fc_ssl') {
  96. fm_fc_ssl.mouseUpModel();
  97. }
  98. });
  99. };
  100. // 鼠标点击、松开事件
  101. const mouseEvent = (event) => {
  102. if (!model) return;
  103. if (event.button == 0) {
  104. mouseDownFn(model, group, event, (intersects) => {
  105. if (fmType === 'fm1' && fm1) {
  106. fm1?.mousedownModel.call(fm1, intersects);
  107. } else if (fmType === 'fm2' && fm2) {
  108. fm2?.mousedownModel.call(fm2, intersects);
  109. } else if (fmType === 'fm3' && fm3) {
  110. fm3?.mousedownModel.call(fm3, intersects);
  111. } else if (fmType === 'fmXr' && fmXr) {
  112. fmXr?.mousedownModel.call(fmXr, intersects);
  113. } else if (fmType === 'fmTwoSs' && fmTwoSs) {
  114. fmTwoSs?.mousedownModel.call(fmTwoSs, intersects);
  115. } else if (fmType === 'fmThreeTl') {
  116. fmThreeTl?.mousedownModel.call(fmThreeTl, intersects);
  117. } else if (fmType === 'fmWindow' && fmWindow) {
  118. fmWindow.mousedownModel.call(fmWindow, intersects);
  119. } else if (fmType === 'fmWindowHjg' && fmWindowHjg) {
  120. fmWindowHjg.mousedownModel(intersects);
  121. } else if (fmType === 'fmWindowZhq' && fmWindowZhq) {
  122. fmWindowZhq.mousedownModel(intersects);
  123. } else if (fmType === 'fmHsw3' && fmHsw3) {
  124. fmHsw3.mousedownModel(intersects);
  125. } else if (fmType === 'fmYjXr' && fmYjXr) {
  126. fmYjXr.mousedownModel(intersects);
  127. } else if (fmType === 'fmYj' && fmYj) {
  128. fmYj.mousedownModel(intersects);
  129. } else if (fmType === 'fmSp1') {
  130. fmSp1.mousedownModel(intersects);
  131. } else if (fmType === 'fm_fc_bd' && fmDcBd) {
  132. fmDcBd.mousedownModel(intersects);
  133. } else if (fmType === 'fmSsl' && fmSsl) {
  134. fmSsl.mousedownModel(intersects);
  135. } else if (fmType === 'fm_fc_ssl' && fm_fc_ssl) {
  136. fm_fc_ssl.mousedownModel(intersects);
  137. }
  138. });
  139. console.log('摄像头控制信息', model.orbitControls, model.camera);
  140. }
  141. };
  142. export const addMonitorText = (selectData) => {
  143. if (!model) return;
  144. if (fmType === 'fm1' && fm1) {
  145. return fm1?.addMonitorText.call(fm1, selectData);
  146. } else if (fmType === 'fm2' && fm2) {
  147. return fm2?.addMonitorText.call(fm2, selectData);
  148. } else if (fmType === 'fm3' && fm3) {
  149. return fm3?.addMonitorText.call(fm3, selectData);
  150. } else if (fmType === 'fmXr' && fmXr) {
  151. return fmXr?.addMonitorText.call(fmXr, selectData);
  152. } else if (fmType === 'fmTwoSs' && fmTwoSs) {
  153. return fmTwoSs?.addMonitorText.call(fmTwoSs, selectData);
  154. } else if (fmType === 'fmThreeTl') {
  155. fmThreeTl?.addMonitorText.call(fmThreeTl, selectData);
  156. } else if (fmType === 'fmWindow' && fmWindow) {
  157. fmWindow.addMonitorText.call(fmWindow, selectData);
  158. } else if (fmType === 'fmWindowHjg' && fmWindowHjg) {
  159. fmWindowHjg.addMonitorText(selectData);
  160. } else if (fmType === 'fmWindowZhq' && fmWindowZhq) {
  161. fmWindowZhq.addMonitorText(selectData);
  162. } else if (fmType === 'fmHsw3' && fmHsw3) {
  163. fmHsw3.addMonitorText(selectData);
  164. } else if (fmType === 'fmYjXr' && fmYjXr) {
  165. fmYjXr.addMonitorText(selectData);
  166. } else if (fmType === 'fmYj' && fmYj) {
  167. fmYj.addMonitorText(selectData);
  168. } else if (fmType === 'fmSp1' && fmSp1) {
  169. fmSp1.addMonitorText(selectData);
  170. } else if (fmType === 'fm_fc_bd' && fmDcBd) {
  171. return fmDcBd.addMonitorText(selectData);
  172. } else if (fmType === 'fmSsl' && fmSsl) {
  173. return fmSsl.addMonitorText.call(fmSsl, selectData);
  174. } else if (fmType === 'fm_fc_ssl' && fm_fc_ssl) {
  175. return fm_fc_ssl.addMonitorText.call(fm_fc_ssl, selectData);
  176. }
  177. };
  178. export const deviceDetailCard = () => {
  179. if (!model) return;
  180. if (fmType === 'fm1') {
  181. return fm1?.deviceDetailCard.call(fm1);
  182. } else if (fmType === 'fm3') {
  183. return fm3?.deviceDetailCard.call(fm3);
  184. } else if (fmType === 'fmXr') {
  185. return fmXr?.deviceDetailCard.call(fmXr);
  186. } else {
  187. // return fm2.addMonitorText.call(fm2);
  188. }
  189. };
  190. export const play = (handlerState, flag?) => {
  191. if (!model) return;
  192. if (fmType === 'fm1' && fm1) {
  193. return fm1.play.call(fm1, handlerState, flag);
  194. } else if (fmType === 'fm2' && fm2) {
  195. return fm2.play.call(fm2, handlerState, flag);
  196. } else if (fmType === 'fmWindow' && fmWindow) {
  197. return fmWindow.play.call(fmWindow, handlerState, flag);
  198. } else if (fmType === 'fmWindowHjg' && fmWindowHjg) {
  199. return fmWindowHjg.play.call(fmWindowHjg, handlerState, flag);
  200. } else if (fmType === 'fmWindowZhq' && fmWindowZhq) {
  201. return fmWindowZhq.play.call(fmWindowZhq, handlerState, flag);
  202. } else if (fmType === 'fm3' && fm3) {
  203. return fm3.play.call(fm3, handlerState, flag);
  204. } else if (fmType === 'fmXr' && fmXr) {
  205. return fmXr.play.call(fmXr, handlerState, flag);
  206. } else if (fmType === 'fmTwoSs' && fmTwoSs) {
  207. return fmTwoSs.play.call(fmTwoSs, handlerState, flag);
  208. } else if (fmType === 'fmThreeTl') {
  209. return fmThreeTl?.play.call(fmThreeTl, handlerState, flag);
  210. } else if (fmType === 'fmHsw3') {
  211. return fmHsw3?.play.call(fmHsw3, handlerState, flag);
  212. } else if (fmType === 'fmYjXr') {
  213. return fmYjXr?.play.call(fmYjXr, handlerState, flag);
  214. } else if (fmType === 'fmYj') {
  215. return fmYj?.play.call(fmYj, handlerState, flag);
  216. } else if (fmType === 'fmSp1') {
  217. return fmSp1?.play(handlerState, flag);
  218. } else if (fmType === 'fm_fc_bd' && fmDcBd) {
  219. return fmDcBd.play.call(fmDcBd, handlerState, flag);
  220. } else if (fmType === 'fmSsl' && fmSsl) {
  221. return fmSsl.play.call(fmSsl, handlerState, flag);
  222. } else if (fmType === 'fm_fc_ssl' && fm_fc_ssl) {
  223. return fm_fc_ssl.play.call(fm_fc_ssl, handlerState, flag);
  224. }
  225. };
  226. // export const playWindow = (rotationParam, flag) => {
  227. // if (fmType === 'fmWindow' && fmWindow) {
  228. // return fmWindow.playWindow.call(fmWindow, rotationParam, flag);
  229. // } else if (fmType === 'fmWindowHjg' && fmWindowHjg) {
  230. // return fmWindowHjg.playWindow.call(fmWindowHjg, rotationParam, flag);
  231. // }
  232. // };
  233. export function computePlay(data, maxarea, isFirst = false) {
  234. if (!model) return;
  235. // 前门后窗 rearPresentValue1
  236. // 前门前窗 frontPresentValue1
  237. // 后门后窗 rearPresentValue2
  238. // 后门前窗 frontPresentValue2
  239. // data['frontArea'] = 70;
  240. // data['rearArea'] = 40;
  241. if (
  242. (fmType === 'fmWindowHjg' || fmType === 'fmWindowZhq') &&
  243. (data.rearPresentValue1 || data.frontPresentValue1 || data.rearPresentValue2 || data.frontPresentValue2)
  244. ) {
  245. maxarea = 90;
  246. rotationParam.frontLeftDeg0 = (90 / maxarea) * Number(isFirst ? 0 : data.frontPresentValue1);
  247. rotationParam.frontRightDeg0 = (90 / maxarea) * Number(isFirst ? 0 : data.rearPresentValue1);
  248. rotationParam.frontLeftDeg1 = (90 / maxarea) * Number(data.frontPresentValue1) || 0;
  249. rotationParam.frontRightDeg1 = (90 / maxarea) * Number(data.rearPresentValue1) || 0;
  250. rotationParam.backLeftDeg0 = (90 / maxarea) * Number(isFirst ? 0 : data.frontPresentValue2);
  251. rotationParam.backRightDeg0 = (90 / maxarea) * Number(isFirst ? 0 : data.rearPresentValue2);
  252. rotationParam.backLeftDeg1 = (90 / maxarea) * Number(data.frontPresentValue2) || 0;
  253. rotationParam.backRightDeg1 = (90 / maxarea) * Number(data.rearPresentValue2) || 0;
  254. rotationParam.backLeftDeg1 = 90;
  255. if (fmType === 'fmWindowHjg') {
  256. fmWindowHjg.playWindow(rotationParam, 1);
  257. fmWindowHjg.playWindow(rotationParam, 2);
  258. fmWindowHjg.playWindow(rotationParam, 3);
  259. fmWindowHjg.playWindow(rotationParam, 4);
  260. } else {
  261. fmWindowZhq.playWindow(rotationParam, 1);
  262. fmWindowZhq.playWindow(rotationParam, 2);
  263. fmWindowZhq.playWindow(rotationParam, 3);
  264. fmWindowZhq.playWindow(rotationParam, 4);
  265. }
  266. } else if (fmType === 'fmWindow' && data.frontPresentValue1 && data.frontPresentValue2 && data.rearPresentValue1 && data.rearPresentValue2) {
  267. maxarea = 90;
  268. rotationParam.frontLeftDeg0 = (90 / maxarea) * Number(isFirst ? 0 : data.frontPresentValue1);
  269. rotationParam.frontRightDeg0 = (90 / maxarea) * Number(isFirst ? 0 : data.frontPresentValue2);
  270. rotationParam.frontLeftDeg1 = (90 / maxarea) * Number(data.frontPresentValue1) || 0;
  271. rotationParam.frontRightDeg1 = (90 / maxarea) * Number(data.frontPresentValue2) || 0;
  272. rotationParam.backLeftDeg0 = (90 / maxarea) * Number(isFirst ? 0 : data.rearPresentValue1);
  273. rotationParam.backRightDeg0 = (90 / maxarea) * Number(isFirst ? 0 : data.rearPresentValue2);
  274. rotationParam.backLeftDeg1 = (90 / maxarea) * Number(data.rearPresentValue1) || 0;
  275. rotationParam.backRightDeg1 = (90 / maxarea) * Number(data.rearPresentValue2) || 0;
  276. fmWindow.playWindow(rotationParam, 1);
  277. fmWindow.playWindow(rotationParam, 2);
  278. fmWindow.playWindow(rotationParam, 3);
  279. fmWindow.playWindow(rotationParam, 4);
  280. } else if (maxarea && fmType === 'fm_fc_bd') {
  281. // maxarea = 90;
  282. rotationParam.frontDeg0 = (90 / Number(maxarea)) * Number(isFirst ? 0 : data.frontArea);
  283. rotationParam.backDeg0 = (90 / Number(maxarea)) * Number(isFirst ? 0 : data.rearArea);
  284. rotationParam.frontDeg1 = (90 / Number(maxarea)) * Number(data.frontArea) || 0;
  285. rotationParam.backDeg1 = (90 / Number(maxarea)) * Number(data.rearArea) || 0;
  286. fmDcBd.playWindow(rotationParam, 1);
  287. fmDcBd.playWindow(rotationParam, 2);
  288. } else if (fmType === 'fm_fc_ssl') {
  289. rotationParam.frontDeg0 = Number(isFirst ? 0 : data.frontPresentValue);
  290. rotationParam.backDeg0 = Number(isFirst ? 0 : data.rearPresentValue);
  291. rotationParam.frontDeg1 = Number(data.frontPresentValue) || 0;
  292. rotationParam.backDeg1 = Number(data.rearPresentValue) || 0;
  293. fm_fc_ssl.playWindow(rotationParam, 1);
  294. fm_fc_ssl.playWindow(rotationParam, 2);
  295. }
  296. }
  297. // 切换风门类型
  298. // fm1 纯黄色双门
  299. // fm2 纯红色三门
  300. // fmWindow 橘黄风窗一体双门
  301. // fmWindowHjg 橘黄上窗下门双门
  302. // fmWindowZhq 蓝色上窗下门双门
  303. // fm_fc_bd 橘黄风窗一体单门
  304. // fm_fc_ssl 蓝色风窗一体单门
  305. // fmThreeTl 黄色自动风门三门
  306. // fm3 黄色自动风门双门
  307. // fmXr 白色蓝底双门
  308. // fmTwoSs 红色双门
  309. // fmHsw3 隧道半圆蓝色三门
  310. // fmYjXr 隧道半圆蓝色双门
  311. // fmYj 隧道半圆红色双门
  312. // fmSp1 蓝色警示条单门
  313. // fmSsl 蓝色警示条双门
  314. export const setModelType = (type) => {
  315. if (!model) return Promise.reject('model is null');
  316. fmType = type;
  317. return new Promise((resolve) => {
  318. // 暂停风门1动画
  319. if (fmType === 'fm1' && fm1 && fm1.group) {
  320. if (fm1.clipActionArr.frontDoor && fm1.clipActionArr.backDoor) {
  321. fm1.clipActionArr.frontDoor.reset();
  322. fm1.clipActionArr.frontDoor.time = 0.5;
  323. fm1.clipActionArr.backDoor.reset();
  324. fm1.clipActionArr.backDoor.time = 0.5;
  325. fm1.clipActionArr.frontDoor.stop();
  326. fm1.clipActionArr.backDoor.stop();
  327. }
  328. if (fm1.frontDamperOpenMesh) fm1.frontDamperOpenMesh.visible = false;
  329. if (fm1.frontDamperClosedMesh) fm1.frontDamperClosedMesh.visible = true;
  330. if (fm1.backDamperOpenMesh) fm1.backDamperOpenMesh.visible = false;
  331. if (fm1.backDamperClosedMesh) fm1.backDamperClosedMesh.visible = true;
  332. model.scene.remove(group);
  333. model.startAnimation = fm1.render.bind(fm1);
  334. group = fm1.group;
  335. group.rotation.y = 0;
  336. const oldCameraPosition = { x: -1000, y: 100, z: 500 };
  337. setTimeout(async () => {
  338. resolve(null);
  339. model.scene.add(fm1.group);
  340. await animateCamera(
  341. oldCameraPosition,
  342. { x: 0, y: 0, z: 0 },
  343. { x: 50.99, y: 69.32, z: 93.61 },
  344. { x: -10.04, y: -14.38, z: -31.4 },
  345. model,
  346. 0.8
  347. );
  348. }, 300);
  349. } else if (fmType === 'fm2' && fm2 && fm2.group) {
  350. if (fm2.clipActionArr.frontDoor && fm2.clipActionArr.backDoor) {
  351. fm2.clipActionArr.frontDoor.reset();
  352. fm2.clipActionArr.frontDoor.time = 0.5;
  353. fm2.clipActionArr.backDoor.reset();
  354. fm2.clipActionArr.backDoor.time = 0.5;
  355. fm2.clipActionArr.centerDoor.reset();
  356. fm2.clipActionArr.centerDoor.time = 0.5;
  357. fm2.clipActionArr.frontDoor.stop();
  358. fm2.clipActionArr.backDoor.stop();
  359. fm2.clipActionArr.centerDoor.stop();
  360. }
  361. // 显示单道风窗
  362. model.startAnimation = fm2.render.bind(fm2);
  363. model.scene.remove(group);
  364. group = fm2.group;
  365. const oldCameraPosition = { x: -761, y: 569, z: 871 };
  366. setTimeout(async () => {
  367. resolve(null);
  368. model.scene.add(fm2.group);
  369. const position = { x: -2.28, y: -0.91, z: -5.68 };
  370. await animateCamera(
  371. oldCameraPosition,
  372. { x: -2.27, y: -0.91, z: -5.67 },
  373. { x: 66.257, y: 57.539, z: 94.313 },
  374. { x: position.x, y: position.y, z: position.z },
  375. model,
  376. 0.6
  377. );
  378. }, 300);
  379. } else if (fmType === 'fmWindow' && fmWindow && fmWindow.group) {
  380. if (fmWindow.clipActionArr.frontDoor && fmWindow.clipActionArr.backDoor) {
  381. fmWindow.clipActionArr.frontDoor.reset();
  382. fmWindow.clipActionArr.frontDoor.time = 0.5;
  383. fmWindow.clipActionArr.backDoor.reset();
  384. fmWindow.clipActionArr.backDoor.time = 0.5;
  385. fmWindow.clipActionArr.frontDoor.stop();
  386. fmWindow.clipActionArr.backDoor.stop();
  387. }
  388. model.startAnimation = fmWindow.render.bind(fmWindow);
  389. model.scene.remove(group);
  390. group = fmWindow.group;
  391. const oldCameraPosition = { x: -761, y: 569, z: 871 };
  392. setTimeout(async () => {
  393. resolve(null);
  394. model.scene.add(fmWindow.group);
  395. const position = { x: -2.28, y: -0.91, z: -5.68 };
  396. await animateCamera(
  397. oldCameraPosition,
  398. { x: -2.27, y: -0.91, z: -5.67 },
  399. { x: 66.257, y: 57.539, z: 94.313 },
  400. { x: position.x, y: position.y, z: position.z },
  401. model,
  402. 0.6
  403. );
  404. }, 300);
  405. } else if (fmType === 'fmWindowHjg' && fmWindowHjg && fmWindowHjg.group) {
  406. if (fmWindowHjg.clipActionArr.frontDoor && fmWindowHjg.clipActionArr.backDoor) {
  407. fmWindowHjg.clipActionArr.frontDoor.reset();
  408. fmWindowHjg.clipActionArr.frontDoor.time = 0.5;
  409. fmWindowHjg.clipActionArr.backDoor.reset();
  410. fmWindowHjg.clipActionArr.backDoor.time = 0.5;
  411. fmWindowHjg.clipActionArr.frontDoor.stop();
  412. fmWindowHjg.clipActionArr.backDoor.stop();
  413. }
  414. model.startAnimation = fmWindowHjg.render.bind(fmWindowHjg);
  415. model.scene.remove(group);
  416. group = fmWindowHjg.group;
  417. const oldCameraPosition = { x: -761, y: 569, z: 871 };
  418. setTimeout(async () => {
  419. resolve(null);
  420. model.scene.add(fmWindowHjg.group);
  421. const position = { x: -2.28, y: -0.91, z: -5.68 };
  422. await animateCamera(
  423. oldCameraPosition,
  424. { x: -2.27, y: -0.91, z: -5.67 },
  425. { x: 66.257, y: 57.539, z: 94.313 },
  426. { x: position.x, y: position.y, z: position.z },
  427. model,
  428. 0.6
  429. );
  430. }, 300);
  431. } else if (fmType === 'fmWindowZhq' && fmWindowZhq && fmWindowZhq.group) {
  432. if (fmWindowZhq.clipActionArr.frontDoor && fmWindowZhq.clipActionArr.backDoor) {
  433. fmWindowZhq.clipActionArr.frontDoor.reset();
  434. fmWindowZhq.clipActionArr.frontDoor.time = 0.5;
  435. fmWindowZhq.clipActionArr.backDoor.reset();
  436. fmWindowZhq.clipActionArr.backDoor.time = 0.5;
  437. fmWindowZhq.clipActionArr.frontDoor.stop();
  438. fmWindowZhq.clipActionArr.backDoor.stop();
  439. }
  440. model.startAnimation = fmWindowZhq.render.bind(fmWindowZhq);
  441. model.scene.remove(group);
  442. group = fmWindowZhq.group;
  443. const oldCameraPosition = { x: -761, y: 569, z: 871 };
  444. setTimeout(async () => {
  445. resolve(null);
  446. model.scene.add(fmWindowZhq.group);
  447. const position = { x: -2.28, y: -0.91, z: -5.68 };
  448. await animateCamera(
  449. oldCameraPosition,
  450. { x: -2.27, y: -0.91, z: -5.67 },
  451. { x: 66.257, y: 57.539, z: 94.313 },
  452. { x: position.x, y: position.y, z: position.z },
  453. model,
  454. 0.6
  455. );
  456. }, 300);
  457. } else if (fmType === 'fm_fc_bd' && fmDcBd && fmDcBd.group) {
  458. if (fmDcBd.frontClipAction) {
  459. fmDcBd.frontClipAction.reset();
  460. fmDcBd.frontClipAction.time = 0.5;
  461. fmDcBd.frontClipAction.stop();
  462. }
  463. model.startAnimation = fmDcBd.render.bind(fmDcBd);
  464. model.scene.remove(group);
  465. group = fmDcBd.group;
  466. const oldCameraPosition = { x: -761, y: 569, z: 871 };
  467. setTimeout(async () => {
  468. resolve(null);
  469. model.scene.add(fmDcBd.group);
  470. const position = { x: -2.28, y: -0.91, z: -5.68 };
  471. await animateCamera(
  472. oldCameraPosition,
  473. { x: -2.27, y: -0.91, z: -5.67 },
  474. { x: 66.257, y: 57.539, z: 94.313 },
  475. { x: position.x, y: position.y, z: position.z },
  476. model,
  477. 0.6
  478. );
  479. }, 300);
  480. } else if (fmType === 'fm_fc_ssl' && fm_fc_ssl && fm_fc_ssl.group) {
  481. if (fm_fc_ssl.frontClipAction) {
  482. fm_fc_ssl.frontClipAction.reset();
  483. fm_fc_ssl.frontClipAction.time = 0.5;
  484. fm_fc_ssl.frontClipAction.stop();
  485. }
  486. model.startAnimation = fm_fc_ssl.render.bind(fm_fc_ssl);
  487. model.scene.remove(group);
  488. group = fm_fc_ssl.group;
  489. const oldCameraPosition = { x: -761, y: 569, z: 871 };
  490. setTimeout(async () => {
  491. resolve(null);
  492. model.scene.add(fm_fc_ssl.group);
  493. const position = { x: -2.28, y: -0.91, z: -5.68 };
  494. await animateCamera(
  495. oldCameraPosition,
  496. { x: -2.27, y: -0.91, z: -5.67 },
  497. { x: 66.257, y: 57.539, z: 94.313 },
  498. { x: position.x, y: position.y, z: position.z },
  499. model,
  500. 0.6
  501. );
  502. }, 300);
  503. } else if (fmType === 'fmThreeTl' && fmThreeTl && fmThreeTl.group) {
  504. if (fmThreeTl.clipActionArr.frontDoor && fmThreeTl.clipActionArr.backDoor && fmThreeTl.clipActionArr.centerDoor) {
  505. fmThreeTl.clipActionArr.frontDoor.reset();
  506. fmThreeTl.clipActionArr.frontDoor.time = 0.5;
  507. fmThreeTl.clipActionArr.backDoor.reset();
  508. fmThreeTl.clipActionArr.backDoor.time = 0.5;
  509. fmThreeTl.clipActionArr.centerDoor.reset();
  510. fmThreeTl.clipActionArr.centerDoor.time = 0.5;
  511. fmThreeTl.clipActionArr.frontDoor.stop();
  512. fmThreeTl.clipActionArr.backDoor.stop();
  513. fmThreeTl.clipActionArr.centerDoor.stop();
  514. }
  515. if (fmThreeTl.frontDamperOpenMesh) fmThreeTl.frontDamperOpenMesh.visible = false;
  516. if (fmThreeTl.frontDamperClosedMesh) fmThreeTl.frontDamperClosedMesh.visible = true;
  517. if (fmThreeTl.centerDamperOpenMesh) fmThreeTl.centerDamperOpenMesh.visible = false;
  518. if (fmThreeTl.centerDamperClosedMesh) fmThreeTl.centerDamperClosedMesh.visible = true;
  519. if (fmThreeTl.backDamperOpenMesh) fmThreeTl.backDamperOpenMesh.visible = false;
  520. if (fmThreeTl.backDamperClosedMesh) fmThreeTl.backDamperClosedMesh.visible = true;
  521. // 显示单道风窗
  522. model.startAnimation = fmThreeTl.render.bind(fmThreeTl);
  523. model.scene.remove(group);
  524. group = fmThreeTl.group;
  525. const oldCameraPosition = { x: -761, y: 569, z: 871 };
  526. setTimeout(async () => {
  527. resolve(null);
  528. model.scene.add(fmThreeTl.group);
  529. const position = { x: 31.873075535732386, y: -3.501715880262631, z: -15.490295891616942 };
  530. await animateCamera(
  531. oldCameraPosition,
  532. { x: -2.27, y: -0.91, z: -5.67 },
  533. { x: 88.60102093060523, y: 53.89462381404774, z: 109.90762232602137 },
  534. { x: position.x, y: position.y, z: position.z },
  535. model,
  536. 0.6
  537. );
  538. }, 300);
  539. } else if (fmType === 'fm3' && fm3 && fm3.group) {
  540. if (fm3.clipActionArr.frontDoor && fm3.clipActionArr.backDoor) {
  541. fm3.clipActionArr.frontDoor.reset();
  542. fm3.clipActionArr.frontDoor.time = 0.5;
  543. fm3.clipActionArr.backDoor.reset();
  544. fm3.clipActionArr.backDoor.time = 0.5;
  545. fm3.clipActionArr.frontDoor.stop();
  546. fm3.clipActionArr.backDoor.stop();
  547. }
  548. if (fm3.frontDamperOpenMesh) fm3.frontDamperOpenMesh.visible = false;
  549. if (fm3.frontDamperClosedMesh) fm3.frontDamperClosedMesh.visible = true;
  550. if (fm3.backDamperOpenMesh) fm3.backDamperOpenMesh.visible = false;
  551. if (fm3.backDamperClosedMesh) fm3.backDamperClosedMesh.visible = true;
  552. model.scene.remove(group);
  553. model.startAnimation = fm3.render.bind(fm3);
  554. group = fm3.group;
  555. group.rotation.y = 0;
  556. const oldCameraPosition = { x: -1000, y: 100, z: 500 };
  557. setTimeout(async () => {
  558. resolve(null);
  559. model.scene.add(fm3.group);
  560. await animateCamera(
  561. oldCameraPosition,
  562. { x: 0, y: 0, z: 0 },
  563. { x: 50.99, y: 69.32, z: 93.61 },
  564. { x: -10.04, y: -14.38, z: -31.4 },
  565. model,
  566. 0.8
  567. );
  568. }, 300);
  569. } else if (fmType === 'fmXr' && fmXr && fmXr.group) {
  570. if (fmXr.clipActionArr.frontDoor && fmXr.clipActionArr.backDoor) {
  571. fmXr.clipActionArr.frontDoor.reset();
  572. fmXr.clipActionArr.frontDoor.time = 0.5;
  573. fmXr.clipActionArr.backDoor.reset();
  574. fmXr.clipActionArr.backDoor.time = 0.5;
  575. fmXr.clipActionArr.frontDoor.stop();
  576. fmXr.clipActionArr.backDoor.stop();
  577. }
  578. if (fmXr.frontDamperOpenMesh) fmXr.frontDamperOpenMesh.visible = false;
  579. if (fmXr.frontDamperClosedMesh) fmXr.frontDamperClosedMesh.visible = true;
  580. if (fmXr.backDamperOpenMesh) fmXr.backDamperOpenMesh.visible = false;
  581. if (fmXr.backDamperClosedMesh) fmXr.backDamperClosedMesh.visible = true;
  582. model.startAnimation = fmXr.render.bind(fmXr);
  583. model.scene.remove(group);
  584. group = fmXr.group;
  585. group.rotation.y = 0;
  586. const oldCameraPosition = { x: -1000, y: 100, z: 500 };
  587. setTimeout(async () => {
  588. resolve(null);
  589. model.scene.add(fmXr.group);
  590. await animateCamera(
  591. oldCameraPosition,
  592. { x: 0, y: 0, z: 0 },
  593. { x: 50.99, y: 69.32, z: 93.61 },
  594. { x: -10.04, y: -14.38, z: -31.4 },
  595. model,
  596. 0.8
  597. );
  598. }, 300);
  599. } else if (fmType === 'fmTwoSs' && fmTwoSs && fmTwoSs.group) {
  600. if (fmTwoSs.clipActionArr.frontDoor && fmTwoSs.clipActionArr.backDoor) {
  601. fmTwoSs.clipActionArr.frontDoor.reset();
  602. fmTwoSs.clipActionArr.frontDoor.time = 0.5;
  603. fmTwoSs.clipActionArr.backDoor.reset();
  604. fmTwoSs.clipActionArr.backDoor.time = 0.5;
  605. fmTwoSs.clipActionArr.frontDoor.stop();
  606. fmTwoSs.clipActionArr.backDoor.stop();
  607. }
  608. if (fmTwoSs.frontDamperOpenMesh) fmTwoSs.frontDamperOpenMesh.visible = false;
  609. if (fmTwoSs.frontDamperClosedMesh) fmTwoSs.frontDamperClosedMesh.visible = true;
  610. if (fmTwoSs.backDamperOpenMesh) fmTwoSs.backDamperOpenMesh.visible = false;
  611. if (fmTwoSs.backDamperClosedMesh) fmTwoSs.backDamperClosedMesh.visible = true;
  612. model.startAnimation = fmTwoSs.render.bind(fmTwoSs);
  613. model.scene.remove(group);
  614. group = fmTwoSs.group;
  615. group.rotation.y = 0;
  616. const oldCameraPosition = { x: -1000, y: 100, z: 500 };
  617. setTimeout(async () => {
  618. resolve(null);
  619. model.scene.add(fmTwoSs.group);
  620. await animateCamera(
  621. oldCameraPosition,
  622. { x: 0, y: 0, z: 0 },
  623. { x: 50.99, y: 69.32, z: 93.61 },
  624. { x: -10.04, y: -14.38, z: -31.4 },
  625. model,
  626. 0.8
  627. );
  628. }, 300);
  629. } else if (fmType === 'fmHsw3' && fmHsw3 && fmHsw3.group) {
  630. if (fmHsw3.clipActionArr.frontDoor && fmHsw3.clipActionArr.backDoor) {
  631. fmHsw3.clipActionArr.frontDoor.reset();
  632. fmHsw3.clipActionArr.frontDoor.time = 0.5;
  633. fmHsw3.clipActionArr.backDoor.reset();
  634. fmHsw3.clipActionArr.backDoor.time = 0.5;
  635. fmHsw3.clipActionArr.frontDoor.stop();
  636. fmHsw3.clipActionArr.backDoor.stop();
  637. }
  638. if (fmHsw3.frontDamperOpenMesh) fmHsw3.frontDamperOpenMesh.visible = false;
  639. if (fmHsw3.frontDamperClosedMesh) fmHsw3.frontDamperClosedMesh.visible = true;
  640. if (fmHsw3.backDamperOpenMesh) fmHsw3.backDamperOpenMesh.visible = false;
  641. if (fmHsw3.backDamperClosedMesh) fmHsw3.backDamperClosedMesh.visible = true;
  642. model.startAnimation = fmHsw3.render.bind(fmHsw3);
  643. model.scene.remove(group);
  644. group = fmHsw3.group;
  645. group.rotation.y = 0;
  646. const oldCameraPosition = { x: -1000, y: 100, z: 500 };
  647. setTimeout(async () => {
  648. resolve(null);
  649. model.scene.add(fmHsw3.group);
  650. await animateCamera(
  651. oldCameraPosition,
  652. { x: 0, y: 0, z: 0 },
  653. { x: 50.99, y: 69.32, z: 93.61 },
  654. { x: -10.04, y: -14.38, z: -31.4 },
  655. model,
  656. 0.8
  657. );
  658. }, 300);
  659. } else if (fmType === 'fmYjXr' && fmYjXr && fmYjXr.group) {
  660. if (fmYjXr.clipActionArr.frontDoor && fmYjXr.clipActionArr.backDoor) {
  661. fmYjXr.clipActionArr.frontDoor.reset();
  662. fmYjXr.clipActionArr.frontDoor.time = 0.5;
  663. fmYjXr.clipActionArr.backDoor.reset();
  664. fmYjXr.clipActionArr.backDoor.time = 0.5;
  665. fmYjXr.clipActionArr.frontDoor.stop();
  666. fmYjXr.clipActionArr.backDoor.stop();
  667. }
  668. if (fmYjXr.frontDamperOpenMesh) fmYjXr.frontDamperOpenMesh.visible = false;
  669. if (fmYjXr.frontDamperClosedMesh) fmYjXr.frontDamperClosedMesh.visible = true;
  670. if (fmYjXr.backDamperOpenMesh) fmYjXr.backDamperOpenMesh.visible = false;
  671. if (fmYjXr.backDamperClosedMesh) fmYjXr.backDamperClosedMesh.visible = true;
  672. model.startAnimation = fmYjXr.render.bind(fmYjXr);
  673. model.scene.remove(group);
  674. group = fmYjXr.group;
  675. group.rotation.y = 0;
  676. const oldCameraPosition = { x: -1000, y: 100, z: 500 };
  677. setTimeout(async () => {
  678. resolve(null);
  679. model.scene.add(fmYjXr.group);
  680. await animateCamera(
  681. oldCameraPosition,
  682. { x: 0, y: 0, z: 0 },
  683. { x: 50.99, y: 69.32, z: 93.61 },
  684. { x: -10.04, y: -14.38, z: -31.4 },
  685. model,
  686. 0.8
  687. );
  688. }, 300);
  689. } else if (fmType === 'fmYj' && fmYj && fmYj.group) {
  690. if (fmYj.clipActionArr.frontDoor && fmYj.clipActionArr.backDoor) {
  691. fmYj.clipActionArr.frontDoor.reset();
  692. fmYj.clipActionArr.frontDoor.time = 0.5;
  693. fmYj.clipActionArr.backDoor.reset();
  694. fmYj.clipActionArr.backDoor.time = 0.5;
  695. fmYj.clipActionArr.frontDoor.stop();
  696. fmYj.clipActionArr.backDoor.stop();
  697. }
  698. if (fmYj.frontDamperOpenMesh) fmYj.frontDamperOpenMesh.visible = false;
  699. if (fmYj.frontDamperClosedMesh) fmYj.frontDamperClosedMesh.visible = true;
  700. if (fmYj.backDamperOpenMesh) fmYj.backDamperOpenMesh.visible = false;
  701. if (fmYj.backDamperClosedMesh) fmYj.backDamperClosedMesh.visible = true;
  702. model.startAnimation = fmYj.render.bind(fmYj);
  703. model.scene.remove(group);
  704. group = fmYj.group;
  705. group.rotation.y = 0;
  706. const oldCameraPosition = { x: -1000, y: 100, z: 500 };
  707. setTimeout(async () => {
  708. resolve(null);
  709. model.scene.add(fmYj.group);
  710. await animateCamera(
  711. oldCameraPosition,
  712. { x: 0, y: 0, z: 0 },
  713. { x: 50.99, y: 69.32, z: 93.61 },
  714. { x: -10.04, y: -14.38, z: -31.4 },
  715. model,
  716. 0.8
  717. );
  718. }, 300);
  719. } else if (fmType === 'fmSp1' && fmSp1 && fmSp1.group) {
  720. if (fmSp1.clipActionArr.frontDoor) {
  721. fmSp1.clipActionArr.frontDoor.reset();
  722. fmSp1.clipActionArr.frontDoor.time = 0.5;
  723. fmSp1.clipActionArr.frontDoor.stop();
  724. }
  725. if (fmSp1.frontDamperOpenMesh) fmSp1.frontDamperOpenMesh.visible = false;
  726. if (fmSp1.frontDamperClosedMesh) fmSp1.frontDamperClosedMesh.visible = true;
  727. model.startAnimation = fmSp1.render.bind(fmSp1);
  728. model.scene.remove(group);
  729. group = fmSp1.group;
  730. group.rotation.y = 0;
  731. const oldCameraPosition = { x: -1000, y: 100, z: 500 };
  732. setTimeout(async () => {
  733. resolve(null);
  734. model.scene.add(fmSp1.group);
  735. await animateCamera(
  736. oldCameraPosition,
  737. { x: 0, y: 0, z: 0 },
  738. { x: 50.99, y: 69.32, z: 93.61 },
  739. { x: -10.04, y: -14.38, z: -31.4 },
  740. model,
  741. 0.8
  742. );
  743. }, 300);
  744. } else if (fmType === 'fmSsl' && fmSsl && fmSsl.group) {
  745. if (fmSsl.clipActionArr.frontDoor) {
  746. fmSsl.clipActionArr.frontDoor.reset();
  747. fmSsl.clipActionArr.frontDoor.time = 0.5;
  748. fmSsl.clipActionArr.frontDoor.stop();
  749. }
  750. if (fmSsl.clipActionArr.backDoor) {
  751. fmSsl.clipActionArr.backDoor.reset();
  752. fmSsl.clipActionArr.backDoor.time = 0.5;
  753. fmSsl.clipActionArr.backDoor.stop();
  754. }
  755. model.startAnimation = fmSsl.render.bind(fmSsl);
  756. model.scene.remove(group);
  757. group = fmSsl.group;
  758. group.rotation.y = 0;
  759. const oldCameraPosition = { x: -1000, y: 100, z: 500 };
  760. setTimeout(async () => {
  761. resolve(null);
  762. model.scene.add(fmSsl.group);
  763. await animateCamera(
  764. oldCameraPosition,
  765. { x: 0, y: 0, z: 0 },
  766. { x: 50.99, y: 69.32, z: 93.61 },
  767. { x: -10.04, y: -14.38, z: -31.4 },
  768. model,
  769. 0.8
  770. );
  771. }, 300);
  772. }
  773. });
  774. };
  775. export const initCameraCanvas = async (playerVal1) => {
  776. if (!model) return;
  777. if (fmType === 'fm1' && fm1) {
  778. return await fm1.initCamera.call(fm1, playerVal1);
  779. } else if (fmType === 'fm2' && fm2) {
  780. return fm2.initCamera.call(fm2, playerVal1);
  781. } else if (fmType === 'fm3' && fm3) {
  782. return fm3.initCamera.call(fm3, playerVal1);
  783. } else if (fmType === 'fmXr' && fmXr) {
  784. return fmXr.initCamera.call(fmXr, playerVal1);
  785. }
  786. };
  787. const loadModel = (code): Promise<any> => {
  788. if (code === 'Fm1') return import('./gate.threejs.yy').then((r) => r.default);
  789. if (code === 'Fm3') return import('./gate.threejs.qd').then((r) => r.default);
  790. if (code === 'FmXR') return import('./gate.threejs.xr').then((r) => r.default);
  791. if (code === 'Fm2') return import('./gate.threejs.three').then((r) => r.default);
  792. if (code === 'FmTwoSs') return import('./gate.threejs.two.ss').then((r) => r.default);
  793. if (code === 'FmThreeTl') return import('./gate.threejs.three.tl').then((r) => r.default);
  794. if (code === 'FmDc') return import('./gate.threejs.window').then((r) => r.default);
  795. if (code === 'FmDcHJG') return import('./gate.threejs.window.hjg').then((r) => r.default);
  796. if (code === 'FmDcZHQ') return import('./gate.threejs.window.zhq').then((r) => r.default);
  797. if (code === 'FmHsw3') return import('./gate.threejs.three.hsw').then((r) => r.default);
  798. if (code === 'FmYjXr') return import('./gate.threejs.two.yj').then((r) => r.default); // 姚街行人
  799. if (code === 'FmYj') return import('./gate.threejs.yj').then((r) => r.default); // 姚街
  800. if (code === 'FmSp1') return import('./gate.threejs.one.sp').then((r) => r.default);
  801. if (code === 'fmDcBd') return import('./dandaoFcBd3.threejs').then((r) => r.default);
  802. if (code === 'fmSsl') return import('./gate.threejs.two.ssl').then((r) => r.default);
  803. if (code === 'fm_fc_ssl') return import('./gate.threejs.tj.ssl').then((r) => r.default);
  804. return import('./gate.threejs.yy').then((r) => r.default);
  805. };
  806. export const mountedThree = () => {
  807. // const { sysOrgCode } = useGlobSetting();
  808. // const sysOrgCode = 'gsgszdek';
  809. return new Promise(async (resolve) => {
  810. model = new UseThree('#damper3D', '', '#deviceDetail');
  811. model.setEnvMap('test1.hdr');
  812. model.renderer.toneMappingExposure = 0.9;
  813. model.camera.position.set(100, 0, 1000);
  814. const store = useModelFileStore();
  815. const storeData = store.getModelFileDataByKey('gate');
  816. const dictCodes = storeData.length ? storeData.map((item) => ({ ...item, value: item.fileName })) : getDictItemsByCode('gateStyle');
  817. if (dictCodes && dictCodes.length > 0) {
  818. for (let i = 0; i < dictCodes.length; i++) {
  819. const dict = dictCodes[i];
  820. switch (dict.value) {
  821. case 'fmXr':
  822. const FmXR = await loadModel('FmXR');
  823. fmXr = new FmXR(model);
  824. fmXr.mountedThree();
  825. break;
  826. case 'fmYy':
  827. const Fm1 = await loadModel('Fm1');
  828. fm1 = new Fm1(model);
  829. fm1.mountedThree();
  830. break;
  831. case 'gate_qd':
  832. const Fm3 = await loadModel('Fm3');
  833. fm3 = new Fm3(model);
  834. await fm3.mountedThree();
  835. break;
  836. case 'fmSs':
  837. const FmTwoSs = await loadModel('FmTwoSs');
  838. fmTwoSs = new FmTwoSs(model);
  839. await fmTwoSs.mountedThree();
  840. break;
  841. case 'fmtl3':
  842. const FmThreeTl = await loadModel('FmThreeTl');
  843. fmThreeTl = new FmThreeTl(model);
  844. await fmThreeTl.mountedThree();
  845. break;
  846. case 'fmSs3':
  847. const Fm2 = await loadModel('Fm2');
  848. fm2 = new Fm2(model);
  849. await fm2.mountedThree();
  850. break;
  851. case 'fm_fc_hjg':
  852. const FmDcHJG = await loadModel('FmDcHJG');
  853. fmWindowHjg = new FmDcHJG(model);
  854. await fmWindowHjg.mountedThree();
  855. break;
  856. case 'fm_fc':
  857. const FmDc = await loadModel('FmDc');
  858. fmWindow = new FmDc(model);
  859. await fmWindow.mountedThree();
  860. break;
  861. case 'fm_fc_zhq': //fmWindowZhq
  862. const FmDcZHQ = await loadModel('FmDcZHQ');
  863. fmWindowZhq = new FmDcZHQ(model);
  864. await fmWindowZhq.mountedThree();
  865. break;
  866. case 'fmHsw3':
  867. const FmHsw3 = await loadModel('FmHsw3');
  868. fmHsw3 = new FmHsw3(model);
  869. await fmHsw3.mountedThree();
  870. break;
  871. case 'fmYjXr':
  872. const FmYjXr = await loadModel('FmYjXr');
  873. fmYjXr = new FmYjXr(model);
  874. await fmYjXr.mountedThree();
  875. break;
  876. case 'fmYj':
  877. const FmYj = await loadModel('FmYj');
  878. fmYj = new FmYj(model);
  879. await fmYj.mountedThree();
  880. break;
  881. case 'fmSp1':
  882. const FmSp1 = await loadModel('FmSp1');
  883. fmSp1 = new FmSp1(model);
  884. await fmSp1.mountedThree();
  885. break;
  886. case 'fm_fc_bd':
  887. const FmDcBd = await loadModel('fmDcBd');
  888. fmDcBd = new FmDcBd(model);
  889. await fmDcBd.mountedThree();
  890. break;
  891. case 'fmSsl':
  892. const FmSsl = await loadModel('fmSsl');
  893. fmSsl = new FmSsl(model);
  894. await fmSsl.mountedThree();
  895. break;
  896. case 'fm_fc_ssl':
  897. const Fm_fc_ssl = await loadModel('fm_fc_ssl');
  898. fm_fc_ssl = new Fm_fc_ssl(model);
  899. await fm_fc_ssl.mountedThree();
  900. break;
  901. }
  902. }
  903. resolve(null);
  904. } else {
  905. const Fm3 = await loadModel('Fm3');
  906. fm3 = new Fm3(model);
  907. fm3.mountedThree();
  908. const FmTwoSs = await loadModel('FmTwoSs');
  909. fmTwoSs = new FmTwoSs(model);
  910. fmTwoSs.mountedThree();
  911. const Fm2 = await loadModel('Fm2');
  912. fm2 = new Fm2(model);
  913. fm2.mountedThree();
  914. // 三道门
  915. const FmThreeTl = await loadModel('FmThreeTl');
  916. fmThreeTl = new FmThreeTl(model);
  917. if (fmThreeTl) fmThreeTl.mountedThree();
  918. const FmXR = await loadModel('FmXR');
  919. fmXr = new FmXR(model);
  920. fmXr.mountedThree();
  921. // 液压风门
  922. const Fm1 = await loadModel('Fm1');
  923. fm1 = new Fm1(model);
  924. fm1.mountedThree();
  925. resolve(null);
  926. }
  927. model.animate();
  928. // generateThumbnailsBySwitch();
  929. // startAnimation();
  930. });
  931. };
  932. export const destroy = () => {
  933. if (model) {
  934. model.isRender = false;
  935. if (fm1) fm1.destroy();
  936. if (fm2) fm2.destroy();
  937. if (fm3) fm3.destroy();
  938. if (fmXr) fmXr.destroy();
  939. if (fmTwoSs) fmTwoSs.destroy();
  940. if (fmWindowHjg) fmWindowHjg.destroy();
  941. if (fmWindowZhq) fmWindowZhq.destroy();
  942. if (fmWindow) fmWindow.destroy();
  943. if (fmThreeTl) fmThreeTl.destroy();
  944. if (fmHsw3) fmHsw3.destroy();
  945. if (fmYjXr) fmYjXr.destroy();
  946. if (fmYj) fmYj.destroy();
  947. if (fmSp1) fmSp1.destroy();
  948. if (fmDcBd) fmDcBd.destroy();
  949. if (fm_fc_ssl) fm_fc_ssl.destroy();
  950. fm1 = null;
  951. fm2 = null;
  952. fm3 = null;
  953. fmXr = null;
  954. fmWindow = null;
  955. fmWindowHjg = null;
  956. fmWindowZhq = null;
  957. fmThreeTl = null;
  958. fmTwoSs = null;
  959. fmHsw3 = null;
  960. fmYjXr = null;
  961. fmYj = null;
  962. fmSp1 = null;
  963. fmDcBd = null;
  964. fm_fc_ssl = null;
  965. group = null;
  966. model.mixers = [];
  967. model.destroy();
  968. }
  969. model = null;
  970. };