gate.threejs.ts 38 KB

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