Procházet zdrojové kódy

新增模型动画

hongrunxia před 2 měsíci
rodič
revize
fd87488ffc

+ 2 - 1
package.json

@@ -218,5 +218,6 @@
         "three/examples/jsm/postprocessing/UnrealBloomPass.js"
         "three/examples/jsm/postprocessing/UnrealBloomPass.js"
       ]
       ]
     }
     }
-  }
+  },
+  "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
 }
 }

+ 4 - 4
src/utils/threejs/useThree.ts

@@ -69,7 +69,7 @@ class UseThree {
     // 初始化场景
     // 初始化场景
     this.initScene();
     this.initScene();
     // 初始化环境光
     // 初始化环境光
-    // this.initLight();
+    this.initLight();
     // 初始化相机
     // 初始化相机
     this.initCamera();
     this.initCamera();
     //初始化渲染器
     //初始化渲染器
@@ -106,9 +106,9 @@ class UseThree {
   }
   }
 
 
   initLight() {
   initLight() {
-    // const light = new THREE.AmbientLight(0xffffff, 1);
-    // light.position.set(0, 1000, 1000);
-    // (this.scene as THREE.Scene).add(light);
+    const light = new THREE.AmbientLight(0xffffff, 1);
+    light.position.set(0, 1000, 1000);
+    (this.scene as THREE.Scene).add(light);
   }
   }
 
 
   initCamera() {
   initCamera() {

+ 9 - 1
src/views/vent/home/configurable/components/three3D.vue

@@ -31,6 +31,14 @@
     const directionalLight = new THREE.DirectionalLight(0xffffff, 1);
     const directionalLight = new THREE.DirectionalLight(0xffffff, 1);
     directionalLight.position.set(-110, 150, 647);
     directionalLight.position.set(-110, 150, 647);
     modalGroup?.add(directionalLight);
     modalGroup?.add(directionalLight);
+
+    const directionalLight1 = new THREE.DirectionalLight(0xffffff, 1);
+    directionalLight.position.set(110, 150, 647);
+    modalGroup?.add(directionalLight1);
+
+    const directionalLight3 = new THREE.DirectionalLight(0xffffff, 1);
+    directionalLight.position.set(10, 150, 647);
+    modalGroup?.add(directionalLight3);
   };
   };
   const setModelType = () => {
   const setModelType = () => {
     return new Promise(async (resolve) => {
     return new Promise(async (resolve) => {
@@ -112,7 +120,7 @@
   onMounted(async () => {
   onMounted(async () => {
     modal = new UseThree('#three3D', '');
     modal = new UseThree('#three3D', '');
     if (modal) {
     if (modal) {
-      modal.setEnvMap('test1.hdr');
+      // modal.setEnvMap('studio_small_09_1k.hdr');
       modal.renderer.toneMappingExposure = 1.0;
       modal.renderer.toneMappingExposure = 1.0;
       modal.renderer.sortObjects = true;
       modal.renderer.sortObjects = true;
       modal.orbitControls.update();
       modal.orbitControls.update();

+ 22 - 19
src/views/vent/home/configurable/gasInjection.vue

@@ -68,26 +68,29 @@ function toggleMenu(param) {
       break;
       break;
   }
   }
 
 
-  // 刷新/
-  nextTick(async () => {
-    three3D.value?.resizeRenderer();
-    const modal = three3D.value.getModal();
-    if (modal) {
-      const oldCamera = modal.camera;
-      const oldCameraPosition = { x: oldCamera.position.x, y: oldCamera.position.y, z: oldCamera.position.z };
-      if (param == 'zqxt') {
-        const newP = { x: -26.587483577770445, y: -1.885170491810538, z: 39.104309663143255 };
-        const newT = { x: 10.919881491980828, y: -4.7228274957026946, z: 38.87645926712004 };
-        await animateCamera(oldCameraPosition, { x: 0, y: 0, z: 0 }, newP, newT, modal);
-      } else if (param == 'zjm') {
-        const newP = { x: -45.69228602978097, y: 49.59721939545517, z: 2.6454258202266985 };
-        const newT = { x: 9.289291846942458, y: -21.608842010051386, z: 2.7675348357947906 };
-        await animateCamera(oldCameraPosition, { x: 0, y: 0, z: 0 }, newP, newT, modal);
-      } else {
-        const newP = { x: -43.18945276107877, y: 40.44347648044, z: 0.059975838354020664 };
-        const newT = { x: 6.431421158296241, y: -23.819993211059913, z: 0.17017939135402457 };
-        await animateCamera(oldCameraPosition, { x: 0, y: 0, z: 0 }, newP, newT, modal);
+    // 刷新/
+    nextTick(async () => {
+      three3D.value?.resizeRenderer();
+      const modal = three3D.value.getModal();
+      if (modal) {
+        const oldCamera = modal.camera;
+        const oldCameraPosition = { x: oldCamera.position.x, y: oldCamera.position.y, z: oldCamera.position.z };
+        if (param == 'zqxt') {
+          const newP = { x: -29.4124614570094, y: -1.6093280622283133, z: 39.51639267244655 };
+          const newT = { x: 11.205344322178817, y: -1.7174801102124406, z: 40.19437751610255 };
+          await animateCamera(oldCameraPosition, { x: 0, y: 0, z: 0 }, newP, newT, modal);
+        } else if (param == 'zjm') {
+          const newP = { x: -45.69228602978097, y: 49.59721939545517, z: 2.6454258202266985 };
+          const newT = { x: 9.289291846942458, y: -21.608842010051386, z: 2.7675348357947906 };
+          await animateCamera(oldCameraPosition, { x: 0, y: 0, z: 0 }, newP, newT, modal);
+        } else {
+          const newP = { x: -43.18945276107877, y: 40.44347648044, z: 0.059975838354020664 };
+          const newT = { x: 6.431421158296241, y: -23.819993211059913, z: 0.17017939135402457 };
+          await animateCamera(oldCameraPosition, { x: 0, y: 0, z: 0 }, newP, newT, modal);
+        }
       }
       }
+    });
+  }
     }
     }
   });
   });
 }
 }