openscenegraph
ModularEmitter
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>
22#include <osgParticle/Placer>
24#include <osgParticle/Shooter>
27
28#include <osg/ref_ptr>
29#include <osg/CopyOp>
30#include <osg/Object>
31#include <osg/Node>
32#include <osg/NodeVisitor>
33
34namespace 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;
96 osg::ref_ptr<Shooter> _shooter;
97 };
98
99 // INLINE FUNCTIONS
100
102 {
103 return _counter.get();
104 }
105
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
147 {
148 return _shooter.get();
149 }
150
152 {
153 _shooter = s;
154 }
155
156}
157
158#endif
Definition Counter:24
Definition Emitter:35
Definition ModularEmitter:44
ModularEmitter & operator=(const ModularEmitter &)
Definition ModularEmitter:87
void setPlacer(Placer *p)
Set the Placer object.
Definition ModularEmitter:136
void setShooter(Shooter *s)
Set the Shooter object.
Definition ModularEmitter:151
Counter * getCounter()
Get the counter object.
Definition ModularEmitter:101
float getNumParticlesToCreateMovementCompensationRatio() const
Get the ratio between number of particle to create in compensation for movement of the emitter.
Definition ModularEmitter:116
META_Node(osgParticle, ModularEmitter)
virtual ~ModularEmitter()
Definition ModularEmitter:86
void setNumParticlesToCreateMovementCompensationRatio(float r)
Set the ratio between number of particle to create in compenstation for movement of the emitter.
Definition ModularEmitter:121
virtual void emitParticles(double dt)
void setCounter(Counter *c)
Set the Counter object.
Definition ModularEmitter:111
Placer * getPlacer()
Get the Placer object.
Definition ModularEmitter:126
Shooter * getShooter()
Get the Shooter object.
Definition ModularEmitter:141
ModularEmitter(const ModularEmitter &copy, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
Definition Placer:31
Definition Shooter:30
Definition CopyOp:41
@ SHALLOW_COPY
Definition CopyOp:47
Definition ref_ptr:32
Definition AccelOperator:27
#define OSGPARTICLE_EXPORT
Definition osgParticle/Export:40