window.threejs.ts 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542
  1. import * as THREE from 'three';
  2. import UseThree from '../../../../utils/threejs/useThree';
  3. import ddFc_5 from './dandaoFc.threejs'; // ddFc_5 单道-大窗2列扇叶
  4. import singleWindowXk from './dandaoFcXk.threejs';
  5. import ddFc_1 from './dandaoFcYjl.threejs'; // ddFc_1 单道_小窗两列扇叶
  6. import sdFc_1 from './shuangdaoFc.threejs'; // sdFc_1 双道-带小门
  7. import sdFc_3 from './shuangdaoFcBlt.threejs'; // sdFc_3 双道-带小门-小窗
  8. import sdFc_4 from './shuangdaoFcHj.threejs'; // sdFc_4 双道-带门-卷闸
  9. import sdFc_2 from './shuangdaoFcSw.threejs'; // sdFc_2 单道-带小门-2个窗
  10. import sdFc_5 from './shuangdaoFcYjl.threejs'; // sdFc_5 双道-小门(侧边下)-小窗(榆家梁)
  11. import ddFc_4 from './dandaoFcBd1.threejs'; // ddFc_4 单道-一个小窗两列扇叶
  12. import ddFc_2 from './dandaoFcBd2.threejs'; // ddFc_2 单道-一个大窗两列竖型扇叶
  13. import ddFc_6 from './dandaoFcHjt.threejs'; // ddFc_6 单道-大窗1列扇叶(活鸡兔)
  14. import ddFc_7 from './dandaoFcBd3.threejs'; // ddFc_6 单道-大窗1列扇叶(活鸡兔)
  15. import threeFc_8 from './sandaoFc.threejs'; // ddFc_8 三道-大窗2列门式扇叶(三道沟)
  16. import ddFc_lt from './dandaoFcLt.threejs';
  17. import SdFcZhq from './shuangdaoFcZhq.threejs';
  18. import { animateCamera } from '/@/utils/threejs/util';
  19. import useEvent from '../../../../utils/threejs/useEvent';
  20. import { getDictItemsByCode } from '/@/utils/dict';
  21. // import * as dat from 'dat.gui';
  22. // const gui = new dat.GUI();
  23. // gui.domElement.style = 'position:absolute;top:100px;left:10px;z-index:99999999999999';
  24. // 模型对象、 文字对象
  25. let model: UseThree,
  26. ddFc5: ddFc_5,
  27. ddFc1: ddFc_1,
  28. sdFc1: sdFc_1,
  29. sdFc3: sdFc_3,
  30. sdFc4: sdFc_4,
  31. sdFc2: sdFc_2,
  32. sdFc5: sdFc_5,
  33. ddFc2: ddFc_2,
  34. ddFc4: ddFc_4,
  35. ddFc6: ddFc_6,
  36. ddFc7: ddFc_7,
  37. ddFc8: ddFc_lt,
  38. threeFc8: threeFc_8,
  39. sdFcZhq: SdFcZhq,
  40. singleWindowXkObj: singleWindowXk,
  41. group: THREE.Object3D,
  42. windowType = 'ddFc1';
  43. const rotationParam = {
  44. frontDeg0: 0, // 前门初始
  45. frontDeg1: 0, // 前门目标
  46. centerDeg0: 0, // 前门初始
  47. centerDeg1: 0, // 前门目标
  48. backDeg0: 0, // 后门初始
  49. backDeg1: 0, // 后门目标
  50. };
  51. const { mouseDownFn } = useEvent();
  52. // 初始化左右摇摆动画
  53. const startAnimation = () => {
  54. // 定义鼠标点击事件
  55. model.canvasContainer?.addEventListener('mousedown', mouseEvent.bind(null));
  56. model.canvasContainer?.addEventListener('pointerup', (event) => {
  57. event.stopPropagation();
  58. // 单道、 双道
  59. if (windowType === 'ddFc5' && ddFc5) {
  60. ddFc5.mouseUpModel.call(ddFc5);
  61. } else if (windowType === 'ddFc1' && ddFc1) {
  62. ddFc1.mouseUpModel.call(ddFc1);
  63. } else if (windowType === 'ddFc2' && ddFc2) {
  64. ddFc2.mouseUpModel.call(ddFc2);
  65. } else if (windowType === 'ddFc4' && ddFc4) {
  66. ddFc4.mouseUpModel.call(ddFc4);
  67. } else if (windowType === 'ddFc6' && ddFc6) {
  68. ddFc6.mouseUpModel.call(ddFc6);
  69. } else if (windowType === 'ddFc7' && ddFc7) {
  70. ddFc7.mouseUpModel.call(ddFc7);
  71. } else if (windowType === 'ddFc8' && ddFc8) {
  72. ddFc8.mouseUpModel.call(ddFc8);
  73. } else if (windowType === 'sdFc1' && sdFc1) {
  74. sdFc1.mouseUpModel.call(sdFc1);
  75. } else if (windowType === 'sdFc3' && sdFc3) {
  76. sdFc3.mouseUpModel.call(sdFc3);
  77. } else if (windowType === 'sdFc4' && sdFc4) {
  78. sdFc4.mouseUpModel.call(sdFc4);
  79. } else if (windowType === 'sdFc2' && sdFc2) {
  80. sdFc2.mouseUpModel.call(sdFc2);
  81. } else if (windowType === 'sdFc5' && sdFc5) {
  82. sdFc5.mouseUpModel.call(sdFc5);
  83. } else if (windowType === 'threeFc8' && threeFc8) {
  84. threeFc8.mouseUpModel.call(threeFc8);
  85. } else if (windowType === 'singleXkWindow' && singleWindowXkObj) {
  86. singleWindowXkObj.mouseUpModel.call(singleWindowXkObj);
  87. } else if (windowType === 'sdFcZhq' && sdFcZhq) {
  88. sdFcZhq.mouseUpModel();
  89. }
  90. });
  91. };
  92. // 鼠标点击、松开事件
  93. const mouseEvent = (event) => {
  94. if (!model) return;
  95. if (event.button == 0) {
  96. mouseDownFn(model, group, event, (intersects) => {
  97. if (windowType === 'ddFc5' && ddFc5) {
  98. ddFc5.mousedownModel.call(ddFc5, intersects);
  99. } else if (windowType === 'ddFc1' && ddFc1) {
  100. ddFc1.mousedownModel.call(ddFc1, intersects);
  101. } else if (windowType === 'ddFc2' && ddFc2) {
  102. ddFc2.mousedownModel.call(ddFc2, intersects);
  103. } else if (windowType === 'ddFc4' && ddFc4) {
  104. ddFc4.mousedownModel.call(ddFc4, intersects);
  105. } else if (windowType === 'ddFc6' && ddFc6) {
  106. ddFc6.mousedownModel.call(ddFc6, intersects);
  107. } else if (windowType === 'ddFc7' && ddFc7) {
  108. ddFc7.mousedownModel.call(ddFc7, intersects);
  109. } else if (windowType === 'ddFc8' && ddFc8) {
  110. ddFc8.mousedownModel.call(ddFc8, intersects);
  111. } else if (windowType === 'sdFc1' && sdFc1) {
  112. sdFc1.mousedownModel.call(sdFc1, intersects);
  113. } else if (windowType === 'sdFc3' && sdFc3) {
  114. sdFc3.mousedownModel.call(sdFc3, intersects);
  115. } else if (windowType === 'sdFc4' && sdFc4) {
  116. sdFc4.mousedownModel.call(sdFc4, intersects);
  117. } else if (windowType === 'sdFc2' && sdFc2) {
  118. sdFc2.mousedownModel.call(sdFc2, intersects);
  119. } else if (windowType === 'sdFc5' && sdFc5) {
  120. sdFc5.mousedownModel.call(sdFc5, intersects);
  121. } else if (windowType === 'threeFc8' && threeFc8) {
  122. threeFc8.mousedownModel(intersects);
  123. } else if (windowType === 'singleXkWindow' && singleWindowXkObj) {
  124. singleWindowXkObj.mousedownModel.call(singleWindowXkObj, intersects);
  125. } else if (windowType === 'sdFcZhq' && sdFcZhq) {
  126. sdFcZhq.mousedownModel(intersects);
  127. }
  128. });
  129. console.log('摄像头控制信息', model.orbitControls, model.camera);
  130. }
  131. };
  132. const addMouseEvent = () => {
  133. // 定义鼠标点击事件
  134. model.canvasContainer?.addEventListener('mousedown', mouseEvent.bind(null));
  135. // model.canvasContainer?.addEventListener('pointerup', mouseUp);
  136. };
  137. export const addMonitorText = (selectData) => {
  138. if (!model) return;
  139. if (windowType === 'ddFc5' && ddFc5) {
  140. return ddFc5.addMonitorText.call(ddFc5, selectData);
  141. } else if (windowType === 'ddFc1' && ddFc1) {
  142. return ddFc1.addMonitorText.call(ddFc1, selectData);
  143. } else if (windowType === 'ddFc2' && ddFc2) {
  144. return ddFc2.addMonitorText.call(ddFc2, selectData);
  145. } else if (windowType === 'ddFc4' && ddFc4) {
  146. return ddFc4.addMonitorText.call(ddFc4, selectData);
  147. } else if (windowType === 'ddFc6' && ddFc6) {
  148. return ddFc6.addMonitorText.call(ddFc6, selectData);
  149. } else if (windowType === 'ddFc7' && ddFc7) {
  150. return ddFc7.addMonitorText.call(ddFc7, selectData);
  151. } else if (windowType === 'ddFc8' && ddFc8) {
  152. return ddFc8.addMonitorText.call(ddFc8, selectData);
  153. } else if (windowType === 'sdFc1' && sdFc1) {
  154. return sdFc1.addMonitorText.call(sdFc1, selectData);
  155. } else if (windowType === 'sdFc3' && sdFc3) {
  156. return sdFc3.addMonitorText.call(sdFc3, selectData);
  157. } else if (windowType === 'sdFc4' && sdFc4) {
  158. return sdFc4.addMonitorText.call(sdFc4, selectData);
  159. } else if (windowType === 'sdFc2' && sdFc2) {
  160. return sdFc2.addMonitorText.call(sdFc2, selectData);
  161. } else if (windowType === 'sdFc5' && sdFc5) {
  162. return sdFc5.addMonitorText.call(sdFc5, selectData);
  163. } else if (windowType === 'threeFc8' && threeFc8) {
  164. return threeFc8.addMonitorText(selectData);
  165. } else if (windowType === 'singleXkWindow' && singleWindowXkObj) {
  166. return singleWindowXkObj.addMonitorText.call(singleWindowXkObj, selectData);
  167. } else if (windowType === 'sdFcZhq' && sdFcZhq) {
  168. sdFcZhq.addMonitorText(selectData);
  169. }
  170. };
  171. export function computePlay(data, maxarea, isFirst = false) {
  172. if (!model) return;
  173. const isJz = data.windowModal == 'sdFc4';
  174. if (windowType === 'singleXkWindow') {
  175. const acosToAngle = (cosValue) => {
  176. cosValue = Math.max(Math.min(cosValue, 1), -1);
  177. // 计算角度
  178. return Math.asin(cosValue) * (180 / Math.PI);
  179. };
  180. const sina = Math.sqrt((Math.sin((78 * Math.PI) / 180) ** 2 * parseFloat(data.forntArea)) / parseFloat(maxarea));
  181. const angleInRadians = acosToAngle(sina);
  182. rotationParam.frontDeg1 = angleInRadians;
  183. if (!rotationParam.frontDeg1 && !rotationParam.backDeg1) {
  184. // 当返回值有误时默认关闭
  185. play(rotationParam, 0);
  186. } else {
  187. setTimeout(() => {
  188. play(rotationParam, 1);
  189. }, 0);
  190. }
  191. } else {
  192. if (data.OpenDegree || data.OpenDegree1 || data.OpenDegree2 || data.OpenDegree3) {
  193. maxarea = 180;
  194. if (data.OpenDegree) {
  195. rotationParam.frontDeg0 = (180 / maxarea) * Number(isFirst ? 0 : data.OpenDegree);
  196. rotationParam.frontDeg1 = (180 / maxarea) * Number(data.OpenDegree) || 0;
  197. }
  198. if (data.OpenDegree1) {
  199. rotationParam.frontDeg0 = (180 / maxarea) * Number(isFirst ? 0 : data.OpenDegree1);
  200. rotationParam.frontDeg1 = (180 / maxarea) * Number(data.OpenDegree1) || 0;
  201. }
  202. if (data.OpenDegree2) {
  203. rotationParam.backDeg0 = (180 / maxarea) * Number(isFirst ? 0 : data.OpenDegree2);
  204. rotationParam.backDeg1 = (180 / maxarea) * Number(data.OpenDegree2) || 0;
  205. }
  206. if (data.OpenDegree3) {
  207. rotationParam.centerDeg0 = (180 / maxarea) * Number(isFirst ? 0 : data.OpenDegree3);
  208. rotationParam.centerDeg1 = (180 / maxarea) * Number(data.OpenDegree3) || 0;
  209. }
  210. } else {
  211. // 这里判断是扇叶模型还是卷闸模型,如果是卷闸模型时
  212. if (isJz) {
  213. rotationParam.frontDeg0 = 0;
  214. rotationParam.backDeg0 = 0;
  215. rotationParam.frontDeg1 = data.forntArea / maxarea;
  216. rotationParam.backDeg1 = data.rearArea / maxarea;
  217. } else {
  218. if (!maxarea) maxarea = 90;
  219. rotationParam.frontDeg0 = (90 / maxarea) * Number(isFirst ? 0 : data.forntArea);
  220. rotationParam.backDeg0 = (90 / maxarea) * Number(isFirst ? 0 : data.rearArea);
  221. rotationParam.frontDeg1 = (90 / maxarea) * Number(data.forntArea) || 0;
  222. rotationParam.backDeg1 = (90 / maxarea) * Number(data.rearArea) || 0;
  223. if (windowType == 'threeFc8') {
  224. rotationParam.centerDeg0 = (90 / maxarea) * Number(isFirst ? 0 : data.middleArea);
  225. rotationParam.centerDeg1 = (90 / maxarea) * Number(data.middleArea) || 0;
  226. }
  227. }
  228. }
  229. if (isJz) {
  230. play(1, { scaleY: data.frontArea / maxarea });
  231. play(2, { scaleY: data.rearArea / maxarea });
  232. play(3, { scaleY: data.frontArea3 / maxarea });
  233. play(4, { scaleY: data.frontArea4 / maxarea });
  234. } else {
  235. if (!rotationParam.frontDeg1 && !rotationParam.backDeg1) {
  236. // 当返回值有误时默认关闭
  237. play(rotationParam, 0);
  238. } else {
  239. setTimeout(() => {
  240. play(rotationParam, 1);
  241. }, 0);
  242. if (data.nwindownum == 2) {
  243. setTimeout(() => {
  244. play(rotationParam, 2);
  245. }, 0);
  246. }
  247. if (data.nwindownum == 3) {
  248. setTimeout(() => {
  249. play(rotationParam, 2);
  250. }, 0);
  251. setTimeout(() => {
  252. play(rotationParam, 3);
  253. }, 0);
  254. }
  255. }
  256. }
  257. }
  258. }
  259. export const play = (rotationParam, flag) => {
  260. if (!model) return;
  261. if (windowType === 'ddFc5' && ddFc5) {
  262. return ddFc5.play.call(ddFc5, rotationParam, flag);
  263. } else if (windowType === 'ddFc1' && ddFc1) {
  264. return ddFc1.play.call(ddFc1, rotationParam, flag);
  265. } else if (windowType === 'ddFc2' && ddFc2) {
  266. return ddFc2.play.call(ddFc2, rotationParam, flag);
  267. } else if (windowType === 'ddFc4' && ddFc4) {
  268. return ddFc4.play.call(ddFc4, rotationParam, flag);
  269. } else if (windowType === 'ddFc6' && ddFc6) {
  270. return ddFc6.play.call(ddFc6, rotationParam, flag);
  271. } else if (windowType === 'ddFc7' && ddFc7) {
  272. return ddFc7.play.call(ddFc7, rotationParam, flag);
  273. } else if (windowType === 'ddFc8' && ddFc8) {
  274. return ddFc8.play.call(ddFc8, rotationParam, flag);
  275. } else if (windowType === 'sdFc1' && sdFc1) {
  276. return sdFc1.play.call(sdFc1, rotationParam, flag);
  277. } else if (windowType === 'sdFc3' && sdFc3) {
  278. return sdFc3.play.call(sdFc3, rotationParam, flag);
  279. } else if (windowType === 'sdFc4' && sdFc4) {
  280. return sdFc4.play.call(sdFc4, rotationParam, flag);
  281. } else if (windowType === 'sdFc2' && sdFc2) {
  282. return sdFc2.play.call(sdFc2, rotationParam, flag);
  283. } else if (windowType === 'sdFc5' && sdFc5) {
  284. return sdFc5.play.call(sdFc5, rotationParam, flag);
  285. } else if (windowType === 'threeFc8' && threeFc8) {
  286. return threeFc8.play(rotationParam, flag);
  287. } else if (windowType === 'singleXkWindow' && singleWindowXkObj) {
  288. return singleWindowXkObj.play.call(singleWindowXkObj, rotationParam, flag);
  289. } else if (windowType === 'sdFcZhq' && sdFcZhq) {
  290. sdFcZhq.play(rotationParam, flag);
  291. }
  292. };
  293. // 切换风窗类型
  294. export const setModelType = (type) => {
  295. return new Promise((resolve) => {
  296. if (!model) resolve(null);
  297. windowType = type;
  298. const windowConfigurations = {
  299. sdFc1: {
  300. render: sdFc1 ? () => sdFc1.render() : null,
  301. group: sdFc1 ? sdFc1.group : null,
  302. newP: { x: 66.257, y: 57.539, z: 94.313 },
  303. newT: { x: 0, y: 0, z: 0 },
  304. },
  305. ddFc5: {
  306. render: ddFc5 ? () => ddFc5.render() : null,
  307. group: ddFc5 ? ddFc5.group : null,
  308. newP: { x: 66.257, y: 57.539, z: 94.313 },
  309. newT: { x: 0, y: 0, z: 0 },
  310. },
  311. ddFc6: {
  312. render: ddFc6 ? () => ddFc6.render() : null,
  313. group: ddFc6 ? ddFc6.group : null,
  314. newP: { x: 66.257, y: 57.539, z: 94.313 },
  315. newT: { x: 0, y: 0, z: 0 },
  316. },
  317. ddFc7: {
  318. render: ddFc7 ? () => ddFc7.render() : null,
  319. group: ddFc7 ? ddFc7.group : null,
  320. newP: { x: 66.257, y: 57.539, z: 94.313 },
  321. newT: { x: 0, y: 0, z: 0 },
  322. },
  323. ddFc8: {
  324. render: ddFc8 ? () => ddFc8.render() : null,
  325. group: ddFc8 ? ddFc8.group : null,
  326. newP: { x: 32.78, y: 64.88, z: 106.78 },
  327. newT: { x: -6.12, y: 13.27, z: -4.64 },
  328. },
  329. ddFc1: {
  330. render: ddFc1 ? () => ddFc1.render() : null,
  331. group: ddFc1 ? ddFc1.group : null,
  332. newP: { x: 34.294433107431956, y: 19.284123769585108, z: 47.717286013509835 },
  333. newT: { x: 12.311816240141978, y: -5.691930035759495, z: -5.57302688985693 },
  334. },
  335. ddFc2: {
  336. render: ddFc2 ? () => ddFc2.render() : null,
  337. group: ddFc2 ? ddFc2.group : null,
  338. newP: { x: 66.257, y: 57.539, z: 94.313 },
  339. newT: { x: 0, y: 0, z: 0 },
  340. },
  341. ddFc4: {
  342. render: ddFc4 ? () => ddFc4.render() : null,
  343. group: ddFc4 ? ddFc4.group : null,
  344. newP: { x: 66.257, y: 57.539, z: 94.313 },
  345. newT: { x: 0, y: 0, z: 0 },
  346. },
  347. sdFc3: {
  348. render: sdFc3 ? () => sdFc3.render() : null,
  349. group: sdFc3 ? sdFc3.group : null,
  350. newP: { x: 66.257, y: 57.539, z: 94.313 },
  351. newT: { x: 0, y: 0, z: 0 },
  352. },
  353. sdFc4: {
  354. render: sdFc4 ? () => sdFc4.render() : null,
  355. group: sdFc4 ? sdFc4.group : null,
  356. newP: { x: 66.257, y: 57.539, z: 94.313 },
  357. newT: { x: 0, y: 0, z: 0 },
  358. },
  359. sdFc2: {
  360. render: sdFc2 ? () => sdFc2.render() : null,
  361. group: sdFc2 ? sdFc2.group : null,
  362. newP: { x: 66.257, y: 57.539, z: 94.313 },
  363. newT: { x: 0, y: 0, z: 0 },
  364. },
  365. sdFc5: {
  366. render: sdFc5 ? () => sdFc5.render() : null,
  367. group: sdFc5 ? sdFc5.group : null,
  368. newP: { x: 34.294433107431956, y: 19.284123769585108, z: 47.717286013509835 },
  369. newT: { x: 12.311816240141978, y: -5.691930035759495, z: -5.57302688985693 },
  370. },
  371. threeFc8: {
  372. render: threeFc8 ? () => threeFc8.render() : null,
  373. group: threeFc8 ? threeFc8.group : null,
  374. newP: { x: 70.79925059068043, y: 61.89235869996884, z: 107.07997293517579 },
  375. newT: { x: 15.353809053159333, y: 8.712511207091119, z: -13.223119892513122 },
  376. },
  377. singleXkWindow: {
  378. render: singleWindowXkObj ? () => singleWindowXkObj.render() : null,
  379. group: singleWindowXkObj ? singleWindowXkObj.group : null,
  380. newP: { x: 116.08531358656566, y: 81.45510733175816, z: 193.00752046594465 },
  381. newT: { x: 23.446366480086372, y: -12.335134633777185, z: -5.63294282643405 },
  382. },
  383. sdFcZhq: {
  384. render: sdFcZhq ? () => sdFcZhq.render() : null,
  385. group: sdFcZhq ? sdFcZhq.group : null,
  386. newP: { x: 66.257, y: 57.539, z: 94.313 },
  387. newT: { x: -2.28, y: -0.91, z: -5.68 },
  388. },
  389. };
  390. const oldCameraPosition = { x: 100, y: 0, z: 10 };
  391. model.scene?.remove(group);
  392. const config = windowConfigurations[windowType];
  393. if (config && config.group) {
  394. model.startAnimation = config.render;
  395. group = config.group;
  396. setTimeout(async () => {
  397. await animateCamera(oldCameraPosition, { x: 0, y: 0, z: 0 }, config.newP, config.newT, model);
  398. model.scene?.add(config.group);
  399. resolve(null);
  400. }, 1000);
  401. } else {
  402. resolve(null);
  403. throw new Error(`Unsupported windowType: ${windowType}`);
  404. }
  405. });
  406. };
  407. export const mountedThree = () => {
  408. // const { sysOrgCode } = useGlobSetting();
  409. // const sysOrgCode = 'zmhjhzmy';
  410. return new Promise(async (resolve) => {
  411. model = new UseThree('#window3D');
  412. if (!model || !model.renderer || !model.camera) return;
  413. model.setEnvMap('royal_esplanade_1k.hdr');
  414. model.renderer.toneMappingExposure = 1.8;
  415. model.camera.position.set(100, 0, 1000);
  416. // 根据模型类型判断要初始化哪些模型
  417. const dictCodes = getDictItemsByCode('windowModalType');
  418. for (let i = 0; i < dictCodes.length; i++) {
  419. const dict = dictCodes[i];
  420. switch (dict.value) {
  421. case 'sdFc1':
  422. sdFc1 = new sdFc_1(model);
  423. await sdFc1.mountedThree();
  424. break;
  425. case 'ddFc5':
  426. ddFc5 = new ddFc_5(model);
  427. await ddFc5.mountedThree();
  428. break;
  429. case 'ddFc1':
  430. ddFc1 = new ddFc_1(model);
  431. await ddFc1.mountedThree();
  432. break;
  433. case 'ddFc2':
  434. ddFc2 = new ddFc_2(model);
  435. await ddFc2.mountedThree();
  436. break;
  437. case 'ddFc4':
  438. ddFc4 = new ddFc_4(model);
  439. await ddFc4.mountedThree();
  440. break;
  441. case 'ddFc6':
  442. ddFc6 = new ddFc_6(model);
  443. await ddFc6.mountedThree();
  444. break;
  445. case 'ddFc7':
  446. ddFc7 = new ddFc_7(model);
  447. await ddFc7.mountedThree();
  448. break;
  449. case 'ddFc8':
  450. ddFc8 = new ddFc_lt(model);
  451. await ddFc8.mountedThree();
  452. break;
  453. case 'sdFc3':
  454. sdFc3 = new sdFc_3(model);
  455. await sdFc3.mountedThree();
  456. break;
  457. case 'sdFc4':
  458. sdFc4 = new sdFc_4(model);
  459. await sdFc4.mountedThree();
  460. break;
  461. case 'sdFc2':
  462. sdFc2 = new sdFc_2(model);
  463. await sdFc2.mountedThree();
  464. break;
  465. case 'sdFc5':
  466. sdFc5 = new sdFc_5(model);
  467. await sdFc5.mountedThree();
  468. break;
  469. case 'threeFc8':
  470. threeFc8 = new threeFc_8(model);
  471. await threeFc8.mountedThree();
  472. break;
  473. case 'sdFcZhq':
  474. sdFcZhq = new SdFcZhq(model);
  475. await sdFcZhq.mountedThree();
  476. break;
  477. case 'singleXkWindow':
  478. singleWindowXkObj = new singleWindowXk(model);
  479. await singleWindowXkObj.mountedThree();
  480. break;
  481. }
  482. }
  483. model.animate();
  484. addMouseEvent();
  485. resolve(null);
  486. });
  487. };
  488. export const destroy = () => {
  489. if (model) {
  490. model.isRender = false;
  491. console.log('场景销毁前信息----------->', model.renderer?.info);
  492. model.isRender = false;
  493. if (ddFc5) ddFc5.destroy();
  494. if (ddFc1) ddFc1.destroy();
  495. if (ddFc2) ddFc2.destroy();
  496. if (ddFc4) ddFc4.destroy();
  497. if (ddFc6) ddFc6.destroy();
  498. if (ddFc7) ddFc7.destroy();
  499. if (ddFc8) ddFc8.destroy();
  500. if (sdFc1) sdFc1.destroy();
  501. if (sdFc3) sdFc3.destroy();
  502. if (sdFc4) sdFc4.destroy();
  503. if (sdFc2) sdFc2.destroy();
  504. if (sdFc5) sdFc5.destroy();
  505. if (sdFcZhq) sdFcZhq.destroy();
  506. if (threeFc8) threeFc8.destroy();
  507. singleWindowXkObj.destroy();
  508. model.destroy();
  509. model = null;
  510. group = null;
  511. singleWindowXkObj = null;
  512. ddFc5 = null;
  513. ddFc1 = null;
  514. ddFc2 = null;
  515. ddFc4 = null;
  516. ddFc6 = null;
  517. ddFc7 = null;
  518. ddFc8 = null;
  519. sdFc1 = null;
  520. sdFc3 = null;
  521. sdFc4 = null;
  522. sdFc2 = null;
  523. sdFc5 = null;
  524. sdFcZhq = null;
  525. threeFc8 = null;
  526. }
  527. };