From Tom Jolly. a couple of small changes to osgParticle.
"The first is with Particle.cpp. I made a change so that when the lifetime is 0 (lasts forever) the sizeRange, colorRange, and alphaRange are used to create a random size, color, and alpha." "The second change is with range and SectorPlacer. The distribution of particles across the sector was not uniform. I added get_random_sqrtf() function where it is used in SectorPlacer::Place(). This seems to make the distribution uniform (at least when minimum radius is 0)."
This commit is contained in:
@@ -86,9 +86,17 @@ bool osgParticle::Particle::update(double dt)
|
||||
}
|
||||
|
||||
// compute the current values for size, alpha and color.
|
||||
current_size_ = si_.get()->interpolate(x, sr_);
|
||||
current_alpha_ = ai_.get()->interpolate(x, ar_);
|
||||
current_color_ = ci_.get()->interpolate(x, cr_);
|
||||
if (lifetime_ <= 0) {
|
||||
if (dt == t0_) {
|
||||
current_size_ = sr_.get_random();
|
||||
current_alpha_ = ar_.get_random();
|
||||
current_color_ = cr_.get_random();
|
||||
}
|
||||
} else {
|
||||
current_size_ = si_.get()->interpolate(x, sr_);
|
||||
current_alpha_ = ai_.get()->interpolate(x, ar_);
|
||||
current_color_ = ci_.get()->interpolate(x, cr_);
|
||||
}
|
||||
|
||||
// update position
|
||||
prev_pos_ = position_;
|
||||
|
||||
Reference in New Issue
Block a user