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

OgreParticleSystem.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 __ParticleSystem_H__
00026 #define __ParticleSystem_H__
00027 
00028 #include "OgrePrerequisites.h"
00029 
00030 #include "OgreBillboardSet.h"
00031 #include "OgreVector3.h"
00032 #include "OgreString.h"
00033 #include "OgreAxisAlignedBox.h"
00034 #include "OgreParticleIterator.h"
00035 #include "OgreStringInterface.h"
00036 
00037 namespace Ogre {
00038 
00053     class _OgreExport ParticleSystem : public BillboardSet
00054     {
00055     public:
00056 
00058         class CmdQuota : public ParamCommand
00059         {
00060         public:
00061             String doGet(void* target);
00062             void doSet(void* target, const String& val);
00063         };
00065         class CmdMaterial : public ParamCommand
00066         {
00067         public:
00068             String doGet(void* target);
00069             void doSet(void* target, const String& val);
00070         };
00072         class CmdCull : public ParamCommand
00073         {
00074         public:
00075             String doGet(void* target);
00076             void doSet(void* target, const String& val);
00077         };
00079         class CmdWidth : public ParamCommand
00080         {
00081         public:
00082             String doGet(void* target);
00083             void doSet(void* target, const String& val);
00084         };
00086         class CmdHeight : public ParamCommand
00087         {
00088         public:
00089             String doGet(void* target);
00090             void doSet(void* target, const String& val);
00091         };
00093         class CmdBillboardType : public ParamCommand
00094         {
00095         public:
00096             String doGet(void* target);
00097             void doSet(void* target, const String& val);
00098         };
00100         class CmdCommonDirection : public ParamCommand
00101         {
00102         public:
00103             String doGet(void* target);
00104             void doSet(void* target, const String& val);
00105         };
00106 
00108         ParticleSystem();
00114         ParticleSystem(const String& name);
00115 
00116         virtual ~ParticleSystem();
00117 
00119         virtual const String& getName(void) const;
00120 
00130         ParticleEmitter* addEmitter(const String& emitterType);
00131 
00141         ParticleEmitter* getEmitter(unsigned short index) const;
00142 
00144         unsigned short getNumEmitters(void) const;
00145 
00154         void removeEmitter(unsigned short index);
00155 
00157         void removeAllEmitters(void);
00158 
00159 
00169         ParticleAffector* addAffector(const String& affectorType);
00170 
00180         ParticleAffector* getAffector(unsigned short index) const;
00181 
00183         unsigned short getNumAffectors(void) const;
00184 
00193         void removeAffector(unsigned short index);
00194 
00196         void removeAllAffectors(void);
00197 
00205         unsigned int getNumParticles(void) const;
00206 
00211         unsigned int getParticleQuota(void) const;
00212 
00223         void setParticleQuota(unsigned int quota);
00224 
00225 
00231         ParticleSystem& operator=(const ParticleSystem& rhs);
00232 
00239         void _update(Real timeElapsed);
00240 
00247         ParticleIterator _getIterator(void);
00248 
00253         void getWorldTransforms(Matrix4* xform);
00254 
00257         void _updateBounds(void);
00258 
00271         void fastForward(Real time, Real interval = 0.1);
00272     protected:
00273 
00275         static CmdCull msCullCmd;
00276         static CmdHeight msHeightCmd;
00277         static CmdMaterial msMaterialCmd;
00278         static CmdQuota msQuotaCmd;
00279         static CmdWidth msWidthCmd;
00280         static CmdBillboardType msBillboardTypeCmd;
00281         static CmdCommonDirection msCommonDirectionCmd;
00282 
00283 
00285         String mName;
00286 
00287         typedef std::vector<ParticleEmitter*> ParticleEmitterList;
00288         typedef std::vector<ParticleAffector*> ParticleAffectorList;
00289         
00291         ParticleEmitterList mEmitters;
00293         ParticleAffectorList mAffectors;
00294 
00296         void _expire(Real timeElapsed);
00297 
00299         void _triggerEmitters(Real timeElapsed);
00300 
00302         void _applyMotion(Real timeElapsed);
00303 
00305         void _triggerAffectors(Real timeElapsed);
00306 
00308         void increasePool(unsigned int size);
00309 
00311         Particle* addParticle(void);
00312 
00317         void genBillboardAxes(Camera& cam, Vector3* pX, Vector3 *pY, const Billboard* pBill = 0);
00318 
00320         void initParameters(void);
00321 
00322     };
00323 }
00324 
00325 #endif

Copyright © 2002 by The OGRE Team