From 2dba1104d0b35f6a4900a6ef1f67e18cd8f1db0f Mon Sep 17 00:00:00 2001 From: wangqiujuan0808 <578331299@qq.com> Date: Tue, 9 Jan 2024 19:34:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=85=E9=99=A4=E6=B6=88=E9=98=B2=E7=B2=BE?= =?UTF-8?q?=E7=81=B5=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bim/bimHome/components/ThreeView2.vue | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/src/views/bim/bimHome/components/ThreeView2.vue b/src/views/bim/bimHome/components/ThreeView2.vue index 4a2de19..b4a4531 100644 --- a/src/views/bim/bimHome/components/ThreeView2.vue +++ b/src/views/bim/bimHome/components/ThreeView2.vue @@ -125,11 +125,13 @@ Bus.on('clickApplication', (isParent) => { } }) - +// 监听底部菜单切换 watch(() => bimStore().activateMenu, value => { // 更换场景颜色 scene.background = new THREE.Color(value.background); toHomeView(); + // 移除消防图标 + removexf(); }, { deep: true }); const init = () => { @@ -219,6 +221,7 @@ const renderScene = () => { // console.log('坐标', cameraX, cameraY, cameraZ); TWEEN.update(); controls.update(); + renderer.clear(); renderer.render(scene, camera); labelRenderer.render(scene, camera); }; @@ -618,28 +621,29 @@ const xfadd = (obj, state) => { sprite.scale.set(5, 5, 5); sprite.position.y = 12; //标签底部箭头和空对象标注点重合 obj.add(sprite); //tag会标注在空对象obj对应的位置 - console.log(123, obj) } // 移除消防标签 const removexf = () => { - model.traverse(e => { - if (e.isMesh && e.children.length > 0) { - e.remove(e.children[0]) - } else { - e.traverse(o => { - if (o.isMesh && o.children.length > 0) { - o.remove(o.children[0]) - } - }) + // model.traverse(e => { + // if (e.isMesh && e.children.length > 0) { + // e.remove(e.children[0]) + // } else { + // e.traverse(o => { + // if (o.isMesh && o.children.length > 0) { + // o.remove(o.children[0]) + // } + // }) - } + // } + // }) + console.log(xfobj.length); + xfobj.forEach((o) => { + // 倒序 + o.remove(o.children[o.children.length-1]); }) - scene.remove(sprite); } // 更换纹理贴图方法 const changeMap = (img) => { - // 测试移除消防图标 - removexf(); isShowWall.value = true; // 获取墙体 model.traverse(e => {