Panda3D
baseParticleFactory.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file baseParticleFactory.h
10  * @author charles
11  * @date 2000-07-05
12  */
13 
14 #ifndef BASEPARTICLEFACTORY_H
15 #define BASEPARTICLEFACTORY_H
16 
17 #include "pandabase.h"
18 #include "referenceCount.h"
19 
20 #include "baseParticle.h"
21 #include "particleCommonFuncs.h"
22 
23 #include <stdlib.h>
24 
25 /**
26  * Pure Virtual base class for creating particles
27  */
28 class EXPCL_PANDA_PARTICLESYSTEM BaseParticleFactory : public ReferenceCount {
29 PUBLISHED:
30  virtual ~BaseParticleFactory();
31 
32  INLINE void set_lifespan_base(PN_stdfloat lb);
33  INLINE void set_lifespan_spread(PN_stdfloat ls);
34  INLINE void set_mass_base(PN_stdfloat mb);
35  INLINE void set_mass_spread(PN_stdfloat ms);
36  INLINE void set_terminal_velocity_base(PN_stdfloat tvb);
37  INLINE void set_terminal_velocity_spread(PN_stdfloat tvs);
38 
39  INLINE PN_stdfloat get_lifespan_base() const;
40  INLINE PN_stdfloat get_lifespan_spread() const;
41  INLINE PN_stdfloat get_mass_base() const;
42  INLINE PN_stdfloat get_mass_spread() const;
43  INLINE PN_stdfloat get_terminal_velocity_base() const;
44  INLINE PN_stdfloat get_terminal_velocity_spread() const;
45 
46  virtual BaseParticle *alloc_particle() const = 0;
47 
48  void populate_particle(BaseParticle* bp);
49 
50  virtual void output(std::ostream &out) const;
51  virtual void write(std::ostream &out, int indent=0) const;
52 
53 protected:
56 
57 private:
58  PN_stdfloat _lifespan_base;
59  PN_stdfloat _lifespan_spread;
60 
61  PN_stdfloat _mass_base;
62  PN_stdfloat _mass_spread;
63 
64  PN_stdfloat _terminal_velocity_base;
65  PN_stdfloat _terminal_velocity_spread;
66 
67  virtual void populate_child_particle(BaseParticle *bp) const = 0;
68 };
69 
70 #include "baseParticleFactory.I"
71 
72 #endif // BASEPARTICLEFACTORY_H
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Pure Virtual base class for creating particles.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
Definition: indent.cxx:20
A base class for all things that want to be reference-counted.
An individual, physically-modelable particle abstract base class.
Definition: baseParticle.h:23