2
0
Эх сурвалжийг харах

changed to -HUGE_VAL as drose suggested; added clear_floor_z

Dave Schuyler 21 жил өмнө
parent
commit
a0d7a72b5e

+ 9 - 0
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 /////////////////////////////////////////////////////
 ////             /////////////////////////////////////////////////////

+ 2 - 2
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 "<<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()?

+ 2 - 0
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;