main
cc 2023-12-15 05:20:29 +00:00
parent 5c070bbc93
commit a99b67e2f5
3 changed files with 31 additions and 0 deletions

BIN
public/yg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

BIN
public/ygr.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@ -126,6 +126,11 @@ const loadSence = () => {
gltfLoader.load('/jzc/scene.gltf', (gltf) => { gltfLoader.load('/jzc/scene.gltf', (gltf) => {
var model = gltf.scene; var model = gltf.scene;
roamdObjects = model.children[0].children; roamdObjects = model.children[0].children;
model.traverse((obj)=>{
if (enableGroup.indexOf(obj.name) != -1){
xfobj.push(obj);
}
});
scene.add(model); scene.add(model);
}); });
}; };
@ -438,6 +443,32 @@ const setBottom = () => {
isRemoveBottom.value = !isRemoveBottom.value; 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); //tagobj
}
</script> </script>
<style lang='scss'> <style lang='scss'>
#gltf { #gltf {