1 | /* |
---|
2 | ----------------------------------------------------------------------------- |
---|
3 | This source file is part of OGRE |
---|
4 | (Object-oriented Graphics Rendering Engine) |
---|
5 | For the latest info, see http://www.ogre3d.org/ |
---|
6 | |
---|
7 | Copyright (c) 2000-2013 Torus Knot Software Ltd |
---|
8 | |
---|
9 | Permission is hereby granted, free of charge, to any person obtaining a copy |
---|
10 | of this software and associated documentation files (the "Software"), to deal |
---|
11 | in the Software without restriction, including without limitation the rights |
---|
12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
---|
13 | copies of the Software, and to permit persons to whom the Software is |
---|
14 | furnished to do so, subject to the following conditions: |
---|
15 | |
---|
16 | The above copyright notice and this permission notice shall be included in |
---|
17 | all copies or substantial portions of the Software. |
---|
18 | |
---|
19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
---|
20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
---|
21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
---|
22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
---|
23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
---|
24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
---|
25 | THE SOFTWARE. |
---|
26 | ----------------------------------------------------------------------------- |
---|
27 | */ |
---|
28 | #ifndef __ParticleEmitter_H__ |
---|
29 | #define __ParticleEmitter_H__ |
---|
30 | |
---|
31 | #include "OgrePrerequisites.h" |
---|
32 | #include "OgreString.h" |
---|
33 | #include "OgreVector3.h" |
---|
34 | #include "OgreColourValue.h" |
---|
35 | #include "OgreStringInterface.h" |
---|
36 | #include "OgreParticleEmitterCommands.h" |
---|
37 | #include "OgreParticle.h" |
---|
38 | #include "OgreHeaderPrefix.h" |
---|
39 | |
---|
40 | |
---|
41 | namespace Ogre { |
---|
42 | |
---|
43 | |
---|
44 | /** \addtogroup Core |
---|
45 | * @{ |
---|
46 | */ |
---|
47 | /** \addtogroup Effects |
---|
48 | * @{ |
---|
49 | */ |
---|
50 | /** Abstract class defining the interface to be implemented by particle emitters. |
---|
51 | @remarks |
---|
52 | Particle emitters are the sources of particles in a particle system. |
---|
53 | This class defines the ParticleEmitter interface, and provides a basic implementation |
---|
54 | for tasks which most emitters will do (these are of course overridable). |
---|
55 | Particle emitters can be grouped into types, e.g. 'point' emitters, 'box' emitters etc; each type will |
---|
56 | create particles with a different starting point, direction and velocity (although |
---|
57 | within the types you can configure the ranges of these parameters). |
---|
58 | @par |
---|
59 | Because there are so many types of emitters you could use, OGRE chooses not to dictate |
---|
60 | the available types. It comes with some in-built, but allows plugins or applications to extend the emitter types available. |
---|
61 | This is done by subclassing ParticleEmitter to have the appropriate emission behaviour you want, |
---|
62 | and also creating a subclass of ParticleEmitterFactory which is responsible for creating instances |
---|
63 | of your new emitter type. You register this factory with the ParticleSystemManager using |
---|
64 | addEmitterFactory, and from then on emitters of this type can be created either from code or through |
---|
65 | text particle scripts by naming the type. |
---|
66 | @par |
---|
67 | This same approach is used for ParticleAffectors (which modify existing particles per frame). |
---|
68 | This means that OGRE is particularly flexible when it comes to creating particle system effects, |
---|
69 | with literally infinite combinations of emitter and affector types, and parameters within those |
---|
70 | types. |
---|
71 | */ |
---|
72 | class _OgreExport ParticleEmitter : public StringInterface, public Particle |
---|
73 | { |
---|
74 | protected: |
---|
75 | |
---|
76 | // Command object for setting / getting parameters |
---|
77 | static EmitterCommands::CmdAngle msAngleCmd; |
---|
78 | static EmitterCommands::CmdColour msColourCmd; |
---|
79 | static EmitterCommands::CmdColourRangeStart msColourRangeStartCmd; |
---|
80 | static EmitterCommands::CmdColourRangeEnd msColourRangeEndCmd; |
---|
81 | static EmitterCommands::CmdDirection msDirectionCmd; |
---|
82 | static EmitterCommands::CmdUp msUpCmd; |
---|
83 | static EmitterCommands::CmdDirPositionRef msDirPositionRefCmd; |
---|
84 | static EmitterCommands::CmdEmissionRate msEmissionRateCmd; |
---|
85 | static EmitterCommands::CmdMaxTTL msMaxTTLCmd; |
---|
86 | static EmitterCommands::CmdMaxVelocity msMaxVelocityCmd; |
---|
87 | static EmitterCommands::CmdMinTTL msMinTTLCmd; |
---|
88 | static EmitterCommands::CmdMinVelocity msMinVelocityCmd; |
---|
89 | static EmitterCommands::CmdPosition msPositionCmd; |
---|
90 | static EmitterCommands::CmdTTL msTTLCmd; |
---|
91 | static EmitterCommands::CmdVelocity msVelocityCmd; |
---|
92 | static EmitterCommands::CmdDuration msDurationCmd; |
---|
93 | static EmitterCommands::CmdMinDuration msMinDurationCmd; |
---|
94 | static EmitterCommands::CmdMaxDuration msMaxDurationCmd; |
---|
95 | static EmitterCommands::CmdRepeatDelay msRepeatDelayCmd; |
---|
96 | static EmitterCommands::CmdMinRepeatDelay msMinRepeatDelayCmd; |
---|
97 | static EmitterCommands::CmdMaxRepeatDelay msMaxRepeatDelayCmd; |
---|
98 | static EmitterCommands::CmdName msNameCmd; |
---|
99 | static EmitterCommands::CmdEmittedEmitter msEmittedEmitterCmd; |
---|
100 | |
---|
101 | |
---|
102 | /// Parent particle system |
---|
103 | ParticleSystem* mParent; |
---|
104 | /// Position relative to the center of the ParticleSystem |
---|
105 | Vector3 mPosition; |
---|
106 | /// Rate in particles per second at which this emitter wishes to emit particles |
---|
107 | Real mEmissionRate; |
---|
108 | /// Name of the type of emitter, MUST be initialised by subclasses |
---|
109 | String mType; |
---|
110 | /// Base direction of the emitter, may not be used by some emitters |
---|
111 | Vector3 mDirection; |
---|
112 | /// Notional up vector, used to speed up generation of variant directions, and also to orient some emitters. |
---|
113 | Vector3 mUp; |
---|
114 | /// When true, mDirPositionRef is used instead of mDirection to generate particles |
---|
115 | bool mUseDirPositionRef; |
---|
116 | /* Center position to tell in which direction will particles be emitted according to their position, |
---|
117 | useful for explosions & implosions, some emitters (i.e. point emitter) may not need it. */ |
---|
118 | Vector3 mDirPositionRef; |
---|
119 | /// Angle around direction which particles may be emitted, internally radians but angleunits for interface |
---|
120 | Radian mAngle; |
---|
121 | /// Min speed of particles |
---|
122 | Real mMinSpeed; |
---|
123 | /// Max speed of particles |
---|
124 | Real mMaxSpeed; |
---|
125 | /// Initial time-to-live of particles (min) |
---|
126 | Real mMinTTL; |
---|
127 | /// Initial time-to-live of particles (max) |
---|
128 | Real mMaxTTL; |
---|
129 | /// Initial colour of particles (range start) |
---|
130 | ColourValue mColourRangeStart; |
---|
131 | /// Initial colour of particles (range end) |
---|
132 | ColourValue mColourRangeEnd; |
---|
133 | |
---|
134 | /// Whether this emitter is currently enabled (defaults to true) |
---|
135 | bool mEnabled; |
---|
136 | |
---|
137 | /// Start time (in seconds from start of first call to ParticleSystem to update) |
---|
138 | Real mStartTime; |
---|
139 | /// Minimum length of time emitter will run for (0 = forever) |
---|
140 | Real mDurationMin; |
---|
141 | /// Maximum length of time the emitter will run for (0 = forever) |
---|
142 | Real mDurationMax; |
---|
143 | /// Current duration remainder |
---|
144 | Real mDurationRemain; |
---|
145 | |
---|
146 | /// Time between each repeat |
---|
147 | Real mRepeatDelayMin; |
---|
148 | Real mRepeatDelayMax; |
---|
149 | /// Repeat delay left |
---|
150 | Real mRepeatDelayRemain; |
---|
151 | |
---|
152 | // Fractions of particles wanted to be emitted last time |
---|
153 | Real mRemainder; |
---|
154 | |
---|
155 | /// The name of the emitter. The name is optional unless it is used as an emitter that is emitted itself. |
---|
156 | String mName; |
---|
157 | |
---|
158 | /// The name of the emitter to be emitted (optional) |
---|
159 | String mEmittedEmitter; |
---|
160 | |
---|
161 | // If 'true', this emitter is emitted by another emitter. |
---|
162 | // NB. That doesn't imply that the emitter itself emits other emitters (that could or could not be the case) |
---|
163 | bool mEmitted; |
---|
164 | |
---|
165 | // NB Method below here are to help out people implementing emitters by providing the |
---|
166 | // most commonly used approaches as piecemeal methods |
---|
167 | |
---|
168 | /** Internal utility method for generating particle exit direction |
---|
169 | @param destVector Reference to vector to complete with new direction (normalised) |
---|
170 | */ |
---|
171 | virtual void genEmissionDirection( const Vector3 &particlePos, Vector3& destVector ); |
---|
172 | |
---|
173 | /** Internal utility method to apply velocity to a particle direction. |
---|
174 | @param destVector The vector to scale by a randomly generated scale between min and max speed. |
---|
175 | Assumed normalised already, and likely already oriented in the right direction. |
---|
176 | */ |
---|
177 | virtual void genEmissionVelocity(Vector3& destVector); |
---|
178 | |
---|
179 | /** Internal utility method for generating a time-to-live for a particle. */ |
---|
180 | virtual Real genEmissionTTL(void); |
---|
181 | |
---|
182 | /** Internal utility method for generating a colour for a particle. */ |
---|
183 | virtual void genEmissionColour(ColourValue& destColour); |
---|
184 | |
---|
185 | /** Internal utility method for generating an emission count based on a constant emission rate. */ |
---|
186 | virtual unsigned short genConstantEmissionCount(Real timeElapsed); |
---|
187 | |
---|
188 | /** Internal method for setting up the basic parameter definitions for a subclass. |
---|
189 | @remarks |
---|
190 | Because StringInterface holds a dictionary of parameters per class, subclasses need to |
---|
191 | call this to ask the base class to add it's parameters to their dictionary as well. |
---|
192 | Can't do this in the constructor because that runs in a non-virtual context. |
---|
193 | @par |
---|
194 | The subclass must have called it's own createParamDictionary before calling this method. |
---|
195 | */ |
---|
196 | void addBaseParameters(void); |
---|
197 | |
---|
198 | /** Internal method for initialising the duration & repeat of an emitter. */ |
---|
199 | void initDurationRepeat(void); |
---|
200 | |
---|
201 | |
---|
202 | public: |
---|
203 | ParticleEmitter(ParticleSystem* psys); |
---|
204 | /** Virtual destructor essential. */ |
---|
205 | virtual ~ParticleEmitter(); |
---|
206 | |
---|
207 | /** Sets the position of this emitter relative to the particle system center. */ |
---|
208 | virtual void setPosition(const Vector3& pos); |
---|
209 | |
---|
210 | /** Returns the position of this emitter relative to the center of the particle system. */ |
---|
211 | virtual const Vector3& getPosition(void) const; |
---|
212 | |
---|
213 | /** Sets the direction of the emitter. |
---|
214 | @remarks |
---|
215 | Most emitters will have a base direction in which they emit particles (those which |
---|
216 | emit in all directions will ignore this parameter). They may not emit exactly along this |
---|
217 | vector for every particle, many will introduce a random scatter around this vector using |
---|
218 | the angle property. |
---|
219 | @note |
---|
220 | This resets the up vector. |
---|
221 | @param direction |
---|
222 | The base direction for particles emitted. |
---|
223 | */ |
---|
224 | virtual void setDirection(const Vector3& direction); |
---|
225 | |
---|
226 | /** Returns the base direction of the emitter. */ |
---|
227 | virtual const Vector3& getDirection(void) const; |
---|
228 | |
---|
229 | /** Sets the notional up vector of the emitter |
---|
230 | @remarks |
---|
231 | Many emitters emit particles from within a region, and for some that region is not |
---|
232 | circularly symmetric about the emitter direction. The up vector allows such emitters |
---|
233 | to be orientated about the direction vector. |
---|
234 | @param up |
---|
235 | The base direction for particles emitted. It must be perpendicular to the direction vector. |
---|
236 | */ |
---|
237 | virtual void setUp(const Vector3& up); |
---|
238 | |
---|
239 | /** Returns the up vector of the emitter. */ |
---|
240 | virtual const Vector3& getUp(void) const; |
---|
241 | |
---|
242 | /** Sets the direction of the emitter. |
---|
243 | Some particle effects need to emit particles in many random directions, but still |
---|
244 | following some rules; like not having them collide against each other. Very useful |
---|
245 | for explosions and implosions (when velocity is negative) |
---|
246 | @note |
---|
247 | Although once enabled mDirPositionRef will supersede mDirection; calling setDirection() |
---|
248 | may still be needed to setup a custom up vector. |
---|
249 | @param position |
---|
250 | The reference position in which the direction of the particles will be calculated from, |
---|
251 | also taking into account the particle's position at the time of emission. |
---|
252 | @param enable |
---|
253 | True to use mDirPositionRef, false to use the default behaviour with mDirection |
---|
254 | */ |
---|
255 | virtual void setDirPositionReference( const Vector3& position, bool enable ); |
---|
256 | |
---|
257 | /** Returns the position reference to generate direction of emitted particles */ |
---|
258 | virtual const Vector3& getDirPositionReference() const; |
---|
259 | |
---|
260 | /** Returns whether direction or position reference is used */ |
---|
261 | virtual bool getDirPositionReferenceEnabled() const; |
---|
262 | |
---|
263 | /** Sets the maximum angle away from the emitter direction which particle will be emitted. |
---|
264 | @remarks |
---|
265 | Whilst the direction property defines the general direction of emission for particles, |
---|
266 | this property defines how far the emission angle can deviate away from this base direction. |
---|
267 | This allows you to create a scatter effect - if set to 0, all particles will be emitted |
---|
268 | exactly along the emitters direction vector, whereas if you set it to 180 degrees or more, |
---|
269 | particles will be emitted in a sphere, i.e. in all directions. |
---|
270 | @param angle |
---|
271 | Maximum angle which initial particle direction can deviate from the emitter base direction vector. |
---|
272 | */ |
---|
273 | virtual void setAngle(const Radian& angle); |
---|
274 | |
---|
275 | /** Returns the maximum angle which the initial particle direction can deviate from the emitters base direction. */ |
---|
276 | virtual const Radian& getAngle(void) const; |
---|
277 | |
---|
278 | /** Sets the initial velocity of particles emitted. |
---|
279 | @remarks |
---|
280 | This method sets a constant speed for emitted particles. See the alternate version |
---|
281 | of this method which takes 2 parameters if you want a variable speed. |
---|
282 | @param |
---|
283 | speed The initial speed in world units per second which every particle emitted starts with. |
---|
284 | */ |
---|
285 | virtual void setParticleVelocity(Real speed); |
---|
286 | |
---|
287 | |
---|
288 | /** Sets the initial velocity range of particles emitted. |
---|
289 | @remarks |
---|
290 | This method sets the range of starting speeds for emitted particles. |
---|
291 | See the alternate version of this method which takes 1 parameter if you want a |
---|
292 | constant speed. This emitter will randomly choose a speed between the minimum and |
---|
293 | maximum for each particle. |
---|
294 | @param max The maximum speed in world units per second for the initial particle speed on emission. |
---|
295 | @param min The minimum speed in world units per second for the initial particle speed on emission. |
---|
296 | */ |
---|
297 | virtual void setParticleVelocity(Real min, Real max); |
---|
298 | /** Returns the minimum particle velocity. */ |
---|
299 | virtual void setMinParticleVelocity(Real min); |
---|
300 | /** Returns the maximum particle velocity. */ |
---|
301 | virtual void setMaxParticleVelocity(Real max); |
---|
302 | |
---|
303 | /** Returns the initial velocity of particles emitted. */ |
---|
304 | virtual Real getParticleVelocity(void) const; |
---|
305 | |
---|
306 | /** Returns the minimum particle velocity. */ |
---|
307 | virtual Real getMinParticleVelocity(void) const; |
---|
308 | |
---|
309 | /** Returns the maximum particle velocity. */ |
---|
310 | virtual Real getMaxParticleVelocity(void) const; |
---|
311 | |
---|
312 | /** Sets the emission rate for this emitter. |
---|
313 | @remarks |
---|
314 | This method tells the emitter how many particles per second should be emitted. The emitter |
---|
315 | subclass does not have to emit these in a continuous burst - this is a relative parameter |
---|
316 | and the emitter may choose to emit all of the second's worth of particles every half-second |
---|
317 | for example. This is controlled by the emitter's getEmissionCount method. |
---|
318 | @par |
---|
319 | Also, if the ParticleSystem's particle quota is exceeded, not all the particles requested |
---|
320 | may be actually emitted. |
---|
321 | @param |
---|
322 | particlesPerSecond The number of particles to be emitted every second. |
---|
323 | */ |
---|
324 | virtual void setEmissionRate(Real particlesPerSecond); |
---|
325 | |
---|
326 | /** Returns the emission rate set for this emitter. */ |
---|
327 | virtual Real getEmissionRate(void) const; |
---|
328 | |
---|
329 | /** Sets the lifetime of all particles emitted. |
---|
330 | @remarks |
---|
331 | The emitter initialises particles with a time-to-live (TTL), the number of seconds a particle |
---|
332 | will exist before being destroyed. This method sets a constant TTL for all particles emitted. |
---|
333 | Note that affectors are able to modify the TTL of particles later. |
---|
334 | @par |
---|
335 | Also see the alternate version of this method which takes a min and max TTL in order to |
---|
336 | have the TTL vary per particle. |
---|
337 | @param ttl The number of seconds each particle will live for. |
---|
338 | */ |
---|
339 | virtual void setTimeToLive(Real ttl); |
---|
340 | /** Sets the range of lifetime for particles emitted. |
---|
341 | @remarks |
---|
342 | The emitter initialises particles with a time-to-live (TTL), the number of seconds a particle |
---|
343 | will exist before being destroyed. This method sets a range for the TTL for all particles emitted; |
---|
344 | the ttl may be randomised between these 2 extremes or will vary some other way depending on the |
---|
345 | emitter. |
---|
346 | Note that affectors are able to modify the TTL of particles later. |
---|
347 | @par |
---|
348 | Also see the alternate version of this method which takes a single TTL in order to |
---|
349 | set a constant TTL for all particles. |
---|
350 | @param minTtl The minimum number of seconds each particle will live for. |
---|
351 | @param maxTtl The maximum number of seconds each particle will live for. |
---|
352 | */ |
---|
353 | virtual void setTimeToLive(Real minTtl, Real maxTtl); |
---|
354 | |
---|
355 | /** Sets the minimum time each particle will live for. */ |
---|
356 | virtual void setMinTimeToLive(Real min); |
---|
357 | /** Sets the maximum time each particle will live for. */ |
---|
358 | virtual void setMaxTimeToLive(Real max); |
---|
359 | |
---|
360 | /** Gets the time each particle will live for. */ |
---|
361 | virtual Real getTimeToLive(void) const; |
---|
362 | |
---|
363 | /** Gets the minimum time each particle will live for. */ |
---|
364 | virtual Real getMinTimeToLive(void) const; |
---|
365 | /** Gets the maximum time each particle will live for. */ |
---|
366 | virtual Real getMaxTimeToLive(void) const; |
---|
367 | |
---|
368 | /** Sets the initial colour of particles emitted. |
---|
369 | @remarks |
---|
370 | Particles have an initial colour on emission which the emitter sets. This method sets |
---|
371 | this colour. See the alternate version of this method which takes 2 colours in order to establish |
---|
372 | a range of colours to be assigned to particles. |
---|
373 | @param colour The colour which all particles will be given on emission. |
---|
374 | */ |
---|
375 | virtual void setColour(const ColourValue& colour); |
---|
376 | /** Sets the range of colours for emitted particles. |
---|
377 | @remarks |
---|
378 | Particles have an initial colour on emission which the emitter sets. This method sets |
---|
379 | the range of this colour. See the alternate version of this method which takes a single colour |
---|
380 | in order to set a constant colour for all particles. Emitters may choose to randomly assign |
---|
381 | a colour in this range, or may use some other method to vary the colour. |
---|
382 | @param colourStart The start of the colour range |
---|
383 | @param colourEnd The end of the colour range |
---|
384 | */ |
---|
385 | virtual void setColour(const ColourValue& colourStart, const ColourValue& colourEnd); |
---|
386 | /** Sets the minimum colour of particles to be emitted. */ |
---|
387 | virtual void setColourRangeStart(const ColourValue& colour); |
---|
388 | /** Sets the maximum colour of particles to be emitted. */ |
---|
389 | virtual void setColourRangeEnd(const ColourValue& colour); |
---|
390 | /** Gets the colour of particles to be emitted. */ |
---|
391 | virtual const ColourValue& getColour(void) const; |
---|
392 | /** Gets the minimum colour of particles to be emitted. */ |
---|
393 | virtual const ColourValue& getColourRangeStart(void) const; |
---|
394 | /** Gets the maximum colour of particles to be emitted. */ |
---|
395 | virtual const ColourValue& getColourRangeEnd(void) const; |
---|
396 | |
---|
397 | /** Gets the number of particles which this emitter would like to emit based on the time elapsed. |
---|
398 | @remarks |
---|
399 | For efficiency the emitter does not actually create new Particle instances (these are reused |
---|
400 | by the ParticleSystem as existing particles 'die'). The implementation for this method must |
---|
401 | return the number of particles the emitter would like to emit given the number of seconds which |
---|
402 | have elapsed (passed in as a parameter). |
---|
403 | @par |
---|
404 | Based on the return value from this method, the ParticleSystem class will call |
---|
405 | _initParticle once for each particle it chooses to allow to be emitted by this emitter. |
---|
406 | The emitter should not track these _initParticle calls, it should assume all emissions |
---|
407 | requested were made (even if they could not be because of particle quotas). |
---|
408 | */ |
---|
409 | virtual unsigned short _getEmissionCount(Real timeElapsed) = 0; |
---|
410 | |
---|
411 | /** Initialises a particle based on the emitter's approach and parameters. |
---|
412 | @remarks |
---|
413 | See the _getEmissionCount method for details of why there is a separation between |
---|
414 | 'requested' emissions and actual initialised particles. |
---|
415 | @param |
---|
416 | pParticle Pointer to a particle which must be initialised based on how this emitter |
---|
417 | starts particles. This is passed as a pointer rather than being created by the emitter so the |
---|
418 | ParticleSystem can reuse Particle instances, and can also set defaults itself. |
---|
419 | */ |
---|
420 | virtual void _initParticle(Particle* pParticle) { |
---|
421 | // Initialise size in case it's been altered |
---|
422 | pParticle->resetDimensions(); |
---|
423 | } |
---|
424 | |
---|
425 | |
---|
426 | /** Returns the name of the type of emitter. |
---|
427 | @remarks |
---|
428 | This property is useful for determining the type of emitter procedurally so another |
---|
429 | can be created. |
---|
430 | */ |
---|
431 | const String &getType(void) const { return mType; } |
---|
432 | |
---|
433 | /** Sets whether or not the emitter is enabled. |
---|
434 | @remarks |
---|
435 | You can turn an emitter off completely by setting this parameter to false. |
---|
436 | */ |
---|
437 | virtual void setEnabled(bool enabled); |
---|
438 | |
---|
439 | /** Gets the flag indicating if this emitter is enabled or not. */ |
---|
440 | virtual bool getEnabled(void) const; |
---|
441 | |
---|
442 | /** Sets the 'start time' of this emitter. |
---|
443 | @remarks |
---|
444 | By default an emitter starts straight away as soon as a ParticleSystem is first created, |
---|
445 | or also just after it is re-enabled. This parameter allows you to set a time delay so |
---|
446 | that the emitter does not 'kick in' until later. |
---|
447 | @param startTime The time in seconds from the creation or enabling of the emitter. |
---|
448 | */ |
---|
449 | virtual void setStartTime(Real startTime); |
---|
450 | /** Gets the start time of the emitter. */ |
---|
451 | virtual Real getStartTime(void) const; |
---|
452 | |
---|
453 | /** Sets the duration of the emitter. |
---|
454 | @remarks |
---|
455 | By default emitters run indefinitely (unless you manually disable them). By setting this |
---|
456 | parameter, you can make an emitter turn off on it's own after a set number of seconds. It |
---|
457 | will then remain disabled until either setEnabled(true) is called, or if the 'repeatAfter' parameter |
---|
458 | has been set it will also repeat after a number of seconds. |
---|
459 | @par |
---|
460 | Also see the alternative version of this method which allows you to set a min and max duration for |
---|
461 | a random variable duration. |
---|
462 | @param duration The duration in seconds. |
---|
463 | */ |
---|
464 | virtual void setDuration(Real duration); |
---|
465 | |
---|
466 | /** Gets the duration of the emitter from when it is created or re-enabled. */ |
---|
467 | virtual Real getDuration(void) const; |
---|
468 | |
---|
469 | /** Sets the range of random duration for this emitter. |
---|
470 | @remarks |
---|
471 | By default emitters run indefinitely (unless you manually disable them). By setting this |
---|
472 | parameter, you can make an emitter turn off on it's own after a random number of seconds. It |
---|
473 | will then remain disabled until either setEnabled(true) is called, or if the 'repeatAfter' parameter |
---|
474 | has been set it will also repeat after a number of seconds. |
---|
475 | @par |
---|
476 | Also see the alternative version of this method which allows you to set a constant duration. |
---|
477 | @param min The minimum duration in seconds. |
---|
478 | @param max The minimum duration in seconds. |
---|
479 | */ |
---|
480 | virtual void setDuration(Real min, Real max); |
---|
481 | /** Sets the minimum duration of this emitter in seconds (see setDuration for more details) */ |
---|
482 | virtual void setMinDuration(Real min); |
---|
483 | /** Sets the maximum duration of this emitter in seconds (see setDuration for more details) */ |
---|
484 | virtual void setMaxDuration(Real max); |
---|
485 | /** Gets the minimum duration of this emitter in seconds (see setDuration for more details) */ |
---|
486 | virtual Real getMinDuration(void) const; |
---|
487 | /** Gets the maximum duration of this emitter in seconds (see setDuration for more details) */ |
---|
488 | virtual Real getMaxDuration(void) const; |
---|
489 | |
---|
490 | /** Sets the time between repeats of the emitter. |
---|
491 | @remarks |
---|
492 | By default emitters run indefinitely (unless you manually disable them). However, if you manually |
---|
493 | disable the emitter (by calling setEnabled(false), or it's duration runs out, it will cease to emit |
---|
494 | @par |
---|
495 | Also see the alternative version of this method which allows you to set a min and max duration for |
---|
496 | a random variable duration. |
---|
497 | @param duration The duration in seconds. |
---|
498 | */ |
---|
499 | virtual void setRepeatDelay(Real duration); |
---|
500 | |
---|
501 | /** Gets the duration of the emitter from when it is created or re-enabled. */ |
---|
502 | virtual Real getRepeatDelay(void) const; |
---|
503 | |
---|
504 | /** Sets the range of random duration for this emitter. |
---|
505 | @remarks |
---|
506 | By default emitters run indefinitely (unless you manually disable them). By setting this |
---|
507 | parameter, you can make an emitter turn off on it's own after a random number of seconds. It |
---|
508 | will then remain disabled until either setEnabled(true) is called, or if the 'repeatAfter' parameter |
---|
509 | has been set it will also repeat after a number of seconds. |
---|
510 | @par |
---|
511 | Also see the alternative version of this method which allows you to set a constant duration. |
---|
512 | @param min The minimum duration in seconds. |
---|
513 | @param max The minimum duration in seconds. |
---|
514 | */ |
---|
515 | virtual void setRepeatDelay(Real min, Real max); |
---|
516 | /** Sets the minimum duration of this emitter in seconds (see setRepeatDelay for more details) */ |
---|
517 | virtual void setMinRepeatDelay(Real min); |
---|
518 | /** Sets the maximum duration of this emitter in seconds (see setRepeatDelay for more details) */ |
---|
519 | virtual void setMaxRepeatDelay(Real max); |
---|
520 | /** Gets the minimum duration of this emitter in seconds (see setRepeatDelay for more details) */ |
---|
521 | virtual Real getMinRepeatDelay(void) const; |
---|
522 | /** Gets the maximum duration of this emitter in seconds (see setRepeatDelay for more details) */ |
---|
523 | virtual Real getMaxRepeatDelay(void) const; |
---|
524 | |
---|
525 | /** Returns the name of the emitter */ |
---|
526 | const String &getName(void) const; |
---|
527 | |
---|
528 | /** Sets the name of the emitter */ |
---|
529 | virtual void setName(const String& newName); |
---|
530 | |
---|
531 | /** Returns the name of the emitter to be emitted */ |
---|
532 | const String &getEmittedEmitter(void) const; |
---|
533 | |
---|
534 | /** Sets the name of the emitter to be emitted*/ |
---|
535 | virtual void setEmittedEmitter(const String& emittedEmitter); |
---|
536 | |
---|
537 | /** Return true if the emitter is emitted by another emitter */ |
---|
538 | virtual bool isEmitted(void) const; |
---|
539 | |
---|
540 | /** Set the indication (true/false) to indicate that the emitter is emitted by another emitter */ |
---|
541 | virtual void setEmitted(bool emitted); |
---|
542 | |
---|
543 | |
---|
544 | }; |
---|
545 | /** @} */ |
---|
546 | /** @} */ |
---|
547 | |
---|
548 | } |
---|
549 | |
---|
550 | #include "OgreHeaderSuffix.h" |
---|
551 | |
---|
552 | #endif |
---|
553 | |
---|