three三维火焰------火箭火焰

//添加火焰
function addFire() {
fireGroup = new THREE.Group();
var plane = new THREE.PlaneBufferGeometry(500, 2000, 1);
fire1 = new THREE.Fire(plane, {
textureWidth: 512,
textureHeight: 512,
debug: false
});
fire1.rotation.y = 0
fire2 = new THREE.Fire(plane, {
textureWidth: 512,
textureHeight: 512,
debug: false
});
fire2.rotation.y = 1.52;
fire3 = new THREE.Fire(plane, {
textureWidth: 512,
textureHeight: 512,
debug: false
});
fire3.rotation.y = 3.14;
fire4 = new THREE.Fire(plane, {
textureWidth: 512,
textureHeight: 512,
debug: false
});
fire4.rotation.y = 4.66;
updateAll(fire1)
updateAll(fire2)
updateAll(fire3)
updateAll(fire4)
var paramsFire = {
//基本效果
Single: function () {//单焰效果
fire1.clearSources();
fire1.addSource(0.5, 0.1, 0.1, 0.2, 0.0, 0);
fire2.clearSources();
fire2.addSource(0.5, 0.1, 0.1, 0.2, 0.0, 0.1);
fire3.clearSources();
fire3.addSource(0.5, 0.1, 0.1, 0.2, 0.0, 0.1);
fire4.clearSources();
fire4.addSource(0.5, 0.1, 0.1, 0.2, 0.0, 0.1);
},
Multiple: function () {//多焰效果
fire.clearSources();
fire.addSource(0.1, 0.1, 0.1, 0.5, 0.0, 1.0);
fire.addSource(0.4, 0.1, 0.1, 0.5, 0.0, 1.0);
fire.addSource(0.7, 0.1, 0.1, 0.5, 0.0, 1.0);
},
}
function updateAll(fire) {
fire.color1.set(’#0xffdcaa’);//内焰
fire.color2.set(’#0xffa000’);//外焰
fire.color3.set(’#0x0’);//烟雾
fire.colorBias=0.94;//颜色偏差
fire.burnRate=1;//燃烧率
fire.diffuse=1.33;//扩散
fire.viscosity=0.25;//粘度
fire.expansion=0;//膨胀
fire.swirl=50;//漩涡
fire.drag=0.35;//拖拽
fire.airSpeed=10;//空气速度
fire.speed=100;//火焰速度
// windX: 0.0,//风向X
// windY: 0,//风向Y
// windZ: 0.75,//风向Y
fire.massConservation=true;//质量守恒
}
fireGroup.add(fire1)
fireGroup.add(fire2)
fireGroup.add(fire3)
fireGroup.add(fire4)
fireGroup.position.z = -1000
fireGroup.rotation.x = -1.57
paramsFire.Single();
return fireGroup;
}

发布了6 篇原创文章 · 获赞 3 · 访问量 3967

猜你喜欢

转载自blog.csdn.net/qwqwqz/article/details/103240744