Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

OgreParticleEmitter.h

Go to the documentation of this file.
00001 /*
00002 -----------------------------------------------------------------------------
00003 This source file is part of OGRE 
00004     (Object-oriented Graphics Rendering Engine)
00005 For the latest info, see http://ogre.sourceforge.net/
00006 
00007 Copyright © 2000-2002 The OGRE Team
00008 Also see acknowledgements in Readme.html
00009 
00010 This program is free software; you can redistribute it and/or modify it under 
00011 the terms of the GNU Lesser General Public License as published by the Free Software 
00012 Foundation; either version 2 of the License, or (at your option) any later 
00013 version.
00014 
00015 This program is distributed in the hope that it will be useful, but WITHOUT 
00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
00018 
00019 You should have received a copy of the GNU Lesser General Public License along with 
00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple 
00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to 
00022 http://www.gnu.org/copyleft/lesser.txt.
00023 -----------------------------------------------------------------------------
00024 */
00025 #ifndef __ParticleEmitter_H__
00026 #define __ParticleEmitter_H__
00027 
00028 #include "OgrePrerequisites.h"
00029 #include "OgreString.h"
00030 #include "OgreVector3.h"
00031 #include "OgreColourValue.h"
00032 #include "OgreStringInterface.h"
00033 #include "OgreParticleEmitterCommands.h"
00034 
00035 
00036 namespace Ogre {
00037 
00038 
00061     class _OgreExport ParticleEmitter : public StringInterface
00062     {
00063     protected:
00064 
00065         // Command object for setting / getting parameters
00066         static EmitterCommands::CmdAngle msAngleCmd;
00067         static EmitterCommands::CmdColour msColourCmd;
00068         static EmitterCommands::CmdColourRangeStart msColourRangeStartCmd;
00069         static EmitterCommands::CmdColourRangeEnd msColourRangeEndCmd;
00070         static EmitterCommands::CmdDirection msDirectionCmd;
00071         static EmitterCommands::CmdEmissionRate msEmissionRateCmd;
00072         static EmitterCommands::CmdMaxTTL msMaxTTLCmd;
00073         static EmitterCommands::CmdMaxVelocity msMaxVelocityCmd;
00074         static EmitterCommands::CmdMinTTL msMinTTLCmd;
00075         static EmitterCommands::CmdMinVelocity msMinVelocityCmd;
00076         static EmitterCommands::CmdPosition msPositionCmd;
00077         static EmitterCommands::CmdTTL msTTLCmd;
00078         static EmitterCommands::CmdVelocity msVelocityCmd;
00079         static EmitterCommands::CmdDuration msDurationCmd;
00080         static EmitterCommands::CmdMinDuration msMinDurationCmd;
00081         static EmitterCommands::CmdMaxDuration msMaxDurationCmd;
00082         static EmitterCommands::CmdRepeatDelay msRepeatDelayCmd;
00083         static EmitterCommands::CmdMinRepeatDelay msMinRepeatDelayCmd;
00084         static EmitterCommands::CmdMaxRepeatDelay msMaxRepeatDelayCmd;
00085 
00086 
00088         Vector3 mPosition;
00090         Real mEmissionRate;
00092         String mType;
00094         Vector3 mDirection;
00095         // Notional up vector, just used to speed up generation of variant directions
00096         Vector3 mUp;
00098         Real mAngle;
00100         Real mMinSpeed;
00102         Real mMaxSpeed;
00104         Real mMinTTL;
00106         Real mMaxTTL;
00108         ColourValue mColourRangeStart;
00110         ColourValue mColourRangeEnd;
00111 
00113         bool mEnabled;
00114 
00116         Real mStartTime;
00118         Real mDurationMin;
00120         Real mDurationMax;
00122         Real mDurationRemain;
00123 
00125         Real mRepeatDelayMin;
00126         Real mRepeatDelayMax;
00128         Real mRepeatDelayRemain;
00129 
00130 
00131 
00132         // NB Method below here are to help out people implementing emitters by providing the
00133         // most commonly used approaches as piecemeal methods
00134 
00138         virtual void genEmissionDirection(Vector3& destVector);
00139 
00144         virtual void genEmissionVelocity(Vector3& destVector);
00145 
00147         virtual Real genEmissionTTL(void);
00148 
00150         virtual void genEmissionColour(ColourValue& destColour);
00151 
00153         virtual unsigned short genConstantEmissionCount(Real timeElapsed);
00154 
00163         void addBaseParameters(void);
00164 
00165 
00166     public:
00167         ParticleEmitter();
00169         virtual ~ParticleEmitter();
00170 
00172         virtual void setPosition(const Vector3& pos);
00173 
00175         virtual Vector3 getPosition(void);
00176 
00186         virtual void setDirection(const Vector3& direction);
00187 
00189         virtual Vector3& getDirection(void);
00190 
00201         virtual void setAngle(Real degrees);
00202 
00204         virtual Real getAngle(void);
00205 
00213         virtual void setParticleVelocity(Real speed);
00214 
00215 
00225         virtual void setParticleVelocity(Real min, Real max);
00227         virtual void setMinParticleVelocity(Real min);
00229         virtual void setMaxParticleVelocity(Real max);
00230 
00232         virtual Real getParticleVelocity(void);
00233 
00235         virtual Real getMinParticleVelocity(void);
00236 
00238         virtual Real getMaxParticleVelocity(void);
00239 
00252         virtual void setEmissionRate(Real particlesPerSecond);
00253 
00255         virtual Real getEmissionRate(void);
00256 
00267         virtual void setTimeToLive(Real ttl);
00281         virtual void setTimeToLive(Real minTtl, Real maxTtl);
00282 
00284         virtual void setMinTimeToLive(Real min);
00286         virtual void setMaxTimeToLive(Real max);
00287         
00289         virtual Real getTimeToLive(void);
00290 
00292         virtual Real getMinTimeToLive(void);
00294         virtual Real getMaxTimeToLive(void);
00295 
00303         virtual void setColour(const ColourValue& colour);
00313         virtual void setColour(const ColourValue& colourStart, const ColourValue& colourEnd);
00315         virtual void setColourRangeStart(const ColourValue& colour);
00317         virtual void setColourRangeEnd(const ColourValue& colour);
00319         virtual ColourValue getColour(void);
00321         virtual ColourValue getColourRangeStart(void);
00323         virtual ColourValue getColourRangeEnd(void);
00324 
00337         virtual unsigned short _getEmissionCount(Real timeElapsed) = 0;
00338 
00348         virtual void _initParticle(Particle* pParticle) = 0;
00349 
00350 
00356         String getType(void) { return mType; }
00357 
00362         virtual void setEnabled(bool enabled);
00363 
00365         virtual bool getEnabled(void);
00366 
00374         virtual void setStartTime(Real startTime);
00376         virtual Real getStartTime(void);
00377 
00389         virtual void setDuration(Real duration);
00390 
00392         virtual Real getDuration(void);
00393 
00405         virtual void setDuration(Real min, Real max);
00407         virtual void setMinDuration(Real min);
00409         virtual void setMaxDuration(Real max);
00411         virtual Real getMinDuration(void);
00413         virtual Real getMaxDuration(void);
00414 
00424         virtual void setRepeatDelay(Real duration);
00425 
00427         virtual Real getRepeatDelay(void);
00428 
00440         virtual void setRepeatDelay(Real min, Real max);
00442         virtual void setMinRepeatDelay(Real min);
00444         virtual void setMaxRepeatDelay(Real max);
00446         virtual Real getMinRepeatDelay(void);
00448         virtual Real getMaxRepeatDelay(void);
00449 
00450 
00451 
00452     };
00453 
00454 }
00455 
00456 
00457 #endif
00458 

Copyright © 2002 by The OGRE Team