diff --git a/panda/src/particlesystem/particleSystem.I b/panda/src/particlesystem/particleSystem.I index 4da65ea58e..897a70648a 100644 --- a/panda/src/particlesystem/particleSystem.I +++ b/panda/src/particlesystem/particleSystem.I @@ -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 ///////////////////////////////////////////////////// //// ///////////////////////////////////////////////////// diff --git a/panda/src/particlesystem/particleSystem.cxx b/panda/src/particlesystem/particleSystem.cxx index 7cb31c179d..9f2003228e 100644 --- a/panda/src/particlesystem/particleSystem.cxx +++ b/panda/src/particlesystem/particleSystem.cxx @@ -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 "<get_position().get_z()<= 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()? diff --git a/panda/src/particlesystem/particleSystem.h b/panda/src/particlesystem/particleSystem.h index 097ea3d4e8..9744452356 100644 --- a/panda/src/particlesystem/particleSystem.h +++ b/panda/src/particlesystem/particleSystem.h @@ -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;