OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ModularEmitter.h
Go to the documentation of this file.
1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2  *
3  * This library is open source and may be redistributed and/or modified under
4  * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5  * (at your option) any later version. The full license is in LICENSE file
6  * included with this distribution, and on the openscenegraph.org website.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * OpenSceneGraph Public License for more details.
12 */
13 //osgParticle - Copyright (C) 2002 Marco Jez
14 
15 #ifndef OSGPARTICLE_MODULAREMITTER
16 #define OSGPARTICLE_MODULAREMITTER 1
17 
18 #include <osgParticle/Export>
19 #include <osgParticle/Emitter>
20 #include <osgParticle/Particle>
21 #include <osgParticle/RandomRateCounter>
22 #include <osgParticle/Placer>
23 #include <osgParticle/PointPlacer>
24 #include <osgParticle/Shooter>
25 #include <osgParticle/RadialShooter>
26 #include <osgParticle/ParticleSystem>
27 
28 #include <osg/ref_ptr>
29 #include <osg/CopyOp>
30 #include <osg/Object>
31 #include <osg/Node>
32 #include <osg/NodeVisitor>
33 
34 namespace osgParticle
35 {
36 
45  public:
48 
50 
52  inline Counter* getCounter();
53 
55  inline const Counter* getCounter() const;
56 
58  inline void setCounter(Counter* c);
59 
61  inline float getNumParticlesToCreateMovementCompensationRatio() const;
62 
64  inline void setNumParticlesToCreateMovementCompensationRatio(float r);
65 
66 
68  inline Placer* getPlacer();
69 
71  inline const Placer* getPlacer() const;
72 
74  inline void setPlacer(Placer* p);
75 
77  inline Shooter *getShooter();
78 
80  inline const Shooter *getShooter() const;
81 
83  inline void setShooter(Shooter *s);
84 
85  protected:
86  virtual ~ModularEmitter() {}
87  ModularEmitter &operator=(const ModularEmitter &) { return *this; }
88 
89  virtual void emitParticles(double dt);
90 
91  private:
92 
93  float _numParticleToCreateMovementCompensationRatio;
94  osg::ref_ptr<Counter> _counter;
95  osg::ref_ptr<Placer> _placer;
96  osg::ref_ptr<Shooter> _shooter;
97  };
98 
99  // INLINE FUNCTIONS
100 
102  {
103  return _counter.get();
104  }
105 
106  inline const Counter* ModularEmitter::getCounter() const
107  {
108  return _counter.get();
109  }
110 
112  {
113  _counter = c;
114  }
115 
117  {
118  return _numParticleToCreateMovementCompensationRatio;
119  }
120 
122  {
123  _numParticleToCreateMovementCompensationRatio = r;
124  }
125 
127  {
128  return _placer.get();
129  }
130 
131  inline const Placer* ModularEmitter::getPlacer() const
132  {
133  return _placer.get();
134  }
135 
137  {
138  _placer = p;
139  }
140 
142  {
143  return _shooter.get();
144  }
145 
146  inline const Shooter *ModularEmitter::getShooter() const
147  {
148  return _shooter.get();
149  }
150 
152  {
153  _shooter = s;
154  }
155 
156 }
157 
158 #endif
Shooter * getShooter()
Get the Shooter object.
Placer * getPlacer()
Get the Placer object.
void setCounter(Counter *c)
Set the Counter object.
ModularEmitter & operator=(const ModularEmitter &)
#define META_Node(library, name)
Definition: Node.h:59
float getNumParticlesToCreateMovementCompensationRatio() const
Get the ratio between number of particle to create in compensation for movement of the emitter...
void setNumParticlesToCreateMovementCompensationRatio(float r)
Set the ratio between number of particle to create in compenstation for movement of the emitter...
#define OSGPARTICLE_EXPORT
Definition: Export.h:40
Counter * getCounter()
Get the counter object.
void setShooter(Shooter *s)
Set the Shooter object.
void setPlacer(Placer *p)
Set the Placer object.