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://www.ogre3d.org/
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(const void* target) const;
00062             void doSet(void* target, const String& val);
00063         };
00065         class CmdMaterial : public ParamCommand
00066         {
00067         public:
00068             String doGet(const void* target) const;
00069             void doSet(void* target, const String& val);
00070         };
00072         class CmdCull : public ParamCommand
00073         {
00074         public:
00075             String doGet(const void* target) const;
00076             void doSet(void* target, const String& val);
00077         };
00079         class CmdWidth : public ParamCommand
00080         {
00081         public:
00082             String doGet(const void* target) const;
00083             void doSet(void* target, const String& val);
00084         };
00086         class CmdHeight : public ParamCommand
00087         {
00088         public:
00089             String doGet(const void* target) const;
00090             void doSet(void* target, const String& val);
00091         };
00093         class CmdBillboardType : public ParamCommand
00094         {
00095         public:
00096             String doGet(const void* target) const;
00097             void doSet(void* target, const String& val);
00098         };
00100         class CmdCommonDirection : public ParamCommand
00101         {
00102         public:
00103             String doGet(const void* target) const;
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) const;
00255         const Quaternion& getWorldOrientation(void) const;
00257         const Vector3& getWorldPosition(void) const;
00258 
00261         void _updateBounds(void);
00262 
00275         void fastForward(Real time, Real interval = 0.1);
00276 
00278         virtual const String& getMovableType(void) const;
00279 
00280     protected:
00281 
00283         static CmdCull msCullCmd;
00284         static CmdHeight msHeightCmd;
00285         static CmdMaterial msMaterialCmd;
00286         static CmdQuota msQuotaCmd;
00287         static CmdWidth msWidthCmd;
00288         static CmdBillboardType msBillboardTypeCmd;
00289         static CmdCommonDirection msCommonDirectionCmd;
00290 
00291 
00293         String mName;
00294 
00295         typedef std::vector<ParticleEmitter*> ParticleEmitterList;
00296         typedef std::vector<ParticleAffector*> ParticleAffectorList;
00297         
00299         ParticleEmitterList mEmitters;
00301         ParticleAffectorList mAffectors;
00302 
00304         void _expire(Real timeElapsed);
00305 
00307         void _triggerEmitters(Real timeElapsed);
00308 
00310         void _applyMotion(Real timeElapsed);
00311 
00313         void _triggerAffectors(Real timeElapsed);
00314 
00316         void increasePool(unsigned int size);
00317 
00319         Particle* addParticle(void);
00320 
00325         void genBillboardAxes(Camera& cam, Vector3* pX, Vector3 *pY, const Billboard* pBill = 0);
00326 
00328         void initParameters(void);
00329 
00330     };
00331 }
00332 
00333 #endif

Copyright © 2002-2003 by The OGRE Team
Last modified Wed Jan 21 00:10:21 2004