fcfanLocal.three.ts 666 B

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