window.threejs.ts 20 KB

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