window.threejs.ts 19 KB

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