Panda3D
 All Classes Functions Variables Enumerations
baseParticleEmitter.h
1 // Filename: baseParticleEmitter.h
2 // Created by: charles (14Jun00)
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 BASEPARTICLEEMITTER_H
16 #define BASEPARTICLEEMITTER_H
17 
18 #include "pandabase.h"
19 #include "referenceCount.h"
20 #include "luse.h"
21 
22 #include "particleCommonFuncs.h"
23 
24 #include "mathNumbers.h"
25 
26 ////////////////////////////////////////////////////////////// //////
27 // Class : BaseParticleEmitter
28 // Description : Describes a physical region in space in which
29 // particles are randomly generated.
30 ////////////////////////////////////////////////////////////////////
31 class EXPCL_PANDAPHYSICS BaseParticleEmitter : public ReferenceCount {
32 PUBLISHED:
33  enum emissionType {
34  ET_EXPLICIT, // all particles are emitted in parallel along the same vector
35  ET_RADIATE, // all particles radiate away from a single point
36  ET_CUSTOM // particle launch vectors are dependent on particular derived emitter
37  };
38 
39  virtual ~BaseParticleEmitter();
40  virtual BaseParticleEmitter *make_copy() = 0;
41 
42  void generate(LPoint3& pos, LVector3& vel);
43 
44  INLINE void set_emission_type(emissionType et);
45  INLINE void set_amplitude(PN_stdfloat a);
46  INLINE void set_amplitude_spread(PN_stdfloat as);
47  INLINE void set_offset_force(const LVector3& of); // this is a constant force applied to all particles
48  INLINE void set_explicit_launch_vector(const LVector3& elv);
49  INLINE void set_radiate_origin(const LPoint3& ro);
50 
51  INLINE emissionType get_emission_type() const;
52  INLINE PN_stdfloat get_amplitude() const;
53  INLINE PN_stdfloat get_amplitude_spread() const;
54  INLINE LVector3 get_offset_force() const;
55  INLINE LVector3 get_explicit_launch_vector() const;
56  INLINE LPoint3 get_radiate_origin() const;
57 
58  virtual void output(ostream &out) const;
59  virtual void write(ostream &out, int indent=0) const;
60 
61 protected:
64 
65  emissionType _emission_type;
66  LVector3 _explicit_launch_vector;
67  LPoint3 _radiate_origin;
68 
69  PN_stdfloat _amplitude;
70  PN_stdfloat _amplitude_spread;
71 
72 private:
73  // these should be called in sequence (pos, then vel)
74  virtual void assign_initial_position(LPoint3& pos) = 0;
75  virtual void assign_initial_velocity(LVector3& vel) = 0;
76 
77  LVector3 _offset_force;
78 };
79 
80 #include "baseParticleEmitter.I"
81 
82 #endif // BASEPARTICLEEMITTER_H
This is a three-component vector distance (as opposed to a three-component point, which represents a ...
Definition: lvector3.h:100
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
Definition: lpoint3.h:99
A base class for all things that want to be reference-counted.
Describes a physical region in space in which particles are randomly generated.