OGRE 14.3
Object-Oriented Graphics Rendering Engine
|
Manages particle systems, particle system scripts (templates) and the available emitter & affector factories. More...
#include <OgreParticleSystemManager.h>
Public Member Functions | |
ParticleSystemManager () | |
virtual | ~ParticleSystemManager () |
ParticleAffector * | _createAffector (const String &affectorType, ParticleSystem *psys) |
Internal method for creating a new affector from a factory. | |
ParticleEmitter * | _createEmitter (const String &emitterType, ParticleSystem *psys) |
Internal method for creating a new emitter from a factory. | |
ParticleSystemRenderer * | _createRenderer (const String &rendererType) |
Internal method for creating a new renderer from a factory. | |
void | _destroyAffector (ParticleAffector *affector) |
Internal method for destroying an affector. | |
void | _destroyEmitter (ParticleEmitter *emitter) |
Internal method for destroying an emitter. | |
void | _destroyRenderer (ParticleSystemRenderer *renderer) |
Internal method for destroying a renderer. | |
ParticleSystemFactory * | _getFactory (void) |
Get an instance of ParticleSystemFactory (internal use). | |
void | _initialise (void) |
Init method to be called by OGRE system. | |
void | addAffectorFactory (ParticleAffectorFactory *factory) |
Adds a new 'factory' object for affectors to the list of available affector types. | |
void | addEmitterFactory (ParticleEmitterFactory *factory) |
Adds a new 'factory' object for emitters to the list of available emitter types. | |
void | addRendererFactory (ParticleSystemRendererFactory *factory) |
Registers a factory class for creating ParticleSystemRenderer instances. | |
void | addTemplate (const String &name, ParticleSystem *sysTemplate) |
Adds a new particle system template to the list of available templates. | |
ParticleSystem * | createTemplate (const String &name, const String &resourceGroup) |
Create a new particle system template. | |
ParticleAffectorFactoryIterator | getAffectorFactoryIterator (void) |
Return an iterator over the affector factories currently registered. | |
ParticleEmitterFactoryIterator | getEmitterFactoryIterator (void) |
Return an iterator over the emitter factories currently registered. | |
ParticleRendererFactoryIterator | getRendererFactoryIterator (void) |
Return an iterator over the renderer factories currently registered. | |
ParticleSystem * | getTemplate (const String &name) |
Retrieves a particle system template for possible modification. | |
ParticleSystemTemplateIterator | getTemplateIterator (void) |
Gets an iterator over the list of particle system templates. | |
void | removeAllTemplates (bool deleteTemplate=true) |
Removes a specified template from the ParticleSystemManager. | |
void | removeTemplate (const String &name, bool deleteTemplate=true) |
Removes a specified template from the ParticleSystemManager. | |
void | removeTemplatesByResourceGroup (const String &resourceGroup) |
Removes all templates that belong to a specific Resource Group from the ParticleSystemManager. | |
Public Member Functions inherited from Ogre::Singleton< ParticleSystemManager > | |
Singleton (void) | |
~Singleton (void) | |
Static Public Member Functions | |
static ParticleSystemManager & | getSingleton (void) |
Get the singleton instance. | |
static ParticleSystemManager * | getSingletonPtr (void) |
Get the singleton instance. | |
Static Public Member Functions inherited from Ogre::Singleton< ParticleSystemManager > | |
static ParticleSystemManager & | getSingleton (void) |
Get the singleton instance. | |
static ParticleSystemManager * | getSingletonPtr (void) |
Get the singleton instance. | |
Manages particle systems, particle system scripts (templates) and the available emitter & affector factories.
This singleton class is responsible for managing particle systems. Although, the user interface to creating them is via SceneManager. Remember that like all other MovableObject subclasses, ParticleSystems do not get rendered until they are attached to a SceneNode object.
This class also manages factories for ParticleEmitter and ParticleAffector classes. To enable easy extensions to the types of emitters (particle sources) and affectors (particle modifiers), the ParticleSystemManager lets plugins or applications register factory classes which submit new subclasses to ParticleEmitter and ParticleAffector. The actual implementations, such as cone, sphere and box-shaped emitters, and simple affectors such as constant directional force and colour faders are provided by the ParticleFX Plugin shipped with Ogre. However using this registration process, a custom plugin can create any behaviour required.
This class also manages the loading and parsing of particle system scripts, which are text files describing named particle system templates. Instances of particle systems using these templates can then be created easily through the SceneManager::createParticleSystem method.
typedef std::map<String, ParticleAffectorFactory*> Ogre::ParticleSystemManager::ParticleAffectorFactoryMap |
typedef std::map<String, ParticleEmitterFactory*> Ogre::ParticleSystemManager::ParticleEmitterFactoryMap |
typedef std::map<String, ParticleSystemRendererFactory*> Ogre::ParticleSystemManager::ParticleSystemRendererFactoryMap |
typedef MapIterator<ParticleAffectorFactoryMap> Ogre::ParticleSystemManager::ParticleAffectorFactoryIterator |
typedef MapIterator<ParticleEmitterFactoryMap> Ogre::ParticleSystemManager::ParticleEmitterFactoryIterator |
typedef MapIterator<ParticleSystemRendererFactoryMap> Ogre::ParticleSystemManager::ParticleRendererFactoryIterator |
typedef MapIterator<ParticleTemplateMap> Ogre::ParticleSystemManager::ParticleSystemTemplateIterator |
Ogre::ParticleSystemManager::ParticleSystemManager | ( | ) |
|
virtual |
void Ogre::ParticleSystemManager::addEmitterFactory | ( | ParticleEmitterFactory * | factory | ) |
Adds a new 'factory' object for emitters to the list of available emitter types.
This method allows plugins etc to add new particle emitter types to Ogre. Particle emitters are sources of particles, and generate new particles with their start positions, colours and momentums appropriately. Plugins would create new subclasses of ParticleEmitter which emit particles a certain way, and register a subclass of ParticleEmitterFactory to create them (since multiple emitters can be created for different particle systems).
factory | Pointer to a ParticleEmitterFactory subclass created by the plugin or application code. |
void Ogre::ParticleSystemManager::addAffectorFactory | ( | ParticleAffectorFactory * | factory | ) |
Adds a new 'factory' object for affectors to the list of available affector types.
This method allows plugins etc to add new particle affector types to Ogre. Particle affectors modify the particles in a system a certain way such as affecting their direction or changing their colour, lifespan etc. Plugins would create new subclasses of ParticleAffector which affect particles a certain way, and register a subclass of ParticleAffectorFactory to create them.
factory | Pointer to a ParticleAffectorFactory subclass created by the plugin or application code. |
void Ogre::ParticleSystemManager::addRendererFactory | ( | ParticleSystemRendererFactory * | factory | ) |
Registers a factory class for creating ParticleSystemRenderer instances.
factory | Pointer to a ParticleSystemRendererFactory subclass created by the plugin or application code. |
void Ogre::ParticleSystemManager::addTemplate | ( | const String & | name, |
ParticleSystem * | sysTemplate | ||
) |
Adds a new particle system template to the list of available templates.
Instances of particle systems in a scene are not normally unique - often you want to place the same effect in many places. This method allows you to register a ParticleSystem as a named template, which can subsequently be used to create instances using the createSystem method.
name | The name of the template. Must be unique across all templates. |
sysTemplate | A pointer to a particle system to be used as a template. The manager will take over ownership of this pointer. |
void Ogre::ParticleSystemManager::removeTemplate | ( | const String & | name, |
bool | deleteTemplate = true |
||
) |
Removes a specified template from the ParticleSystemManager.
This method removes a given template from the particle system manager, optionally deleting the template if the deleteTemplate method is called. Throws an exception if the template could not be found.
name | The name of the template to remove. |
deleteTemplate | Whether or not to delete the template before removing it. |
Removes a specified template from the ParticleSystemManager.
This method removes all templates from the ParticleSystemManager.
deleteTemplate | Whether or not to delete the templates before removing them. |
Removes all templates that belong to a specific Resource Group from the ParticleSystemManager.
This method removes all templates that belong in a particular resource group from the ParticleSystemManager.
resourceGroup | Resource group to delete templates for |
ParticleSystem * Ogre::ParticleSystemManager::createTemplate | ( | const String & | name, |
const String & | resourceGroup | ||
) |
Create a new particle system template.
This method is similar to the addTemplate method, except this just creates a new template and returns a pointer to it to be populated. Use this when you don't already have a system to add as a template and just want to create a new template which you will build up in-place.
name | The name of the template. Must be unique across all templates. |
resourceGroup | The name of the resource group which will be used to load any dependent resources. |
ParticleSystem * Ogre::ParticleSystemManager::getTemplate | ( | const String & | name | ) |
Retrieves a particle system template for possible modification.
Modifying a template does not affect the settings on any ParticleSystems already created from this template.
ParticleEmitter * Ogre::ParticleSystemManager::_createEmitter | ( | const String & | emitterType, |
ParticleSystem * | psys | ||
) |
Internal method for creating a new emitter from a factory.
Used internally by the engine to create new ParticleEmitter instances from named factories. Applications should use the ParticleSystem::addEmitter method instead, which calls this method to create an instance.
emitterType | String name of the emitter type to be created. A factory of this type must have been registered. |
psys | The particle system this is being created for |
void Ogre::ParticleSystemManager::_destroyEmitter | ( | ParticleEmitter * | emitter | ) |
Internal method for destroying an emitter.
Because emitters are created by factories which may allocate memory from separate heaps, the memory allocated must be freed from the same place. This method is used to ask the factory to destroy the instance passed in as a pointer.
emitter | Pointer to emitter to be destroyed. On return this pointer will point to invalid (freed) memory. |
ParticleAffector * Ogre::ParticleSystemManager::_createAffector | ( | const String & | affectorType, |
ParticleSystem * | psys | ||
) |
Internal method for creating a new affector from a factory.
Used internally by the engine to create new ParticleAffector instances from named factories. Applications should use the ParticleSystem::addAffector method instead, which calls this method to create an instance.
affectorType | String name of the affector type to be created. A factory of this type must have been registered. |
psys | The particle system it is being created for |
void Ogre::ParticleSystemManager::_destroyAffector | ( | ParticleAffector * | affector | ) |
Internal method for destroying an affector.
Because affectors are created by factories which may allocate memory from separate heaps, the memory allocated must be freed from the same place. This method is used to ask the factory to destroy the instance passed in as a pointer.
affector | Pointer to affector to be destroyed. On return this pointer will point to invalid (freed) memory. |
ParticleSystemRenderer * Ogre::ParticleSystemManager::_createRenderer | ( | const String & | rendererType | ) |
Internal method for creating a new renderer from a factory.
Used internally by the engine to create new ParticleSystemRenderer instances from named factories. Applications should use the ParticleSystem::setRenderer method instead, which calls this method to create an instance.
rendererType | String name of the renderer type to be created. A factory of this type must have been registered. |
void Ogre::ParticleSystemManager::_destroyRenderer | ( | ParticleSystemRenderer * | renderer | ) |
Internal method for destroying a renderer.
Because renderer are created by factories which may allocate memory from separate heaps, the memory allocated must be freed from the same place. This method is used to ask the factory to destroy the instance passed in as a pointer.
renderer | Pointer to renderer to be destroyed. On return this pointer will point to invalid (freed) memory. |
Init method to be called by OGRE system.
Due to dependencies between various objects certain initialisation tasks cannot be done on construction. OGRE will call this method when the rendering subsystem is initialised.
ParticleAffectorFactoryIterator Ogre::ParticleSystemManager::getAffectorFactoryIterator | ( | void | ) |
Return an iterator over the affector factories currently registered.
ParticleEmitterFactoryIterator Ogre::ParticleSystemManager::getEmitterFactoryIterator | ( | void | ) |
Return an iterator over the emitter factories currently registered.
ParticleRendererFactoryIterator Ogre::ParticleSystemManager::getRendererFactoryIterator | ( | void | ) |
Return an iterator over the renderer factories currently registered.
|
inline |
Gets an iterator over the list of particle system templates.
|
inline |
Get an instance of ParticleSystemFactory (internal use).
|
static |
Get the singleton instance.
|
static |
Get the singleton instance.