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 "OgreParticleIterator.h"
00034 #include "OgreStringInterface.h"
00035 
00036 namespace Ogre {
00037 
00052     class _OgreExport ParticleSystem : public BillboardSet
00053     {
00054     public:
00055 
00057         class CmdQuota : public ParamCommand
00058         {
00059         public:
00060             String doGet(const void* target) const;
00061             void doSet(void* target, const String& val);
00062         };
00064         class CmdMaterial : public ParamCommand
00065         {
00066         public:
00067             String doGet(const void* target) const;
00068             void doSet(void* target, const String& val);
00069         };
00071         class CmdCull : public ParamCommand
00072         {
00073         public:
00074             String doGet(const void* target) const;
00075             void doSet(void* target, const String& val);
00076         };
00078         class CmdWidth : public ParamCommand
00079         {
00080         public:
00081             String doGet(const void* target) const;
00082             void doSet(void* target, const String& val);
00083         };
00085         class CmdHeight : public ParamCommand
00086         {
00087         public:
00088             String doGet(const void* target) const;
00089             void doSet(void* target, const String& val);
00090         };
00092         class CmdBillboardType : public ParamCommand
00093         {
00094         public:
00095             String doGet(const void* target) const;
00096             void doSet(void* target, const String& val);
00097         };
00099         class CmdCommonDirection : public ParamCommand
00100         {
00101         public:
00102             String doGet(const void* target) const;
00103             void doSet(void* target, const String& val);
00104         };
00105 
00107         ParticleSystem();
00113         ParticleSystem(const String& name);
00114 
00115         virtual ~ParticleSystem();
00116 
00126         ParticleEmitter* addEmitter(const String& emitterType);
00127 
00137         ParticleEmitter* getEmitter(unsigned short index) const;
00138 
00140         unsigned short getNumEmitters(void) const;
00141 
00150         void removeEmitter(unsigned short index);
00151 
00153         void removeAllEmitters(void);
00154 
00155 
00165         ParticleAffector* addAffector(const String& affectorType);
00166 
00176         ParticleAffector* getAffector(unsigned short index) const;
00177 
00179         unsigned short getNumAffectors(void) const;
00180 
00189         void removeAffector(unsigned short index);
00190 
00192         void removeAllAffectors(void);
00193 
00201         unsigned int getNumParticles(void) const;
00202 
00207         unsigned int getParticleQuota(void) const;
00208 
00219         void setParticleQuota(unsigned int quota);
00220 
00221 
00227         ParticleSystem& operator=(const ParticleSystem& rhs);
00228 
00235         void _update(Real timeElapsed);
00236 
00243         ParticleIterator _getIterator(void);
00244 
00249         void getWorldTransforms(Matrix4* xform) const;
00251         const Quaternion& getWorldOrientation(void) const;
00253         const Vector3& getWorldPosition(void) const;
00254 
00257         void _updateBounds(void);
00258 
00271         void fastForward(Real time, Real interval = 0.1);
00272 
00274         virtual const String& getMovableType(void) const;
00275 
00276     protected:
00277 
00279         static CmdCull msCullCmd;
00280         static CmdHeight msHeightCmd;
00281         static CmdMaterial msMaterialCmd;
00282         static CmdQuota msQuotaCmd;
00283         static CmdWidth msWidthCmd;
00284         static CmdBillboardType msBillboardTypeCmd;
00285         static CmdCommonDirection msCommonDirectionCmd;
00286 
00287 
00288         typedef std::vector<ParticleEmitter*> ParticleEmitterList;
00289         typedef std::vector<ParticleAffector*> ParticleAffectorList;
00290         
00292         ParticleEmitterList mEmitters;
00294         ParticleAffectorList mAffectors;
00295 
00297         void _expire(Real timeElapsed);
00298 
00300         void _triggerEmitters(Real timeElapsed);
00301 
00303         void _applyMotion(Real timeElapsed);
00304 
00306         void _triggerAffectors(Real timeElapsed);
00307 
00309         void increasePool(unsigned int size);
00310 
00312         Particle* addParticle(void);
00313 
00318         void genBillboardAxes(const Camera& cam, Vector3* pX, Vector3 *pY, const Billboard* pBill = 0);
00319 
00321         void initParameters(void);
00322 
00323     };
00324 }
00325 
00326 #endif

Copyright © 2002-2003 by The OGRE Team
Last modified Sun Nov 28 19:48:38 2004