From 2dce720b2cf1cfeb20601eec01fe0120755b4ec1 Mon Sep 17 00:00:00 2001
From: wangqiujuan0808 <578331299@qq.com>
Date: Sun, 3 Dec 2023 19:19:08 +0800
Subject: [PATCH] =?UTF-8?q?=E3=80=82=E3=80=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../bimHome/components/DeviceInfoDialog.vue | 149 ++++++++++++++++++
.../bim/bimHome/components/DevicePie.vue | 19 ++-
.../bim/bimHome/components/ThreeView.vue | 31 ++--
src/views/bim/bimHome/index.vue | 17 +-
4 files changed, 201 insertions(+), 15 deletions(-)
create mode 100644 src/views/bim/bimHome/components/DeviceInfoDialog.vue
diff --git a/src/views/bim/bimHome/components/DeviceInfoDialog.vue b/src/views/bim/bimHome/components/DeviceInfoDialog.vue
new file mode 100644
index 0000000..0898c2c
--- /dev/null
+++ b/src/views/bim/bimHome/components/DeviceInfoDialog.vue
@@ -0,0 +1,149 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查看
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/views/bim/bimHome/components/DevicePie.vue b/src/views/bim/bimHome/components/DevicePie.vue
index 67499d0..1237b14 100644
--- a/src/views/bim/bimHome/components/DevicePie.vue
+++ b/src/views/bim/bimHome/components/DevicePie.vue
@@ -3,13 +3,17 @@
+
+
\ No newline at end of file
diff --git a/src/views/bim/bimHome/components/ThreeView.vue b/src/views/bim/bimHome/components/ThreeView.vue
index bbea9de..7dae170 100644
--- a/src/views/bim/bimHome/components/ThreeView.vue
+++ b/src/views/bim/bimHome/components/ThreeView.vue
@@ -108,20 +108,27 @@ const renderScene = () => {
};
const modelMouseClick = (event) => {
- mouse.x = (event.clientX / window.innerWidth) * 2 - 1;
- mouse.y = -(event.clientY / window.innerHeight) * 2 + 1;
- raycaster.setFromCamera(mouse, camera);
- const intersects = raycaster.intersectObject(scene, true);
- if (intersects.length > 0) {
- console.log(intersects[0].object);
- outlineObj(intersects[0].object);
- }
+ if (event.button != 0) return;
+ const mouse = new THREE.Vector2();
+ mouse.x = (event.clientX / window.innerWidth) * 2 - 1;
+ mouse.y = - (event.clientY / window.innerHeight) * 2 + 1;
+ const raycaster = new THREE.Raycaster();
+ raycaster.setFromCamera(mouse, camera);
+ const intersected = raycaster.intersectObject(scene, true)
+ if (intersected.length) {
+ // 其他材质恢复原材质,待研究
+ intersected.forEach(obj => {
+
+ obj.object.material.transparent = true;
+ let color = new THREE.Color(obj.object.material.color);
+ console.log(123,color);
+ obj.object.material.color.set(color);
+ })
+ intersected[0].object.material.color.set(0x66ff00);
+ renderer.render(scene, camera);
+ }
};
-//高亮
-const outlineObj = (object) => {
- object.material.color.set(0x66ff00);
-}