Panda3D
baseParticleEmitter.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 baseParticleEmitter.h
10  * @author charles
11  * @date 2000-06-14
12  */
13 
14 #ifndef BASEPARTICLEEMITTER_H
15 #define BASEPARTICLEEMITTER_H
16 
17 #include "pandabase.h"
18 #include "referenceCount.h"
19 #include "luse.h"
20 
21 #include "particleCommonFuncs.h"
22 
23 #include "mathNumbers.h"
24 
25 class EXPCL_PANDA_PARTICLESYSTEM BaseParticleEmitter : public ReferenceCount {
26 PUBLISHED:
27  enum emissionType {
28  ET_EXPLICIT, // all particles are emitted in parallel along the same vector
29  ET_RADIATE, // all particles radiate away from a single point
30  ET_CUSTOM // particle launch vectors are dependent on particular derived emitter
31  };
32 
33  virtual ~BaseParticleEmitter();
34  virtual BaseParticleEmitter *make_copy() = 0;
35 
36  void generate(LPoint3& pos, LVector3& vel);
37 
38  INLINE void set_emission_type(emissionType et);
39  INLINE void set_amplitude(PN_stdfloat a);
40  INLINE void set_amplitude_spread(PN_stdfloat as);
41  INLINE void set_offset_force(const LVector3& of); // this is a constant force applied to all particles
42  INLINE void set_explicit_launch_vector(const LVector3& elv);
43  INLINE void set_radiate_origin(const LPoint3& ro);
44 
45  INLINE emissionType get_emission_type() const;
46  INLINE PN_stdfloat get_amplitude() const;
47  INLINE PN_stdfloat get_amplitude_spread() const;
48  INLINE LVector3 get_offset_force() const;
49  INLINE LVector3 get_explicit_launch_vector() const;
50  INLINE LPoint3 get_radiate_origin() const;
51 
52  virtual void output(std::ostream &out) const;
53  virtual void write(std::ostream &out, int indent=0) const;
54 
55 protected:
58 
59  emissionType _emission_type;
60  LVector3 _explicit_launch_vector;
61  LPoint3 _radiate_origin;
62 
63  PN_stdfloat _amplitude;
64  PN_stdfloat _amplitude_spread;
65 
66 private:
67  // these should be called in sequence (pos, then vel)
68  virtual void assign_initial_position(LPoint3& pos) = 0;
69  virtual void assign_initial_velocity(LVector3& vel) = 0;
70 
71  LVector3 _offset_force;
72 };
73 
74 #include "baseParticleEmitter.I"
75 
76 #endif // BASEPARTICLEEMITTER_H
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.