diff --git a/public/yg.png b/public/yg.png new file mode 100644 index 0000000..5aa4f1d Binary files /dev/null and b/public/yg.png differ diff --git a/public/ygr.png b/public/ygr.png new file mode 100644 index 0000000..52310e2 Binary files /dev/null and b/public/ygr.png differ diff --git a/src/views/bim/bimHome/components/ThreeView2.vue b/src/views/bim/bimHome/components/ThreeView2.vue index 24bd8e2..de350e4 100644 --- a/src/views/bim/bimHome/components/ThreeView2.vue +++ b/src/views/bim/bimHome/components/ThreeView2.vue @@ -126,6 +126,11 @@ const loadSence = () => { gltfLoader.load('/jzc/scene.gltf', (gltf) => { var model = gltf.scene; roamdObjects = model.children[0].children; + model.traverse((obj)=>{ + if (enableGroup.indexOf(obj.name) != -1){ + xfobj.push(obj); + } + }); scene.add(model); }); }; @@ -438,6 +443,32 @@ const setBottom = () => { isRemoveBottom.value = !isRemoveBottom.value; } +// 消防 +const xiaof = () => { + xfobj.forEach((o)=>{ + xfadd(o,Math.random() < 0.3); + }) +} +let xfobj = []; +// 消防标签 +const xfadd = (obj,state)=> { + const texLoader= new THREE.TextureLoader(); + let texture = null; + if(state){ + texture= texLoader.load("/ygr.png"); + }else{ + texture = texLoader.load("/yg.png"); + } + const spriteMaterial = new THREE.SpriteMaterial({ + map: texture, + }); + const sprite = new THREE.Sprite(spriteMaterial); + // 控制精灵大小 + sprite.scale.set(5, 5, 5); + sprite.position.y = 5; //标签底部箭头和空对象标注点重合 + obj.add(sprite); //tag会标注在空对象obj对应的位置 +} +