changed to -HUGE_VAL as drose suggested; added clear_floor_z

This commit is contained in:
Dave Schuyler 2004-10-13 22:19:34 +00:00
parent a3cf589261
commit a0d7a72b5e
3 changed files with 13 additions and 2 deletions

View File

@ -242,6 +242,15 @@ clear_spawn_templates() {
_spawn_templates.end());
}
////////////////////////////////////////////////////////////////////
// Function : clear_floor_z
// Access : Public
////////////////////////////////////////////////////////////////////
INLINE void ParticleSystem::
clear_floor_z() {
_floor_z = -HUGE_VAL;
}
//// /////////////////////////////////////////////////////
//// GET METHODS /////////////////////////////////////////////////////
//// /////////////////////////////////////////////////////

View File

@ -55,7 +55,7 @@ ParticleSystem(int pool_size) :
_system_lifespan = 0.0f;
_i_was_spawned_flag = false;
_particle_pool_size = 0;
_floor_z = _FPCLASS_NINF;
_floor_z = -HUGE_VAL;
// just in case someone tries to do something that requires the
// use of an emitter, renderer, or factory before they've actually
@ -512,7 +512,7 @@ update(float dt) {
//cerr<<"bp->get_position().get_z() returning "<<bp->get_position().get_z()<<endl;
if (age >= bp->get_lifespan()) {
kill_particle(current_index);
} else if (get_floor_z() != _FPCLASS_NINF
} else if (get_floor_z() != -HUGE_VAL
&& bp->get_position().get_z() <= get_floor_z()) {
// ...the particle is going under the floor.
// Maybe tell the particle to bounce: bp->bounce()?

View File

@ -70,6 +70,8 @@ PUBLISHED:
INLINE void set_emitter(BaseParticleEmitter *e);
INLINE void set_factory(BaseParticleFactory *f);
INLINE void set_floor_z(float z);
INLINE void clear_floor_z();
INLINE int get_pool_size() const;
INLINE float get_birth_rate() const;