From 9d0acfb65c80c4948c305ca01338f894b87346a0 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期一, 08 四月 2024 09:44:37 +0800
Subject: [PATCH] Merge branch 'Four-Way-Rack' of http://47.97.1.152:5880/r/zy-asrs-master into Four-Way-Rack

---
 zy-asrs-flow/src/pages/map/drawer/shelf/shelfThree.js |   40 +++++++---------------------------------
 1 files changed, 7 insertions(+), 33 deletions(-)

diff --git a/zy-asrs-flow/src/pages/map/drawer/shelf/shelfThree.js b/zy-asrs-flow/src/pages/map/drawer/shelf/shelfThree.js
index 9f6818d..019533c 100644
--- a/zy-asrs-flow/src/pages/map/drawer/shelf/shelfThree.js
+++ b/zy-asrs-flow/src/pages/map/drawer/shelf/shelfThree.js
@@ -64,9 +64,6 @@
 
     initScene = () => {
         const scene = new THREE.Scene();
-        // scene.background = new THREE.Color(0xf0f0f0);
-        // scene.background = new THREE.Color(0x333333);
-
         // scene.background = new THREE.Color(0xf8f8f8);
         scene.background = new THREE.Color(0x7a7a7a);
         scene.fog = new THREE.Fog(scene.background, 1, 5000);
@@ -190,37 +187,8 @@
     }
 
     generateMesh = (fn) => {
-        // fn(this.addObject);
         const loader = new FBXLoader();
-        const promise = new Promise((resolve) => {
-            loader.load('model/04.fbx', (mesh) => {
-                mesh.position.set(0, 10, 0);
-                mesh.scale.set(5, 5, 5);
-                mesh.name = '1-1-1';
-                mesh.traverse(function (child) {
-                    if (child.isMesh) {
-                        if (child.name === '涓嶈鍒�') {
-                            // child.visible = false;
-                            child.material.color.set(0xE8B67E);
-                        }
-                        if (child.name === '璐ф灦') {
-                            // child.visible = false;
-                            child.material.color.set(0x4680BF);
-                        }
-                        if (child.name === '鎵樼洏') {
-                            // child.visible = false;
-                            child.material.color.set(0xBEBEBE);
-                        }
-                        child.name = '1-1-1'
-                        child.castShadow = true;
-                        child.receiveShadow = true;
-                    }
-                });
-                this.addObject(mesh);
-                resolve();
-            })
-        })
-        return promise;
+        fn(loader, this.addObject);
     }
 
     setNewSelectedMesh = (objName) => {
@@ -232,6 +200,12 @@
         }
     }
 
+    rePerspective = (maxHeight) => {
+        const cameraPosScale = 0.7;
+        this.camera.position.set(-maxHeight * cameraPosScale, maxHeight * cameraPosScale, maxHeight * cameraPosScale);
+        this.controls.target = new THREE.Vector3(0, maxHeight * 0.53, 0);
+    }
+
     destroy = () => {
         cancelAnimationFrame(this.animationFrame);
         window.removeEventListener('resize', this.resizeHandler);

--
Gitblit v1.9.1