baseParticleFactory.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. // Filename: baseParticleFactory.h
  2. // Created by: charles (05Jul00)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) Carnegie Mellon University. All rights reserved.
  8. //
  9. // All use of this software is subject to the terms of the revised BSD
  10. // license. You should have received a copy of this license along
  11. // with this source code in a file named "LICENSE."
  12. //
  13. ////////////////////////////////////////////////////////////////////
  14. #ifndef BASEPARTICLEFACTORY_H
  15. #define BASEPARTICLEFACTORY_H
  16. #include "pandabase.h"
  17. #include "referenceCount.h"
  18. #include "baseParticle.h"
  19. #include "particleCommonFuncs.h"
  20. #include <stdlib.h>
  21. ////////////////////////////////////////////////////////////////////
  22. // Class : BaseParticleFactory
  23. // Description : Pure Virtual base class for creating particles
  24. ////////////////////////////////////////////////////////////////////
  25. class EXPCL_PANDAPHYSICS BaseParticleFactory : public ReferenceCount {
  26. PUBLISHED:
  27. virtual ~BaseParticleFactory();
  28. INLINE void set_lifespan_base(PN_stdfloat lb);
  29. INLINE void set_lifespan_spread(PN_stdfloat ls);
  30. INLINE void set_mass_base(PN_stdfloat mb);
  31. INLINE void set_mass_spread(PN_stdfloat ms);
  32. INLINE void set_terminal_velocity_base(PN_stdfloat tvb);
  33. INLINE void set_terminal_velocity_spread(PN_stdfloat tvs);
  34. INLINE PN_stdfloat get_lifespan_base() const;
  35. INLINE PN_stdfloat get_lifespan_spread() const;
  36. INLINE PN_stdfloat get_mass_base() const;
  37. INLINE PN_stdfloat get_mass_spread() const;
  38. INLINE PN_stdfloat get_terminal_velocity_base() const;
  39. INLINE PN_stdfloat get_terminal_velocity_spread() const;
  40. virtual BaseParticle *alloc_particle() const = 0;
  41. void populate_particle(BaseParticle* bp);
  42. virtual void output(ostream &out) const;
  43. virtual void write(ostream &out, int indent=0) const;
  44. protected:
  45. BaseParticleFactory();
  46. BaseParticleFactory(const BaseParticleFactory &copy);
  47. private:
  48. PN_stdfloat _lifespan_base;
  49. PN_stdfloat _lifespan_spread;
  50. PN_stdfloat _mass_base;
  51. PN_stdfloat _mass_spread;
  52. PN_stdfloat _terminal_velocity_base;
  53. PN_stdfloat _terminal_velocity_spread;
  54. virtual void populate_child_particle(BaseParticle *bp) const = 0;
  55. };
  56. #include "baseParticleFactory.I"
  57. #endif // BASEPARTICLEFACTORY_H