终于到了最后一节:粒子系统~惯例,直接上代码~
首先是创建粒子系统的代码~
Ogre::ParticleSystem* partSystem1 = _sceneManager ->createParticleSystem("Firework1", "Firework");
Ogre::SceneNode* node1 = _sceneManager ->getRootSceneNode() ->createChildSceneNode(Ogre::Vector3(0, 10, 0));
node1 ->attachObject(partSystem1);
然后是几个脚本的例子~
particle_system Firework
{
material Examples/Smoke
particle_width 10
particle_height 10
quota 5000
billboard_type point
emitter Point
{
emission_rate 100
direction 0 1 0
velocity 50
angle 360
duration 0.1
repeat_delay 1
colour_range_start 0 0 0
colour_range_end 1 1 1
}
}
particle_system MySmoke1
{
material Examples/Smoke
particle_width 10
particle_height 10
quota 500
billboard_type point
emitter Ring
{
height 50
width 50
inner_height 0.9
inner_width 0.9
emission_rate 50
direction 0 1 0
velocity 20
}
}
particle_system MySmoke2
{
material Examples/Smoke
particle_width 10
particle_height 10
quota 500
billboard_type point
emitter Box
{
height 50
width 50
depth 50
emission_rate 10
direction 0 1 0
velocity 20
}
}
particle_system MySmoke3
{
material Examples/Smoke
particle_width 10
particle_height 10
quota 500
billboard_type point
emitter Point
{
emission_rate 30
direction 1 0 0
velocity 20
time_to_live 4
angle 30
}
affector DeflectorPlane
{
plane_point 0 20 0
plane_normal 0 -1 0
bounce 1.0
}
}
其中affector用来动态改变粒子的各种属性,有:Scaler,ColourFader,ColourInterpolator,DirectionRandomiser,还有上面的DeflectorPlane