OgreParticleSystemManager.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4 (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org/
6 
7 Copyright (c) 2000-2013 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 */
28 #ifndef __ParticleSystemManager_H__
29 #define __ParticleSystemManager_H__
30 
31 
32 #include "OgrePrerequisites.h"
33 #include "OgreParticleSystem.h"
34 #include "OgreFrameListener.h"
35 #include "OgreSingleton.h"
36 #include "OgreIteratorWrappers.h"
37 #include "OgreScriptLoader.h"
39 #include "OgreHeaderPrefix.h"
40 
41 namespace Ogre {
42 
43  // Forward decl
44  class ParticleSystemFactory;
45 
78  public Singleton<ParticleSystemManager>, public ScriptLoader, public FXAlloc
79  {
80  friend class ParticleSystemFactory;
81  public:
86  protected:
88 
91 
94 
97 
100 
102 
103  // Factory instance
105 
107  void parseNewEmitter(const String& type, DataStreamPtr& chunk, ParticleSystem* sys);
109  void parseNewAffector(const String& type, DataStreamPtr& chunk, ParticleSystem* sys);
111  void parseAttrib(const String& line, ParticleSystem* sys);
113  void parseEmitterAttrib(const String& line, ParticleEmitter* sys);
115  void parseAffectorAttrib(const String& line, ParticleAffector* sys);
117  void skipToNextCloseBrace(DataStreamPtr& chunk);
119  void skipToNextOpenBrace(DataStreamPtr& chunk);
120 
122  ParticleSystem* createSystemImpl(const String& name, size_t quota,
123  const String& resourceGroup);
125  ParticleSystem* createSystemImpl(const String& name, const String& templateName);
127  void destroySystemImpl(ParticleSystem* sys);
128 
129 
130  public:
131 
133  virtual ~ParticleSystemManager();
134 
152  void addEmitterFactory(ParticleEmitterFactory* factory);
153 
171  void addAffectorFactory(ParticleAffectorFactory* factory);
172 
181  void addRendererFactory(ParticleSystemRendererFactory* factory);
182 
199  void addTemplate(const String& name, ParticleSystem* sysTemplate);
200 
211  void removeTemplate(const String& name, bool deleteTemplate = true);
212 
219  void removeAllTemplates(bool deleteTemplate = true);
220 
221 
228  void removeTemplatesByResourceGroup(const String& resourceGroup);
229 
242  ParticleSystem* createTemplate(const String& name, const String& resourceGroup);
243 
249  ParticleSystem* getTemplate(const String& name);
250 
261  ParticleEmitter* _createEmitter(const String& emitterType, ParticleSystem* psys);
262 
271  void _destroyEmitter(ParticleEmitter* emitter);
272 
283  ParticleAffector* _createAffector(const String& affectorType, ParticleSystem* psys);
284 
293  void _destroyAffector(ParticleAffector* affector);
294 
303  ParticleSystemRenderer* _createRenderer(const String& rendererType);
304 
313  void _destroyRenderer(ParticleSystemRenderer* renderer);
314 
320  void _initialise(void);
321 
323  const StringVector& getScriptPatterns(void) const;
325  void parseScript(DataStreamPtr& stream, const String& groupName);
327  Real getLoadingOrder(void) const;
328 
333  ParticleAffectorFactoryIterator getAffectorFactoryIterator(void);
335  ParticleEmitterFactoryIterator getEmitterFactoryIterator(void);
337  ParticleRendererFactoryIterator getRendererFactoryIterator(void);
338 
339 
343  {
345  mSystemTemplates.begin(), mSystemTemplates.end());
346  }
347 
349  ParticleSystemFactory* _getFactory(void) { return mFactory; }
350 
366  static ParticleSystemManager& getSingleton(void);
382  static ParticleSystemManager* getSingletonPtr(void);
383 
384  };
385 
388  {
389  protected:
390  MovableObject* createInstanceImpl(const String& name, const NameValuePairList* params);
391  public:
394 
396 
397  const String& getType(void) const;
398  void destroyInstance( MovableObject* obj);
399 
400  };
404 }
405 
406 #include "OgreHeaderSuffix.h"
407 
408 #endif
409 
OgreHeaderSuffix.h
Ogre::ParticleSystemFactory
Factory object for creating ParticleSystem instances.
Definition: OgreParticleSystemManager.h:387
Ogre::ParticleSystemManager::ParticleAffectorFactoryMap
map< String, ParticleAffectorFactory * >::type ParticleAffectorFactoryMap
Definition: OgreParticleSystemManager.h:83
Ogre::AllocatedObject
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
Definition: OgreMemoryAllocatedObject.h:58
Ogre
Definition: OgreAndroidLogListener.h:34
Ogre::ParticleSystemManager::ParticleSystemRendererFactoryMap
map< String, ParticleSystemRendererFactory * >::type ParticleSystemRendererFactoryMap
Definition: OgreParticleSystemManager.h:85
Ogre::map
Definition: OgrePrerequisites.h:533
OgreSingleton.h
Ogre::StringVector
vector< String >::type StringVector
Definition: OgreStringVector.h:45
Ogre::ParticleSystemManager::_getFactory
ParticleSystemFactory * _getFactory(void)
Get an instance of ParticleSystemFactory (internal use).
Definition: OgreParticleSystemManager.h:349
Ogre::ParticleSystemRenderer
Abstract class defining the interface required to be implemented by classes which provide rendering c...
Definition: OgreParticleSystemRenderer.h:49
Ogre::MovableObject
Abstract class defining a movable object in a scene.
Definition: OgreMovableObject.h:60
Ogre::ParticleSystemFactory::~ParticleSystemFactory
~ParticleSystemFactory()
Definition: OgreParticleSystemManager.h:393
Ogre::String
_StringBase String
Definition: OgrePrerequisites.h:439
Ogre::MovableObjectFactory
Interface definition for a factory class which produces a certain kind of MovableObject,...
Definition: OgreMovableObject.h:578
Ogre::ParticleSystemManager::ParticleEmitterFactoryIterator
MapIterator< ParticleEmitterFactoryMap > ParticleEmitterFactoryIterator
Definition: OgreParticleSystemManager.h:330
OgreResourceGroupManager.h
Ogre::ParticleSystemManager::mEmitterFactories
ParticleEmitterFactoryMap mEmitterFactories
Factories for named emitter types (can be extended using plugins)
Definition: OgreParticleSystemManager.h:93
Ogre::NameValuePairList
map< String, String >::type NameValuePairList
Name / value parameter pair (first = name, second = value)
Definition: OgreCommon.h:550
Ogre::ParticleSystemManager::getTemplateIterator
ParticleSystemTemplateIterator getTemplateIterator(void)
Gets an iterator over the list of particle system templates.
Definition: OgreParticleSystemManager.h:342
Ogre::ParticleSystemManager::ParticleAffectorFactoryIterator
MapIterator< ParticleAffectorFactoryMap > ParticleAffectorFactoryIterator
Definition: OgreParticleSystemManager.h:329
Ogre::ParticleSystemManager::mSystemTemplates
ParticleTemplateMap mSystemTemplates
Templates based on scripts.
Definition: OgreParticleSystemManager.h:90
OgreHeaderPrefix.h
Ogre::ParticleSystemManager::ParticleSystemTemplateIterator
MapIterator< ParticleTemplateMap > ParticleSystemTemplateIterator
Definition: OgreParticleSystemManager.h:340
OgreFrameListener.h
OgrePrerequisites.h
Ogre::ParticleSystemManager::mScriptPatterns
StringVector mScriptPatterns
Definition: OgreParticleSystemManager.h:101
Ogre::Singleton
Template class for creating single-instance global classes.
Definition: OgreSingleton.h:64
Ogre::ParticleSystemFactory::FACTORY_TYPE_NAME
static String FACTORY_TYPE_NAME
Definition: OgreParticleSystemManager.h:395
_OgreExport
#define _OgreExport
Definition: OgrePlatform.h:257
Ogre::ParticleSystemFactory::ParticleSystemFactory
ParticleSystemFactory()
Definition: OgreParticleSystemManager.h:392
Ogre::ParticleEmitter
Abstract class defining the interface to be implemented by particle emitters.
Definition: OgreParticleEmitter.h:72
Ogre::ParticleSystemManager::ParticleRendererFactoryIterator
MapIterator< ParticleSystemRendererFactoryMap > ParticleRendererFactoryIterator
Definition: OgreParticleSystemManager.h:331
Ogre::ParticleSystemManager::ParticleTemplateMap
map< String, ParticleSystem * >::type ParticleTemplateMap
Definition: OgreParticleSystemManager.h:82
Ogre::ScriptLoader
Abstract class defining the interface used by classes which wish to perform script loading to define ...
Definition: OgreScriptLoader.h:59
OgreScriptLoader.h
Ogre::SharedPtr< DataStream >
Ogre::MapIterator
Concrete IteratorWrapper for nonconst access to the underlying key-value container.
Definition: OgreIteratorWrapper.h:319
OgreIteratorWrappers.h
Ogre::ParticleAffectorFactory
Abstract class defining the interface to be implemented by creators of ParticleAffector subclasses.
Definition: OgreParticleAffectorFactory.h:55
Ogre::ParticleSystemRendererFactory
Abstract class definition of a factory object for ParticleSystemRenderer.
Definition: OgreParticleSystemRenderer.h:133
Ogre::ParticleSystemManager::mFactory
ParticleSystemFactory * mFactory
Definition: OgreParticleSystemManager.h:104
OgreParticleSystem.h
Ogre::ParticleSystemManager::mAffectorFactories
ParticleAffectorFactoryMap mAffectorFactories
Factories for named affector types (can be extended using plugins)
Definition: OgreParticleSystemManager.h:96
Ogre::ParticleSystem
Class defining particle system based special effects.
Definition: OgreParticleSystem.h:67
Ogre::ParticleSystemManager::ParticleEmitterFactoryMap
map< String, ParticleEmitterFactory * >::type ParticleEmitterFactoryMap
Definition: OgreParticleSystemManager.h:84
Ogre::Real
float Real
Software floating point type.
Definition: OgrePrerequisites.h:70
Ogre::ParticleSystemManager
Manages particle systems, particle system scripts (templates) and the available emitter & affector fa...
Definition: OgreParticleSystemManager.h:77
Ogre::ParticleEmitterFactory
Abstract class defining the interface to be implemented by creators of ParticleEmitter subclasses.
Definition: OgreParticleEmitterFactory.h:56
Ogre::ParticleAffector
Abstract class defining the interface to be implemented by particle affectors.
Definition: OgreParticleAffector.h:64
Ogre::ParticleSystemManager::OGRE_AUTO_MUTEX
OGRE_AUTO_MUTEX
Definition: OgreParticleSystemManager.h:87
Ogre::ParticleSystemManager::mRendererFactories
ParticleSystemRendererFactoryMap mRendererFactories
Map of renderer types to factories.
Definition: OgreParticleSystemManager.h:99

Copyright © 2012 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.