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

OgreParticleSystemManager.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 __ParticleSystemManager_H__
00026 #define __ParticleSystemManager_H__
00027 
00028 
00029 #include "OgrePrerequisites.h"
00030 #include "OgreParticleSystem.h"
00031 #include "OgreFrameListener.h"
00032 
00033 namespace Ogre {
00034 
00053     class _OgreExport ParticleSystemManager: public Singleton<ParticleSystemManager>, public FrameListener
00054     {
00055     protected:
00056         typedef std::map<String, ParticleSystem> ParticleTemplateMap;
00058         ParticleTemplateMap mSystemTemplates;
00059         
00060         typedef std::map<String, ParticleSystem*> ParticleSystemMap;
00062         ParticleSystemMap mSystems;
00063 
00064         typedef std::map<String, ParticleEmitterFactory*> ParticleEmitterFactoryMap;
00066         ParticleEmitterFactoryMap mEmitterFactories;
00067 
00068         typedef std::map<String, ParticleAffectorFactory*> ParticleAffectorFactoryMap;
00070         ParticleAffectorFactoryMap mAffectorFactories;
00071 
00073         Real mTimeFactor;
00074 
00076         void parseNewEmitter(const String& type, DataChunk& chunk, ParticleSystem* sys);
00078         void parseNewAffector(const String& type, DataChunk& chunk, ParticleSystem* sys);
00080         void parseAttrib(const String& line, ParticleSystem* sys);
00082         void parseEmitterAttrib(const String& line, ParticleEmitter* sys);
00084         void parseAffectorAttrib(const String& line, ParticleAffector* sys);
00086         void skipToNextCloseBrace(DataChunk& chunk);
00088         void skipToNextOpenBrace(DataChunk& chunk);
00089     public:
00090 
00091         ParticleSystemManager();
00092         virtual ~ParticleSystemManager();
00093 
00111         void addEmitterFactory(ParticleEmitterFactory* factory);
00112 
00130         void addAffectorFactory(ParticleAffectorFactory* factory);
00131 
00149         void addTemplate(const String& name, const ParticleSystem& sysTemplate);
00150 
00160         ParticleSystem* createTemplate(const String& name);
00161 
00167         ParticleSystem* getTemplate(const String& name);
00168 
00186         ParticleSystem* createSystem(const String& name, unsigned int quota = 500);
00187 
00207         ParticleSystem* createSystem(const String& name, const String& templateName);
00208 
00216         void destroySystem(const String& name);
00217 
00225         void destroySystem(ParticleSystem* sys);
00226 
00228         ParticleSystem* getSystem(const String& name);
00229 
00230 
00239         ParticleEmitter* _createEmitter(const String& emitterType);
00240 
00249         void _destroyEmitter(ParticleEmitter* emitter);
00250 
00259         ParticleAffector* _createAffector(const String& affectorType);
00260 
00269         void _destroyAffector(ParticleAffector* affector);
00270 
00272         bool frameStarted(const FrameEvent &evt);
00273 
00275         bool frameEnded(const FrameEvent &evt);
00276 
00282         void _initialise(void);
00294         static ParticleSystemManager& getSingleton(void);
00295 
00298         void parseScript(DataChunk& chunk);
00299 
00302         void parseAllSources(const String& extension = ".particle");
00303 
00308         Real getTimeFactor(void) const;
00309 
00318         void setTimeFactor(Real tf);
00319     
00320     };
00321 
00322 }
00323 
00324 #endif
00325 

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