OgreParticleSystemManager.h
Go to the documentation of this file.
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/
Copyright (c) 2000-2013 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#ifndef __ParticleSystemManager_H__
#define __ParticleSystemManager_H__
#include "OgrePrerequisites.h"
#include "OgreParticleSystem.h"
#include "OgreFrameListener.h"
#include "OgreSingleton.h"
#include "OgreIteratorWrappers.h"
#include "OgreScriptLoader.h"
#include "OgreResourceGroupManager.h"
#include "OgreHeaderPrefix.h"
namespace Ogre {
// Forward decl
class ParticleSystemFactory;
class _OgreExport ParticleSystemManager:
public Singleton<ParticleSystemManager>, public ScriptLoader, public FXAlloc
{
friend class ParticleSystemFactory;
public:
typedef map<String, ParticleSystem*>::type ParticleTemplateMap;
typedef map<String, ParticleAffectorFactory*>::type ParticleAffectorFactoryMap;
typedef map<String, ParticleEmitterFactory*>::type ParticleEmitterFactoryMap;
typedef map<String, ParticleSystemRendererFactory*>::type ParticleSystemRendererFactoryMap;
protected:
OGRE_AUTO_MUTEX;
ParticleTemplateMap mSystemTemplates;
ParticleEmitterFactoryMap mEmitterFactories;
ParticleAffectorFactoryMap mAffectorFactories;
ParticleSystemRendererFactoryMap mRendererFactories;
StringVector mScriptPatterns;
// Factory instance
ParticleSystemFactory* mFactory;
void parseNewEmitter(const String& type, DataStreamPtr& chunk, ParticleSystem* sys);
void parseNewAffector(const String& type, DataStreamPtr& chunk, ParticleSystem* sys);
void parseAttrib(const String& line, ParticleSystem* sys);
void parseEmitterAttrib(const String& line, ParticleEmitter* sys);
void parseAffectorAttrib(const String& line, ParticleAffector* sys);
void skipToNextCloseBrace(DataStreamPtr& chunk);
void skipToNextOpenBrace(DataStreamPtr& chunk);
ParticleSystem* createSystemImpl(const String& name, size_t quota,
const String& resourceGroup);
ParticleSystem* createSystemImpl(const String& name, const String& templateName);
void destroySystemImpl(ParticleSystem* sys);
public:
ParticleSystemManager();
virtual ~ParticleSystemManager();
void addEmitterFactory(ParticleEmitterFactory* factory);
void addAffectorFactory(ParticleAffectorFactory* factory);
void addRendererFactory(ParticleSystemRendererFactory* factory);
void addTemplate(const String& name, ParticleSystem* sysTemplate);
void removeTemplate(const String& name, bool deleteTemplate = true);
void removeAllTemplates(bool deleteTemplate = true);
void removeTemplatesByResourceGroup(const String& resourceGroup);
ParticleSystem* createTemplate(const String& name, const String& resourceGroup);
ParticleSystem* getTemplate(const String& name);
ParticleEmitter* _createEmitter(const String& emitterType, ParticleSystem* psys);
void _destroyEmitter(ParticleEmitter* emitter);
ParticleAffector* _createAffector(const String& affectorType, ParticleSystem* psys);
void _destroyAffector(ParticleAffector* affector);
ParticleSystemRenderer* _createRenderer(const String& rendererType);
void _destroyRenderer(ParticleSystemRenderer* renderer);
void _initialise(void);
const StringVector& getScriptPatterns(void) const;
void parseScript(DataStreamPtr& stream, const String& groupName);
Real getLoadingOrder(void) const;
typedef MapIterator<ParticleAffectorFactoryMap> ParticleAffectorFactoryIterator;
typedef MapIterator<ParticleEmitterFactoryMap> ParticleEmitterFactoryIterator;
typedef MapIterator<ParticleSystemRendererFactoryMap> ParticleRendererFactoryIterator;
ParticleAffectorFactoryIterator getAffectorFactoryIterator(void);
ParticleEmitterFactoryIterator getEmitterFactoryIterator(void);
ParticleRendererFactoryIterator getRendererFactoryIterator(void);
typedef MapIterator<ParticleTemplateMap> ParticleSystemTemplateIterator;
ParticleSystemTemplateIterator getTemplateIterator(void)
{
return ParticleSystemTemplateIterator(
mSystemTemplates.begin(), mSystemTemplates.end());
}
ParticleSystemFactory* _getFactory(void) { return mFactory; }
static ParticleSystemManager& getSingleton(void);
static ParticleSystemManager* getSingletonPtr(void);
};
class _OgreExport ParticleSystemFactory : public MovableObjectFactory
{
protected:
MovableObject* createInstanceImpl(const String& name, const NameValuePairList* params);
public:
ParticleSystemFactory() {}
~ParticleSystemFactory() {}
static String FACTORY_TYPE_NAME;
const String& getType(void) const;
void destroyInstance( MovableObject* obj);
};
}
#include "OgreHeaderSuffix.h"
#endif
OgreScriptLoader.h
Ogre::ParticleSystemFactory::~ParticleSystemFactory
~ParticleSystemFactory()
Definition: OgreParticleSystemManager.h:393
Ogre::ParticleSystemManager::ParticleEmitterFactoryIterator
MapIterator< ParticleEmitterFactoryMap > ParticleEmitterFactoryIterator
Definition: OgreParticleSystemManager.h:330
Ogre::ParticleSystemManager::mEmitterFactories
ParticleEmitterFactoryMap mEmitterFactories
Factories for named emitter types (can be extended using plugins)
Definition: OgreParticleSystemManager.h:93
_OgreExport
#define _OgreExport
Definition: OgrePlatform.h:257
Ogre::ScriptLoader
Abstract class defining the interface used by classes which wish to perform script loading to define ...
Definition: OgreScriptLoader.h:59
Ogre::MovableObject
Abstract class defining a movable object in a scene.
Definition: OgreMovableObject.h:60
Ogre::ParticleSystemFactory
Factory object for creating ParticleSystem instances.
Definition: OgreParticleSystemManager.h:387
Ogre::MapIterator
Concrete IteratorWrapper for nonconst access to the underlying key-value container.
Definition: OgreIteratorWrapper.h:319
Ogre::Real
float Real
Software floating point type.
Definition: OgrePrerequisites.h:70
Ogre::ParticleSystemManager::ParticleSystemRendererFactoryMap
map< String, ParticleSystemRendererFactory * >::type ParticleSystemRendererFactoryMap
Definition: OgreParticleSystemManager.h:85
OgreParticleSystem.h
Ogre::StringVector
vector< String >::type StringVector
Definition: OgreStringVector.h:45
Ogre::ParticleSystemManager::ParticleAffectorFactoryIterator
MapIterator< ParticleAffectorFactoryMap > ParticleAffectorFactoryIterator
Definition: OgreParticleSystemManager.h:329
Ogre::ParticleAffector
Abstract class defining the interface to be implemented by particle affectors.
Definition: OgreParticleAffector.h:64
Ogre::ParticleSystemFactory::FACTORY_TYPE_NAME
static String FACTORY_TYPE_NAME
Definition: OgreParticleSystemManager.h:395
OgreFrameListener.h
OgreSingleton.h
Ogre::ParticleSystemRendererFactory
Abstract class definition of a factory object for ParticleSystemRenderer.
Definition: OgreParticleSystemRenderer.h:133
OgrePrerequisites.h
Ogre::ParticleSystemRenderer
Abstract class defining the interface required to be implemented by classes which provide rendering c...
Definition: OgreParticleSystemRenderer.h:49
Ogre::ParticleEmitterFactory
Abstract class defining the interface to be implemented by creators of ParticleEmitter subclasses...
Definition: OgreParticleEmitterFactory.h:56
Ogre::ParticleSystemManager::ParticleTemplateMap
map< String, ParticleSystem * >::type ParticleTemplateMap
Definition: OgreParticleSystemManager.h:82
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::mFactory
ParticleSystemFactory * mFactory
Definition: OgreParticleSystemManager.h:104
Ogre::ParticleSystemManager::ParticleEmitterFactoryMap
map< String, ParticleEmitterFactory * >::type ParticleEmitterFactoryMap
Definition: OgreParticleSystemManager.h:84
Ogre::String
_StringBase String
Definition: OgrePrerequisites.h:439
Ogre::ParticleAffectorFactory
Abstract class defining the interface to be implemented by creators of ParticleAffector subclasses...
Definition: OgreParticleAffectorFactory.h:55
OgreHeaderSuffix.h
Ogre::ParticleSystemManager::mSystemTemplates
ParticleTemplateMap mSystemTemplates
Templates based on scripts.
Definition: OgreParticleSystemManager.h:90
OgreIteratorWrappers.h
Ogre::ParticleSystemManager::ParticleSystemTemplateIterator
MapIterator< ParticleTemplateMap > ParticleSystemTemplateIterator
Definition: OgreParticleSystemManager.h:340
Ogre
Definition: OgreAndroidLogListener.h:34
Ogre::ParticleSystemManager::mRendererFactories
ParticleSystemRendererFactoryMap mRendererFactories
Map of renderer types to factories.
Definition: OgreParticleSystemManager.h:99
Ogre::ParticleSystemManager::mScriptPatterns
StringVector mScriptPatterns
Definition: OgreParticleSystemManager.h:101
Ogre::ParticleEmitter
Abstract class defining the interface to be implemented by particle emitters.
Definition: OgreParticleEmitter.h:72
Ogre::SharedPtr< DataStream >
OgreHeaderPrefix.h
Ogre::ParticleSystemManager::ParticleRendererFactoryIterator
MapIterator< ParticleSystemRendererFactoryMap > ParticleRendererFactoryIterator
Definition: OgreParticleSystemManager.h:331
Ogre::Singleton
Template class for creating single-instance global classes.
Definition: OgreSingleton.h:64
Ogre::ParticleSystemManager::OGRE_AUTO_MUTEX
OGRE_AUTO_MUTEX
Definition: OgreParticleSystemManager.h:87
OgreResourceGroupManager.h
Ogre::map
Definition: OgrePrerequisites.h:533
Ogre::ParticleSystemFactory::ParticleSystemFactory
ParticleSystemFactory()
Definition: OgreParticleSystemManager.h:392
Ogre::ParticleSystem
Class defining particle system based special effects.
Definition: OgreParticleSystem.h:67
Ogre::MovableObjectFactory
Interface definition for a factory class which produces a certain kind of MovableObject, and can be registered with Root in order to allow all clients to produce new instances of this object, integrated with the standard Ogre processing.
Definition: OgreMovableObject.h:578
Ogre::ParticleSystemManager::ParticleAffectorFactoryMap
map< String, ParticleAffectorFactory * >::type ParticleAffectorFactoryMap
Definition: OgreParticleSystemManager.h:83
Ogre::ParticleSystemManager::_getFactory
ParticleSystemFactory * _getFactory(void)
Get an instance of ParticleSystemFactory (internal use).
Definition: OgreParticleSystemManager.h:349
Ogre::ParticleSystemManager
Manages particle systems, particle system scripts (templates) and the available emitter & affector fa...
Definition: OgreParticleSystemManager.h:77
Ogre::AllocatedObject
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
Definition: OgreMemoryAllocatedObject.h:58
Ogre::ParticleSystemManager::mAffectorFactories
ParticleAffectorFactoryMap mAffectorFactories
Factories for named affector types (can be extended using plugins)
Definition: OgreParticleSystemManager.h:96

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