Panda3D
 All Classes Functions Variables Enumerations
baseParticleFactory.h
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 
15 #ifndef BASEPARTICLEFACTORY_H
16 #define BASEPARTICLEFACTORY_H
17 
18 #include "pandabase.h"
19 #include "referenceCount.h"
20 
21 #include "baseParticle.h"
22 #include "particleCommonFuncs.h"
23 
24 #include <stdlib.h>
25 
26 ////////////////////////////////////////////////////////////////////
27 // Class : BaseParticleFactory
28 // Description : Pure Virtual base class for creating particles
29 ////////////////////////////////////////////////////////////////////
30 class EXPCL_PANDAPHYSICS BaseParticleFactory : public ReferenceCount {
31 PUBLISHED:
32  virtual ~BaseParticleFactory();
33 
34  INLINE void set_lifespan_base(PN_stdfloat lb);
35  INLINE void set_lifespan_spread(PN_stdfloat ls);
36  INLINE void set_mass_base(PN_stdfloat mb);
37  INLINE void set_mass_spread(PN_stdfloat ms);
38  INLINE void set_terminal_velocity_base(PN_stdfloat tvb);
39  INLINE void set_terminal_velocity_spread(PN_stdfloat tvs);
40 
41  INLINE PN_stdfloat get_lifespan_base() const;
42  INLINE PN_stdfloat get_lifespan_spread() const;
43  INLINE PN_stdfloat get_mass_base() const;
44  INLINE PN_stdfloat get_mass_spread() const;
45  INLINE PN_stdfloat get_terminal_velocity_base() const;
46  INLINE PN_stdfloat get_terminal_velocity_spread() const;
47 
48  virtual BaseParticle *alloc_particle() const = 0;
49 
50  void populate_particle(BaseParticle* bp);
51 
52  virtual void output(ostream &out) const;
53  virtual void write(ostream &out, int indent=0) const;
54 
55 protected:
58 
59 private:
60  PN_stdfloat _lifespan_base;
61  PN_stdfloat _lifespan_spread;
62 
63  PN_stdfloat _mass_base;
64  PN_stdfloat _mass_spread;
65 
66  PN_stdfloat _terminal_velocity_base;
67  PN_stdfloat _terminal_velocity_spread;
68 
69  virtual void populate_child_particle(BaseParticle *bp) const = 0;
70 };
71 
72 #include "baseParticleFactory.I"
73 
74 #endif // BASEPARTICLEFACTORY_H
Pure Virtual base class for creating particles.
A base class for all things that want to be reference-counted.
An individual, physically-modelable particle abstract base class.
Definition: baseParticle.h:26