fanLocal.threejs.base.ts 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626
  1. import * as THREE from 'three';
  2. import { CSS3DObject } from 'three/examples/jsm/renderers/CSS3DRenderer';
  3. import { animateCamera, getTextCanvas, setModalCenter } from '/@/utils/threejs/util';
  4. import Smoke from '/@/views/vent/comment/threejs/Smoke';
  5. import fcFan from './fcfanLocal.three';
  6. import fmFan from './fmfanLocal.three';
  7. import gsap from 'gsap';
  8. // import { setModalCenter } from '/@/utils/threejs/util';
  9. // import * as dat from 'dat.gui';
  10. // const gui = new dat.GUI();
  11. // gui.domElement.style = 'position:absolute;top:100px;left:10px;z-index:99999999999999';
  12. // 本模型的上下文对象,用于实现本模型的特定功能,代码参考了旧有的 fanLocal.three.ts
  13. class ModelContext {
  14. model;
  15. modelName = 'jbfj-hd';
  16. group: THREE.Object3D | null = null;
  17. fanType?: string;
  18. fcFanObj?: fcFan;
  19. fmFanObj?: fmFan;
  20. topSmoke?: Smoke;
  21. downSmoke?: Smoke;
  22. returnSmoke?: Smoke;
  23. topLife?: number;
  24. downLife?: number;
  25. constructor(model) {
  26. this.model = model;
  27. }
  28. addLight() {
  29. // optional implementation
  30. }
  31. mountedThree() {
  32. return new Promise((resolve) => {
  33. this.model.setGLTFModel([this.modelName]).then(async (gltf) => {
  34. this.group = gltf[0];
  35. if (this.group) {
  36. const Fengtongbu01 = this.group.getObjectByName('Cylinder1054') as THREE.Mesh;
  37. const textMaterial = new THREE.MeshBasicMaterial({
  38. color: '#000',
  39. transparent: true,
  40. opacity: 0.3,
  41. side: THREE.DoubleSide, // 这里是双面渲染的意思
  42. });
  43. Fengtongbu01.material = textMaterial;
  44. Fengtongbu01.renderOrder = 300;
  45. setModalCenter(this.group);
  46. this.addLight();
  47. this.initFly();
  48. this.setModalPosition();
  49. this.fcFanObj = new fcFan(this.model);
  50. await this.fcFanObj.mountedThree();
  51. this.fmFanObj = new fmFan(this.model);
  52. await this.fmFanObj.mountedThree();
  53. resolve(null);
  54. }
  55. });
  56. });
  57. }
  58. destroy() {
  59. if (this.model) {
  60. this.model.isRender = false;
  61. this.clearFly();
  62. this.topSmoke = undefined;
  63. this.downSmoke = undefined;
  64. this.returnSmoke = undefined;
  65. if (this.fcFanObj) this.fcFanObj.destroy();
  66. if (this.fmFanObj) this.fmFanObj.destroy();
  67. // @ts-ignore
  68. this.group = undefined;
  69. this.model.destroy();
  70. }
  71. }
  72. async initFly() {
  73. const topCurve = [
  74. {
  75. path0: new THREE.Vector3(-89.84, 2.359, 4.91),
  76. path1: new THREE.Vector3(-85.678, 2.359, 3.61),
  77. isSpread: true,
  78. spreadDirection: -1, //
  79. },
  80. {
  81. path0: new THREE.Vector3(-85.678, 2.352, 3.66),
  82. path1: new THREE.Vector3(-85.636, 2.353, -3.829),
  83. isSpread: false,
  84. spreadDirection: 0,
  85. },
  86. {
  87. path0: new THREE.Vector3(-85.636, 2.353, -3.829),
  88. path1: new THREE.Vector3(-85.636, 1.026, -5.881),
  89. isSpread: false,
  90. spreadDirection: 0,
  91. },
  92. {
  93. path0: new THREE.Vector3(-85.636, 1.026, -5.881),
  94. path1: new THREE.Vector3(-85.618, 0.887, -12.862),
  95. isSpread: false,
  96. spreadDirection: 0,
  97. },
  98. {
  99. path0: new THREE.Vector3(-85.618, 0.827, -12.962),
  100. path1: new THREE.Vector3(80.404, 0.827, -12.962),
  101. isSpread: false,
  102. spreadDirection: 0,
  103. },
  104. {
  105. path0: new THREE.Vector3(80.404, 0.827, -12.962),
  106. path1: new THREE.Vector3(93.164, 0.85, -12.962),
  107. isSpread: true,
  108. spreadDirection: 1, // 1是由小变大,-1是由大变小
  109. },
  110. ];
  111. const downCurve = [
  112. {
  113. path0: new THREE.Vector3(-94.84, -0.388, 3.61),
  114. path1: new THREE.Vector3(-85.678, -0.393, 3.61),
  115. isSpread: true,
  116. spreadDirection: -1, //
  117. },
  118. {
  119. path0: new THREE.Vector3(-85.678, -0.393, 3.275),
  120. path1: new THREE.Vector3(-85.636, -0.392, -3.829),
  121. isSpread: false,
  122. spreadDirection: 0,
  123. },
  124. {
  125. path0: new THREE.Vector3(-85.636, -0.392, -3.829),
  126. path1: new THREE.Vector3(-85.636, 0.926, -5.881),
  127. isSpread: false,
  128. spreadDirection: 0,
  129. },
  130. {
  131. path0: new THREE.Vector3(-85.636, 1.026, -5.881),
  132. path1: new THREE.Vector3(-85.618, 0.887, -12.862),
  133. isSpread: false,
  134. spreadDirection: 0,
  135. },
  136. {
  137. path0: new THREE.Vector3(-85.618, 0.887, -12.962),
  138. path1: new THREE.Vector3(80.404, 0.887, -12.962),
  139. isSpread: false,
  140. spreadDirection: 0,
  141. },
  142. {
  143. path0: new THREE.Vector3(80.404, 0.887, -12.962),
  144. path1: new THREE.Vector3(93.164, 0.91, -12.962),
  145. isSpread: true,
  146. spreadDirection: 1, // 1是由小变大,-1是由大变小
  147. },
  148. ];
  149. const returnCurve = [
  150. {
  151. path0: new THREE.Vector3(93.164, 0.85, -12.962),
  152. path1: new THREE.Vector3(86.39, 0.827, -12.962),
  153. isSpread: false,
  154. spreadDirection: 2,
  155. },
  156. {
  157. path0: new THREE.Vector3(86.39, 0.827, -12.962),
  158. path1: new THREE.Vector3(83.341, 0.847, -17.658),
  159. isSpread: false,
  160. spreadDirection: 2,
  161. },
  162. {
  163. path0: new THREE.Vector3(83.341, 0.847, -17.658),
  164. path1: new THREE.Vector3(-29.077, 0.847, -17.658),
  165. isSpread: false,
  166. spreadDirection: 2,
  167. },
  168. {
  169. path0: new THREE.Vector3(-29.077, 0.847, -17.658),
  170. path1: new THREE.Vector3(-29.64, 0.827, -39.047),
  171. isSpread: false,
  172. spreadDirection: 2,
  173. },
  174. ];
  175. if (!this.topSmoke) {
  176. this.topSmoke = new Smoke('/model/img/texture-smoke.png', '#ffffff', 0, 0.75, 0.5, 400);
  177. this.topSmoke.setPath(topCurve);
  178. await this.topSmoke.setPoints();
  179. this.group?.add(this.topSmoke.points);
  180. }
  181. if (!this.downSmoke) {
  182. this.downSmoke = new Smoke('/model/img/texture-smoke.png', '#ffffff', 0, 0.75, 0.5, 400);
  183. this.downSmoke.setPath(downCurve);
  184. await this.downSmoke.setPoints();
  185. this.group?.add(this.downSmoke.points);
  186. }
  187. if (!this.returnSmoke) {
  188. this.returnSmoke = new Smoke('/model/img/texture-smoke.png', '#777777', 0, 0.35, 1.5, 200);
  189. this.returnSmoke.setPath(returnCurve);
  190. await this.returnSmoke.setPoints();
  191. this.group?.add(this.returnSmoke.points);
  192. }
  193. }
  194. playSmoke(selectData) {
  195. // debugger;
  196. // console.log('selectData[Fan1fHz]------------》', selectData['Fan1fHz'], Number(selectData['Fan1fHz']));
  197. if (selectData['Fan1StartStatus'] == '1') {
  198. // 主风机打开
  199. // setSmokeFrequency('top', Number(selectData['Fan1fHz']) || 40);
  200. this.setSmokeFrequency('top', 40);
  201. this.runFly('top', 'open');
  202. } else {
  203. // 备风机关闭
  204. this.runFly('top', 'close');
  205. }
  206. if (selectData['Fan2StartStatus'] == '1') {
  207. // 备风机打开
  208. // setSmokeFrequency('down', Number(selectData['Fan2fHz']) || 40);
  209. this.setSmokeFrequency('down', 40);
  210. this.runFly('down', 'open');
  211. } else {
  212. // 备风机关闭
  213. this.runFly('down', 'close');
  214. }
  215. if (selectData['Fan1StartStatus'] != '1' && selectData['Fan2StartStatus'] != '1') {
  216. this.runFly('all', 'close');
  217. }
  218. // if (frequency) {
  219. // setSmokeFrequency(deviceType, frequency);
  220. // }
  221. // if (controlType === 'startSmoke') {
  222. // runFly(deviceType, state);
  223. // }
  224. }
  225. runFly(deviceType, state) {
  226. if (state === 'open') {
  227. if (deviceType === 'top') {
  228. if (this.downSmoke && this.downSmoke.frameId) {
  229. this.downSmoke.stopSmoke();
  230. }
  231. if (this.topSmoke && !this.topSmoke.frameId) {
  232. this.topSmoke.startSmoke();
  233. }
  234. } else {
  235. if (this.topSmoke && this.topSmoke.frameId) {
  236. this.topSmoke.stopSmoke();
  237. }
  238. if (this.downSmoke && !this.downSmoke.frameId) {
  239. this.downSmoke.startSmoke();
  240. }
  241. }
  242. if (this.returnSmoke && !this.returnSmoke.frameId) {
  243. this.returnSmoke?.startSmoke();
  244. }
  245. } else {
  246. if (deviceType === 'top') {
  247. if (this.topSmoke && this.topSmoke.frameId) {
  248. this.topSmoke.stopSmoke();
  249. }
  250. } else {
  251. if (this.downSmoke && this.downSmoke.frameId) {
  252. this.downSmoke.stopSmoke();
  253. }
  254. }
  255. }
  256. if (deviceType === 'all' && state === 'close') {
  257. this.returnSmoke?.stopSmoke();
  258. }
  259. }
  260. setSmokeFrequency(deviceType, frequency) {
  261. const life = (frequency - 30) * 25;
  262. let duration = 0;
  263. let smoke;
  264. if (deviceType === 'top') {
  265. if (this.topLife == life) {
  266. return;
  267. }
  268. this.topLife = life;
  269. smoke = this.topSmoke;
  270. duration = (Math.abs(life - smoke.life) / 500) * 25;
  271. } else {
  272. if (this.downLife == life) {
  273. return;
  274. }
  275. this.downLife = life;
  276. smoke = this.downSmoke;
  277. duration = (Math.abs(life - smoke.life) / 500) * 25;
  278. }
  279. if (smoke) {
  280. gsap.to(smoke, {
  281. life: life,
  282. duration: duration,
  283. ease: 'easeInCubic',
  284. overwrite: true,
  285. });
  286. }
  287. }
  288. addText(selectData) {
  289. if (!this.group) {
  290. return;
  291. }
  292. // @ts-ignore
  293. const screenDownText = VENT_PARAM['modalText']
  294. ? // @ts-ignore
  295. VENT_PARAM['modalText']
  296. : // @ts-ignore
  297. History_Type['type'] == 'remote'
  298. ? `国能神东煤炭集团监制`
  299. : '煤炭科学技术研究院有限公司研制';
  300. const screenDownTextX = 80 - (screenDownText.length - 10) * 6;
  301. const textArr = [
  302. {
  303. text: `智能局部通风机监测与控制系统`,
  304. font: 'normal 30px Arial',
  305. color: '#009900',
  306. strokeStyle: '#002200',
  307. x: 20,
  308. y: 108,
  309. },
  310. {
  311. text: `供风距离(m):`,
  312. font: 'normal 30px Arial',
  313. color: '#009900',
  314. strokeStyle: '#002200',
  315. x: 0,
  316. y: 152,
  317. },
  318. {
  319. text: `${
  320. selectData.fchimenylength ? selectData.fchimenylength : selectData.airSupplyDistence_merge ? selectData.airSupplyDistence_merge : '-'
  321. }`,
  322. font: 'normal 30px Arial',
  323. color: '#009900',
  324. strokeStyle: '#002200',
  325. x: 228,
  326. y: 152,
  327. },
  328. {
  329. text: `风筒直径(mm): `,
  330. font: 'normal 30px Arial',
  331. color: '#009900',
  332. strokeStyle: '#002200',
  333. x: 0,
  334. y: 200,
  335. },
  336. {
  337. text: ` ${selectData.fchimenydiamlimit ? selectData.fchimenydiamlimit : selectData.ductDiameter_merge ? selectData.ductDiameter_merge : '-'}`,
  338. font: 'normal 30px Arial',
  339. color: '#009900',
  340. strokeStyle: '#002200',
  341. x: 220,
  342. y: 200,
  343. },
  344. {
  345. text: `故障诊断:`,
  346. font: 'normal 30px Arial',
  347. color: '#009900',
  348. strokeStyle: '#002200',
  349. x: 0,
  350. y: 245,
  351. },
  352. {
  353. text: `${selectData.warnLevel_str ? selectData.warnLevel_str : '-'}`,
  354. font: 'normal 30px Arial',
  355. color: '#009900',
  356. strokeStyle: '#002200',
  357. x: 220,
  358. y: 245,
  359. },
  360. {
  361. text: `型号功率:`,
  362. font: 'normal 30px Arial',
  363. color: '#009900',
  364. strokeStyle: '#002200',
  365. x: 0,
  366. y: 285,
  367. },
  368. {
  369. text: `${selectData.model_Power_merge ? selectData.model_Power_merge : '-'}`,
  370. font: 'normal 26px Arial',
  371. color: '#009900',
  372. strokeStyle: '#002200',
  373. x: 220,
  374. y: 285,
  375. },
  376. {
  377. text: screenDownText,
  378. font: 'normal 28px Arial',
  379. color: '#009900',
  380. strokeStyle: '#002200',
  381. x: screenDownTextX,
  382. y: 325,
  383. },
  384. ];
  385. getTextCanvas(526, 346, textArr, '').then((canvas: HTMLCanvasElement) => {
  386. const textMap = new THREE.CanvasTexture(canvas); // 关键一步
  387. const textMaterial = new THREE.MeshBasicMaterial({
  388. // 关于材质并未讲解 实操即可熟悉 这里是漫反射类似纸张的材质,对应的就有高光类似金属的材质.
  389. map: textMap, // 设置纹理贴图
  390. transparent: true,
  391. side: THREE.FrontSide, // 这里是双面渲染的意思
  392. });
  393. textMaterial.blending = THREE.CustomBlending;
  394. const monitorPlane = this.group?.getObjectByName('monitorText');
  395. if (monitorPlane) {
  396. // @ts-ignore-next-line
  397. monitorPlane.material = textMaterial;
  398. } else {
  399. const planeGeometry = new THREE.PlaneGeometry(526, 346); // 平面3维几何体PlaneGeometry
  400. const planeMesh = new THREE.Mesh(planeGeometry, textMaterial);
  401. planeMesh.name = 'monitorText';
  402. planeMesh.scale.set(0.0135, 0.0135, 0.0135);
  403. planeMesh.rotation.y = -Math.PI / 2;
  404. planeMesh.position.set(-84.79, 0.82, 17.0);
  405. this.group?.add(planeMesh);
  406. }
  407. });
  408. }
  409. addCssText() {
  410. if (!this.group) return;
  411. if (!this.group.getObjectByName('text1')) {
  412. const element = document.getElementById('inputBox') as HTMLElement;
  413. if (element) {
  414. const fanLocalCSS3D = new CSS3DObject(element);
  415. fanLocalCSS3D.name = 'text1';
  416. fanLocalCSS3D.scale.set(0.04, 0.04, 0.04);
  417. fanLocalCSS3D.rotation.y = -Math.PI / 2;
  418. fanLocalCSS3D.position.set(-85.68, 5.97, -3.39);
  419. this.group.add(fanLocalCSS3D);
  420. }
  421. }
  422. if (!this.group.getObjectByName('text2')) {
  423. const element = document.getElementById('outBox') as HTMLElement;
  424. if (element) {
  425. const fanLocalCSS3D = new CSS3DObject(element);
  426. fanLocalCSS3D.name = 'text2';
  427. fanLocalCSS3D.scale.set(0.15, 0.15, 0.15);
  428. fanLocalCSS3D.rotation.y = -Math.PI / 2;
  429. fanLocalCSS3D.position.set(85.62, 17.65, 7.71);
  430. this.group.add(fanLocalCSS3D);
  431. }
  432. }
  433. if (!this.group.getObjectByName('text3')) {
  434. const element = document.getElementById('returnBox') as HTMLElement;
  435. if (element) {
  436. const fanLocalCSS3D = new CSS3DObject(element);
  437. fanLocalCSS3D.name = 'text3';
  438. fanLocalCSS3D.scale.set(0.07, 0.07, 0.07);
  439. fanLocalCSS3D.rotation.y = -Math.PI / 2;
  440. fanLocalCSS3D.position.set(-25.97, 9.3, -15.09);
  441. this.group.add(fanLocalCSS3D);
  442. }
  443. }
  444. if (!this.group.getObjectByName('text4')) {
  445. const element = document.getElementById('gateBox') as HTMLElement;
  446. if (element) {
  447. // element.innerHTML = '';
  448. const fanLocalCSS3D = new CSS3DObject(element);
  449. fanLocalCSS3D.name = 'text4';
  450. fanLocalCSS3D.scale.set(0.04, 0.04, 0.04);
  451. fanLocalCSS3D.rotation.y = -Math.PI / 2;
  452. fanLocalCSS3D.position.set(-73.13, 8.44, -23.52);
  453. this.group.add(fanLocalCSS3D);
  454. }
  455. }
  456. if (!this.group.getObjectByName('text5')) {
  457. const element = document.getElementById('windownBox') as HTMLElement;
  458. if (element) {
  459. // element.innerHTML = '';
  460. const fanLocalCSS3D = new CSS3DObject(element);
  461. fanLocalCSS3D.name = 'text5';
  462. fanLocalCSS3D.scale.set(0.07, 0.07, 0.07);
  463. fanLocalCSS3D.rotation.y = -Math.PI / 2;
  464. fanLocalCSS3D.position.set(-28.44, 9.78, -40.42);
  465. this.group.add(fanLocalCSS3D);
  466. }
  467. }
  468. if (!this.group.getObjectByName('text7')) {
  469. const element = document.getElementById('inputBox0') as HTMLElement;
  470. if (element) {
  471. const fanLocalCSS3D = new CSS3DObject(element);
  472. fanLocalCSS3D.name = 'text7';
  473. fanLocalCSS3D.scale.set(0.04, 0.04, 0.04);
  474. fanLocalCSS3D.rotation.y = -Math.PI / 2;
  475. fanLocalCSS3D.position.set(-84.23, 4.97, -18.92);
  476. this.group.add(fanLocalCSS3D);
  477. }
  478. }
  479. if (!this.group.getObjectByName('text6')) {
  480. const element = document.getElementById('inputBox1') as HTMLElement;
  481. if (element) {
  482. const fanLocalCSS3D = new CSS3DObject(element);
  483. fanLocalCSS3D.name = 'text6';
  484. fanLocalCSS3D.scale.set(0.04, 0.04, 0.04);
  485. fanLocalCSS3D.rotation.y = -Math.PI / 2;
  486. fanLocalCSS3D.position.set(-84.23, 6.01, -0.03);
  487. this.group.add(fanLocalCSS3D);
  488. }
  489. }
  490. if (!this.group.getObjectByName('text8')) {
  491. const element = document.getElementById('gasBox3') as HTMLElement;
  492. if (element) {
  493. const fanLocalCSS3D = new CSS3DObject(element);
  494. fanLocalCSS3D.name = 'text8';
  495. fanLocalCSS3D.scale.set(0.03, 0.03, 0.03);
  496. fanLocalCSS3D.rotation.y = -Math.PI / 2;
  497. fanLocalCSS3D.position.set(-90.04, 6, 5);
  498. this.group.add(fanLocalCSS3D);
  499. }
  500. }
  501. if (!this.group.getObjectByName('text9')) {
  502. const element = document.getElementById('gasBox2') as HTMLElement;
  503. if (element) {
  504. const fanLocalCSS3D = new CSS3DObject(element);
  505. fanLocalCSS3D.name = 'text9';
  506. fanLocalCSS3D.scale.set(0.07, 0.07, 0.07);
  507. fanLocalCSS3D.rotation.y = -Math.PI / 2;
  508. fanLocalCSS3D.position.set(-8, 7.46, -35.28);
  509. this.group.add(fanLocalCSS3D);
  510. }
  511. }
  512. if (!this.group.getObjectByName('text10')) {
  513. const element = document.getElementById('gasBox1') as HTMLElement;
  514. if (element) {
  515. const fanLocalCSS3D = new CSS3DObject(element);
  516. fanLocalCSS3D.name = 'text10';
  517. fanLocalCSS3D.scale.set(0.1, 0.1, 0.1);
  518. fanLocalCSS3D.rotation.y = -Math.PI / 2;
  519. fanLocalCSS3D.position.set(80, 9, -43);
  520. this.group.add(fanLocalCSS3D);
  521. }
  522. }
  523. }
  524. /** 设置模型类型并切换,不同的类型通常对应不同的具体模型,在模型总控制器下的具体模型会根据传入的参数彼此交互、切换 */
  525. setModelType(type: 'fm' | 'fc' | string) {
  526. this.fanType = type;
  527. return new Promise((resolve) => {
  528. if (!this.group) return;
  529. // 显示双道风窗
  530. let childGroup;
  531. if (this.fanType === 'fm' && this.fcFanObj && this.fcFanObj.group) {
  532. if (this.group?.getObjectByName('jbfj-fc')) {
  533. this.group?.remove(this.fcFanObj.group);
  534. }
  535. childGroup = this.fmFanObj?.group;
  536. if (this.group && this.group?.getObjectByName('text5') && this.group?.getObjectByName('text4')) {
  537. // @ts-ignore-next-line
  538. this.group.getObjectByName('text5')['visible'] = false;
  539. // @ts-ignore-next-line
  540. this.group.getObjectByName('text4')['visible'] = true;
  541. }
  542. } else if (this.fanType === 'fc' && this.fmFanObj && this.fmFanObj.group) {
  543. // 显示单道风窗
  544. if (this.group?.getObjectByName('jbfj-fm')) {
  545. this.group?.remove(this.fmFanObj.group);
  546. }
  547. childGroup = this.fcFanObj?.group;
  548. if (this.group && this.group?.getObjectByName('text5') && this.group?.getObjectByName('text4')) {
  549. // @ts-ignore-next-line
  550. this.group.getObjectByName('text5')['visible'] = true;
  551. // @ts-ignore-next-line
  552. this.group.getObjectByName('text4')['visible'] = false;
  553. }
  554. } else {
  555. if (this.group?.getObjectByName('jbfj-fc')) {
  556. // @ts-ignore-next-line
  557. this.group?.remove(this.fcFanObj.group);
  558. }
  559. if (this.group?.getObjectByName('jbfj-fm')) {
  560. // @ts-ignore-next-line
  561. this.group?.remove(this.fmFanObj.group);
  562. }
  563. if (this.group && this.group?.getObjectByName('text5') && this.group?.getObjectByName('text4')) {
  564. // @ts-ignore-next-line
  565. this.group.getObjectByName('text5')['visible'] = false;
  566. // @ts-ignore-next-line
  567. this.group.getObjectByName('text4')['visible'] = false;
  568. }
  569. childGroup = null;
  570. }
  571. setTimeout(async () => {
  572. if (childGroup) this.group?.add(childGroup);
  573. // const oldCameraPosition = { x: 615, y: 275, z: 744 };
  574. // await animateCamera(
  575. // oldCameraPosition,
  576. // { x: 0, y: 0, z: 0 },
  577. // { x: 0.08, y: 21.73, z: 78.45 },
  578. // { x: 0.13, y: -0.82, z: 0.236 },
  579. // this.model,
  580. // 0.8
  581. // );
  582. resolve(null);
  583. }, 300);
  584. });
  585. }
  586. clearFly() {
  587. if (this.topSmoke) this.topSmoke.clearSmoke();
  588. if (this.downSmoke) this.downSmoke.clearSmoke();
  589. if (this.returnSmoke) this.returnSmoke.clearSmoke();
  590. }
  591. // 设置模型位置
  592. setModalPosition() {
  593. if (!this.group) return;
  594. this.group.scale.set(0.7, 0.7, 0.7);
  595. this.group.position.set(0, 6, -50);
  596. this.group.rotation.y = Math.PI / 2;
  597. }
  598. }
  599. export default ModelContext;