8 #define RAND1 .4 * rand() / (float) RAND_MAX - .2
11 #include <irrlicht/irrlicht.h>
60 Particle ( scene::ISceneManager* mgr,
62 const core::vector3df &position,
63 std::vector< video::ITexture* >& textures,
69 bool dynamicLights =
false );
79 int lifetime ) : pos_( position ),
82 lifetime_( lifetime ) {}
100 float dx = pos_.X - p.
pos_.X;
101 float dy = pos_.Y - p.
pos_.Y;
102 float dz = pos_.Y - p.
pos_.Y;
103 return sqrt( dx * dx + dy * dy + dz * dz );
124 for ( uint i = 0; i < sprites_.size(); ++i ) {
126 sprites_[i]->setPosition( sprites_[i]->getPosition() + d
136 for ( uint i = 0; i < sprites_.size(); ++i ) {
137 sprites_[i]->setColor( c );
147 for ( uint i = 0; i < sprites_.size(); ++i ) {
148 sprites_[i]->setSize( core::dimension2df( sz, sz ) );
152 void setTexture( std::vector< video::ITexture* >& textures ) {
153 for ( uint i = 0; i < sprites_.size(); ++i ) {
154 sprites_[i]->setMaterialTexture( 0, textures[ rand() % textures.size() ] );
161 for ( uint i = 0; i < sprites_.size(); ++i ) {
162 sprites_[i]->setMaterialType( video::EMT_TRANSPARENT_ALPHA_CHANNEL );
163 sprites_[i]->setColor( video::SColor( 255 * lifetime_ * colorCoeff,
164 255 * lifetime_ * colorCoeff,
165 255 * lifetime_ * colorCoeff,
166 255 * lifetime_ * colorCoeff ) );
168 sprites_[i]->removeAll();
175 for ( uint i = 0; i < sprites_.size(); ++i ) {
176 sprites_[i]->remove();
188 std::vector< scene::IBillboardSceneNode* >
sprites_;