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 #include "OgreSingleton.h" 00033 00034 namespace Ogre { 00035 00054 class _OgreExport ParticleSystemManager: public Singleton<ParticleSystemManager>, public FrameListener 00055 { 00056 protected: 00057 typedef std::map<String, ParticleSystem> ParticleTemplateMap; 00059 ParticleTemplateMap mSystemTemplates; 00060 00061 typedef std::map<String, ParticleSystem*> ParticleSystemMap; 00063 ParticleSystemMap mSystems; 00064 00065 typedef std::map<String, ParticleEmitterFactory*> ParticleEmitterFactoryMap; 00067 ParticleEmitterFactoryMap mEmitterFactories; 00068 00069 typedef std::map<String, ParticleAffectorFactory*> ParticleAffectorFactoryMap; 00071 ParticleAffectorFactoryMap mAffectorFactories; 00072 00074 Real mTimeFactor; 00075 00077 void parseNewEmitter(const String& type, DataChunk& chunk, ParticleSystem* sys); 00079 void parseNewAffector(const String& type, DataChunk& chunk, ParticleSystem* sys); 00081 void parseAttrib(const String& line, ParticleSystem* sys); 00083 void parseEmitterAttrib(const String& line, ParticleEmitter* sys); 00085 void parseAffectorAttrib(const String& line, ParticleAffector* sys); 00087 void skipToNextCloseBrace(DataChunk& chunk); 00089 void skipToNextOpenBrace(DataChunk& chunk); 00090 public: 00091 00092 ParticleSystemManager(); 00093 virtual ~ParticleSystemManager(); 00094 00112 void addEmitterFactory(ParticleEmitterFactory* factory); 00113 00131 void addAffectorFactory(ParticleAffectorFactory* factory); 00132 00150 void addTemplate(const String& name, const ParticleSystem& sysTemplate); 00151 00161 ParticleSystem* createTemplate(const String& name); 00162 00168 ParticleSystem* getTemplate(const String& name); 00169 00187 ParticleSystem* createSystem(const String& name, unsigned int quota = 500); 00188 00208 ParticleSystem* createSystem(const String& name, const String& templateName); 00209 00217 void destroySystem(const String& name); 00218 00226 void destroySystem(ParticleSystem* sys); 00227 00229 ParticleSystem* getSystem(const String& name); 00230 00231 00240 ParticleEmitter* _createEmitter(const String& emitterType); 00241 00250 void _destroyEmitter(ParticleEmitter* emitter); 00251 00260 ParticleAffector* _createAffector(const String& affectorType); 00261 00270 void _destroyAffector(ParticleAffector* affector); 00271 00273 bool frameStarted(const FrameEvent &evt); 00274 00276 bool frameEnded(const FrameEvent &evt); 00277 00283 void _initialise(void); 00284 00287 void parseScript(DataChunk& chunk); 00288 00291 void parseAllSources(const String& extension = ".particle"); 00292 00297 Real getTimeFactor(void) const; 00298 00307 void setTimeFactor(Real tf); 00308 00324 static ParticleSystemManager& getSingleton(void); 00340 static ParticleSystemManager* getSingletonPtr(void); 00341 00342 }; 00343 00344 } 00345 00346 #endif 00347
Copyright © 2002-2003 by The OGRE Team
Last modified Fri May 14 23:22:32 2004