Added SmokeTrailEffect which renders created particles as single quad or line

strip, in the case of the quad strip the strip is aligned to the be orthogonal with
the eye point.
This commit is contained in:
Robert Osfield
2005-10-12 18:42:36 +00:00
parent 540e676dae
commit 1e508d432b
16 changed files with 611 additions and 73 deletions

View File

@@ -68,17 +68,19 @@ void osgParticle::ParticleSystem::update(double dt)
// reset bounds
_reset_bounds_flag = true;
// set up iterators for particles
Particle_vector::iterator i;
Particle_vector::iterator end = _particles.end();
// update particles
for (i=_particles.begin(); i!=end; ++i) {
if (i->isAlive()) {
if (i->update(dt)) {
update_bounds(i->getPosition(), i->getCurrentSize());
} else {
_deadparts.push(&(*i));
for(unsigned int i=0; i<_particles.size(); ++i)
{
Particle& particle = _particles[i];
if (particle.isAlive())
{
if (particle.update(dt))
{
update_bounds(particle.getPosition(), particle.getCurrentSize());
}
else
{
reuseParticle(i);
}
}
}
@@ -141,6 +143,8 @@ void osgParticle::ParticleSystem::setDefaultAttributes(const std::string& textur
texture->setImage(osgDB::readImageFile(texturefile));
texture->setFilter(osg::Texture2D::MIN_FILTER, osg::Texture2D::LINEAR);
texture->setFilter(osg::Texture2D::MAG_FILTER, osg::Texture2D::LINEAR);
texture->setWrap(osg::Texture2D::WRAP_S, osg::Texture2D::MIRROR);
texture->setWrap(osg::Texture2D::WRAP_T, osg::Texture2D::MIRROR);
stateset->setTextureAttributeAndModes(texture_unit, texture, osg::StateAttribute::ON);
osg::TexEnv *texenv = new osg::TexEnv;