main
parent
5c070bbc93
commit
a99b67e2f5
Binary file not shown.
After Width: | Height: | Size: 4.9 KiB |
Binary file not shown.
After Width: | Height: | Size: 4.7 KiB |
|
@ -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对应的位置
|
||||
}
|
||||
|
||||
</script>
|
||||
<style lang='scss'>
|
||||
#gltf {
|
||||
|
|
Loading…
Reference in New Issue