fmfanLocal.three.ts 618 B

1234567891011121314151617181920212223242526272829
  1. import * as THREE from 'three';
  2. class fmFan {
  3. model;
  4. modelName = 'jbfj-fm';
  5. group: THREE.Object3D | null = null;
  6. constructor(model) {
  7. this.model = model;
  8. }
  9. mountedThree() {
  10. return new Promise((resolve) => {
  11. this.model.setGLTFModel([this.modelName]).then((gltf) => {
  12. this.group = gltf[0];
  13. if (this.group) this.group.name = this.modelName;
  14. this.group?.position.set(-0.668, -0.037, -0.023);
  15. resolve(null);
  16. });
  17. });
  18. }
  19. destroy() {
  20. this.model.clearGroup(this.group);
  21. this.model = null;
  22. this.group = null;
  23. }
  24. }
  25. export default fmFan;