OgreParticleEmitter.h
Go to the documentation of this file.
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/
Copyright (c) 2000-2013 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#ifndef __ParticleEmitter_H__
#define __ParticleEmitter_H__
#include "OgrePrerequisites.h"
#include "OgreString.h"
#include "OgreVector3.h"
#include "OgreColourValue.h"
#include "OgreStringInterface.h"
#include "OgreParticleEmitterCommands.h"
#include "OgreParticle.h"
#include "OgreHeaderPrefix.h"
namespace Ogre {
class _OgreExport ParticleEmitter : public StringInterface, public Particle
{
protected:
// Command object for setting / getting parameters
static EmitterCommands::CmdAngle msAngleCmd;
static EmitterCommands::CmdColour msColourCmd;
static EmitterCommands::CmdColourRangeStart msColourRangeStartCmd;
static EmitterCommands::CmdColourRangeEnd msColourRangeEndCmd;
static EmitterCommands::CmdDirection msDirectionCmd;
static EmitterCommands::CmdUp msUpCmd;
static EmitterCommands::CmdDirPositionRef msDirPositionRefCmd;
static EmitterCommands::CmdEmissionRate msEmissionRateCmd;
static EmitterCommands::CmdMaxTTL msMaxTTLCmd;
static EmitterCommands::CmdMaxVelocity msMaxVelocityCmd;
static EmitterCommands::CmdMinTTL msMinTTLCmd;
static EmitterCommands::CmdMinVelocity msMinVelocityCmd;
static EmitterCommands::CmdPosition msPositionCmd;
static EmitterCommands::CmdTTL msTTLCmd;
static EmitterCommands::CmdVelocity msVelocityCmd;
static EmitterCommands::CmdDuration msDurationCmd;
static EmitterCommands::CmdMinDuration msMinDurationCmd;
static EmitterCommands::CmdMaxDuration msMaxDurationCmd;
static EmitterCommands::CmdRepeatDelay msRepeatDelayCmd;
static EmitterCommands::CmdMinRepeatDelay msMinRepeatDelayCmd;
static EmitterCommands::CmdMaxRepeatDelay msMaxRepeatDelayCmd;
static EmitterCommands::CmdName msNameCmd;
static EmitterCommands::CmdEmittedEmitter msEmittedEmitterCmd;
ParticleSystem* mParent;
Vector3 mPosition;
Real mEmissionRate;
String mType;
Vector3 mDirection;
Vector3 mUp;
bool mUseDirPositionRef;
/* Center position to tell in which direction will particles be emitted according to their position,
useful for explosions & implosions, some emitters (i.e. point emitter) may not need it. */
Vector3 mDirPositionRef;
Radian mAngle;
Real mMinSpeed;
Real mMaxSpeed;
Real mMinTTL;
Real mMaxTTL;
ColourValue mColourRangeStart;
ColourValue mColourRangeEnd;
bool mEnabled;
Real mStartTime;
Real mDurationMin;
Real mDurationMax;
Real mDurationRemain;
Real mRepeatDelayMin;
Real mRepeatDelayMax;
Real mRepeatDelayRemain;
// Fractions of particles wanted to be emitted last time
Real mRemainder;
String mName;
String mEmittedEmitter;
// If 'true', this emitter is emitted by another emitter.
// NB. That doesn't imply that the emitter itself emits other emitters (that could or could not be the case)
bool mEmitted;
// NB Method below here are to help out people implementing emitters by providing the
// most commonly used approaches as piecemeal methods
virtual void genEmissionDirection( const Vector3 &particlePos, Vector3& destVector );
virtual void genEmissionVelocity(Vector3& destVector);
virtual Real genEmissionTTL(void);
virtual void genEmissionColour(ColourValue& destColour);
virtual unsigned short genConstantEmissionCount(Real timeElapsed);
void addBaseParameters(void);
void initDurationRepeat(void);
public:
ParticleEmitter(ParticleSystem* psys);
virtual ~ParticleEmitter();
virtual void setPosition(const Vector3& pos);
virtual const Vector3& getPosition(void) const;
virtual void setDirection(const Vector3& direction);
virtual const Vector3& getDirection(void) const;
virtual void setUp(const Vector3& up);
virtual const Vector3& getUp(void) const;
virtual void setDirPositionReference( const Vector3& position, bool enable );
virtual const Vector3& getDirPositionReference() const;
virtual bool getDirPositionReferenceEnabled() const;
virtual void setAngle(const Radian& angle);
virtual const Radian& getAngle(void) const;
virtual void setParticleVelocity(Real speed);
virtual void setParticleVelocity(Real min, Real max);
virtual void setMinParticleVelocity(Real min);
virtual void setMaxParticleVelocity(Real max);
virtual Real getParticleVelocity(void) const;
virtual Real getMinParticleVelocity(void) const;
virtual Real getMaxParticleVelocity(void) const;
virtual void setEmissionRate(Real particlesPerSecond);
virtual Real getEmissionRate(void) const;
virtual void setTimeToLive(Real ttl);
virtual void setTimeToLive(Real minTtl, Real maxTtl);
virtual void setMinTimeToLive(Real min);
virtual void setMaxTimeToLive(Real max);
virtual Real getTimeToLive(void) const;
virtual Real getMinTimeToLive(void) const;
virtual Real getMaxTimeToLive(void) const;
virtual void setColour(const ColourValue& colour);
virtual void setColour(const ColourValue& colourStart, const ColourValue& colourEnd);
virtual void setColourRangeStart(const ColourValue& colour);
virtual void setColourRangeEnd(const ColourValue& colour);
virtual const ColourValue& getColour(void) const;
virtual const ColourValue& getColourRangeStart(void) const;
virtual const ColourValue& getColourRangeEnd(void) const;
virtual unsigned short _getEmissionCount(Real timeElapsed) = 0;
virtual void _initParticle(Particle* pParticle) {
// Initialise size in case it's been altered
pParticle->resetDimensions();
}
const String &getType(void) const { return mType; }
virtual void setEnabled(bool enabled);
virtual bool getEnabled(void) const;
virtual void setStartTime(Real startTime);
virtual Real getStartTime(void) const;
virtual void setDuration(Real duration);
virtual Real getDuration(void) const;
virtual void setDuration(Real min, Real max);
virtual void setMinDuration(Real min);
virtual void setMaxDuration(Real max);
virtual Real getMinDuration(void) const;
virtual Real getMaxDuration(void) const;
virtual void setRepeatDelay(Real duration);
virtual Real getRepeatDelay(void) const;
virtual void setRepeatDelay(Real min, Real max);
virtual void setMinRepeatDelay(Real min);
virtual void setMaxRepeatDelay(Real max);
virtual Real getMinRepeatDelay(void) const;
virtual Real getMaxRepeatDelay(void) const;
const String &getName(void) const;
virtual void setName(const String& newName);
const String &getEmittedEmitter(void) const;
virtual void setEmittedEmitter(const String& emittedEmitter);
virtual bool isEmitted(void) const;
virtual void setEmitted(bool emitted);
};
}
#include "OgreHeaderSuffix.h"
#endif
Ogre::ParticleEmitter::mDirPositionRef
Vector3 mDirPositionRef
Definition: OgreParticleEmitter.h:118
Ogre::ParticleEmitter::msMaxDurationCmd
static EmitterCommands::CmdMaxDuration msMaxDurationCmd
Definition: OgreParticleEmitter.h:94
Ogre::ParticleEmitter::msDurationCmd
static EmitterCommands::CmdDuration msDurationCmd
Definition: OgreParticleEmitter.h:92
Ogre::EmitterCommands::CmdMinTTL
Command object for particle emitter - see ParamCommand.
Definition: OgreParticleEmitterCommands.h:134
Ogre::EmitterCommands::CmdMaxRepeatDelay
Command object for particle emitter - see ParamCommand.
Definition: OgreParticleEmitterCommands.h:190
Ogre::EmitterCommands::CmdEmissionRate
Command object for particle emitter - see ParamCommand.
Definition: OgreParticleEmitterCommands.h:99
Ogre::ParticleEmitter::msMinTTLCmd
static EmitterCommands::CmdMinTTL msMinTTLCmd
Definition: OgreParticleEmitter.h:87
Ogre::ParticleEmitter::mRepeatDelayMax
Real mRepeatDelayMax
Definition: OgreParticleEmitter.h:148
OgreVector3.h
Ogre::EmitterCommands::CmdVelocity
Command object for particle emitter - see ParamCommand.
Definition: OgreParticleEmitterCommands.h:106
_OgreExport
#define _OgreExport
Definition: OgrePlatform.h:257
Ogre::ParticleEmitter::msColourCmd
static EmitterCommands::CmdColour msColourCmd
Definition: OgreParticleEmitter.h:78
Ogre::EmitterCommands::CmdColour
Command object for particle emitter - see ParamCommand.
Definition: OgreParticleEmitterCommands.h:52
Ogre::ParticleEmitter::mColourRangeEnd
ColourValue mColourRangeEnd
Initial colour of particles (range end)
Definition: OgreParticleEmitter.h:132
Ogre::ParticleEmitter::msTTLCmd
static EmitterCommands::CmdTTL msTTLCmd
Definition: OgreParticleEmitter.h:90
Ogre::ParticleEmitter::mMaxTTL
Real mMaxTTL
Initial time-to-live of particles (max)
Definition: OgreParticleEmitter.h:128
Ogre::ParticleEmitter::msDirectionCmd
static EmitterCommands::CmdDirection msDirectionCmd
Definition: OgreParticleEmitter.h:81
Ogre::ParticleEmitter::mName
String mName
The name of the emitter. The name is optional unless it is used as an emitter that is emitted itself...
Definition: OgreParticleEmitter.h:156
Ogre::ColourValue
Class representing colour.
Definition: OgreColourValue.h:57
Ogre::Real
float Real
Software floating point type.
Definition: OgrePrerequisites.h:70
Ogre::ParticleEmitter::msMaxRepeatDelayCmd
static EmitterCommands::CmdMaxRepeatDelay msMaxRepeatDelayCmd
Definition: OgreParticleEmitter.h:97
OgreString.h
Ogre::EmitterCommands::CmdRepeatDelay
Command object for particle emitter - see ParamCommand.
Definition: OgreParticleEmitterCommands.h:176
Ogre::EmitterCommands::CmdMaxTTL
Command object for particle emitter - see ParamCommand.
Definition: OgreParticleEmitterCommands.h:141
OgreParticle.h
Ogre::ParticleEmitter::msMinDurationCmd
static EmitterCommands::CmdMinDuration msMinDurationCmd
Definition: OgreParticleEmitter.h:93
Ogre::ParticleEmitter::mDurationMax
Real mDurationMax
Maximum length of time the emitter will run for (0 = forever)
Definition: OgreParticleEmitter.h:142
Ogre::EmitterCommands::CmdMaxDuration
Command object for particle emitter - see ParamCommand.
Definition: OgreParticleEmitterCommands.h:169
Ogre::EmitterCommands::CmdName
Command object for particle emitter - see ParamCommand.
Definition: OgreParticleEmitterCommands.h:197
Ogre::ParticleEmitter::mAngle
Radian mAngle
Angle around direction which particles may be emitted, internally radians but angleunits for interfac...
Definition: OgreParticleEmitter.h:120
Ogre::ParticleEmitter::msMaxTTLCmd
static EmitterCommands::CmdMaxTTL msMaxTTLCmd
Definition: OgreParticleEmitter.h:85
Ogre::ParticleEmitter::msRepeatDelayCmd
static EmitterCommands::CmdRepeatDelay msRepeatDelayCmd
Definition: OgreParticleEmitter.h:95
Ogre::ParticleEmitter::mStartTime
Real mStartTime
Start time (in seconds from start of first call to ParticleSystem to update)
Definition: OgreParticleEmitter.h:138
Ogre::ParticleEmitter::mPosition
Vector3 mPosition
Position relative to the center of the ParticleSystem.
Definition: OgreParticleEmitter.h:105
Ogre::ParticleEmitter::msMaxVelocityCmd
static EmitterCommands::CmdMaxVelocity msMaxVelocityCmd
Definition: OgreParticleEmitter.h:86
Ogre::ParticleEmitter::mMinTTL
Real mMinTTL
Initial time-to-live of particles (min)
Definition: OgreParticleEmitter.h:126
Ogre::Vector3
Standard 3-dimensional vector.
Definition: OgreVector3.h:51
Ogre::ParticleEmitter::msPositionCmd
static EmitterCommands::CmdPosition msPositionCmd
Definition: OgreParticleEmitter.h:89
Ogre::ParticleEmitter::msMinVelocityCmd
static EmitterCommands::CmdMinVelocity msMinVelocityCmd
Definition: OgreParticleEmitter.h:88
OgrePrerequisites.h
Ogre::ParticleEmitter::msAngleCmd
static EmitterCommands::CmdAngle msAngleCmd
Definition: OgreParticleEmitter.h:77
Ogre::EmitterCommands::CmdUp
Command object for particle emitter - see ParamCommand.
Definition: OgreParticleEmitterCommands.h:83
Ogre::ParticleEmitter::msColourRangeStartCmd
static EmitterCommands::CmdColourRangeStart msColourRangeStartCmd
Definition: OgreParticleEmitter.h:79
Ogre::ParticleEmitter::msColourRangeEndCmd
static EmitterCommands::CmdColourRangeEnd msColourRangeEndCmd
Definition: OgreParticleEmitter.h:80
Ogre::EmitterCommands::CmdMinDuration
Command object for particle emitter - see ParamCommand.
Definition: OgreParticleEmitterCommands.h:162
Ogre::EmitterCommands::CmdDirection
Command object for particle emitter - see ParamCommand.
Definition: OgreParticleEmitterCommands.h:75
Ogre::ParticleEmitter::msMinRepeatDelayCmd
static EmitterCommands::CmdMinRepeatDelay msMinRepeatDelayCmd
Definition: OgreParticleEmitter.h:96
Ogre::ParticleEmitter::msEmissionRateCmd
static EmitterCommands::CmdEmissionRate msEmissionRateCmd
Definition: OgreParticleEmitter.h:84
Ogre::StringInterface
Class defining the common interface which classes can use to present a reflection-style, self-defining parameter set to callers.
Definition: OgreStringInterface.h:163
Ogre::Particle::resetDimensions
void resetDimensions(void)
Utility method to reset this particle.
Ogre::EmitterCommands::CmdDirPositionRef
Command object for particle emitter - see ParamCommand.
Definition: OgreParticleEmitterCommands.h:91
Ogre::ParticleEmitter::mRemainder
Real mRemainder
Definition: OgreParticleEmitter.h:153
Ogre::String
_StringBase String
Definition: OgrePrerequisites.h:439
Ogre::ParticleEmitter::mEnabled
bool mEnabled
Whether this emitter is currently enabled (defaults to true)
Definition: OgreParticleEmitter.h:135
Ogre::ParticleEmitter::mDirection
Vector3 mDirection
Base direction of the emitter, may not be used by some emitters.
Definition: OgreParticleEmitter.h:111
Ogre::ParticleEmitter::getType
const String & getType(void) const
Returns the name of the type of emitter.
Definition: OgreParticleEmitter.h:431
Ogre::EmitterCommands::CmdMinRepeatDelay
Command object for particle emitter - see ParamCommand.
Definition: OgreParticleEmitterCommands.h:183
Ogre::EmitterCommands::CmdDuration
Command object for particle emitter - see ParamCommand.
Definition: OgreParticleEmitterCommands.h:155
Ogre::ParticleEmitter::mDurationRemain
Real mDurationRemain
Current duration remainder.
Definition: OgreParticleEmitter.h:144
Ogre::ParticleEmitter::_initParticle
virtual void _initParticle(Particle *pParticle)
Initialises a particle based on the emitter&#39;s approach and parameters.
Definition: OgreParticleEmitter.h:420
OgreHeaderSuffix.h
Ogre::EmitterCommands::CmdMaxVelocity
Command object for particle emitter - see ParamCommand.
Definition: OgreParticleEmitterCommands.h:120
Ogre::Particle
Class representing a single particle instance.
Definition: OgreParticle.h:61
Ogre::ParticleEmitter::mParent
ParticleSystem * mParent
Parent particle system.
Definition: OgreParticleEmitter.h:103
Ogre::EmitterCommands::CmdMinVelocity
Command object for particle emitter - see ParamCommand.
Definition: OgreParticleEmitterCommands.h:113
Ogre
Definition: OgreAndroidLogListener.h:34
Ogre::EmitterCommands::CmdTTL
Command object for particle emitter - see ParamCommand.
Definition: OgreParticleEmitterCommands.h:127
Ogre::ParticleEmitter::mRepeatDelayMin
Real mRepeatDelayMin
Time between each repeat.
Definition: OgreParticleEmitter.h:147
Ogre::ParticleEmitter
Abstract class defining the interface to be implemented by particle emitters.
Definition: OgreParticleEmitter.h:72
Ogre::ParticleEmitter::msUpCmd
static EmitterCommands::CmdUp msUpCmd
Definition: OgreParticleEmitter.h:82
Ogre::EmitterCommands::CmdColourRangeStart
Command object for particle emitter - see ParamCommand.
Definition: OgreParticleEmitterCommands.h:60
Ogre::ParticleEmitter::mUseDirPositionRef
bool mUseDirPositionRef
When true, mDirPositionRef is used instead of mDirection to generate particles.
Definition: OgreParticleEmitter.h:115
Ogre::ParticleEmitter::msVelocityCmd
static EmitterCommands::CmdVelocity msVelocityCmd
Definition: OgreParticleEmitter.h:91
OgreColourValue.h
Ogre::ParticleEmitter::mColourRangeStart
ColourValue mColourRangeStart
Initial colour of particles (range start)
Definition: OgreParticleEmitter.h:130
OgreHeaderPrefix.h
Ogre::ParticleEmitter::mEmissionRate
Real mEmissionRate
Rate in particles per second at which this emitter wishes to emit particles.
Definition: OgreParticleEmitter.h:107
Ogre::EmitterCommands::CmdEmittedEmitter
Command object for particle emitter - see ParamCommand.
Definition: OgreParticleEmitterCommands.h:205
Ogre::ParticleEmitter::mRepeatDelayRemain
Real mRepeatDelayRemain
Repeat delay left.
Definition: OgreParticleEmitter.h:150
Ogre::ParticleEmitter::msDirPositionRefCmd
static EmitterCommands::CmdDirPositionRef msDirPositionRefCmd
Definition: OgreParticleEmitter.h:83
Ogre::ParticleSystem
Class defining particle system based special effects.
Definition: OgreParticleSystem.h:67
Ogre::ParticleEmitter::mType
String mType
Name of the type of emitter, MUST be initialised by subclasses.
Definition: OgreParticleEmitter.h:109
OgreParticleEmitterCommands.h
Ogre::ParticleEmitter::msEmittedEmitterCmd
static EmitterCommands::CmdEmittedEmitter msEmittedEmitterCmd
Definition: OgreParticleEmitter.h:99
Ogre::ParticleEmitter::mEmittedEmitter
String mEmittedEmitter
The name of the emitter to be emitted (optional)
Definition: OgreParticleEmitter.h:159
Ogre::EmitterCommands::CmdColourRangeEnd
Command object for particle emitter - see ParamCommand.
Definition: OgreParticleEmitterCommands.h:67
OgreStringInterface.h
Ogre::ParticleEmitter::mMinSpeed
Real mMinSpeed
Min speed of particles.
Definition: OgreParticleEmitter.h:122
Ogre::ParticleEmitter::msNameCmd
static EmitterCommands::CmdName msNameCmd
Definition: OgreParticleEmitter.h:98
Ogre::EmitterCommands::CmdAngle
Command object for ParticleEmitter - see ParamCommand.
Definition: OgreParticleEmitterCommands.h:45
Ogre::ParticleEmitter::mEmitted
bool mEmitted
Definition: OgreParticleEmitter.h:163
Ogre::EmitterCommands::CmdPosition
Command object for particle emitter - see ParamCommand.
Definition: OgreParticleEmitterCommands.h:148
Ogre::ParticleEmitter::mMaxSpeed
Real mMaxSpeed
Max speed of particles.
Definition: OgreParticleEmitter.h:124
Ogre::Radian
Wrapper class which indicates a given angle value is in Radians.
Definition: OgreMath.h:47
Ogre::ParticleEmitter::mUp
Vector3 mUp
Notional up vector, used to speed up generation of variant directions, and also to orient some emitte...
Definition: OgreParticleEmitter.h:113
Ogre::ParticleEmitter::mDurationMin
Real mDurationMin
Minimum length of time emitter will run for (0 = forever)
Definition: OgreParticleEmitter.h:140

Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.