40 #ifndef _graphicsparticlesystemproxy_cpp
41 #define _graphicsparticlesystemproxy_cpp
47 #include "Graphics/particleaffector.h"
48 #include "Graphics/particleemitter.h"
49 #include "Graphics/scenemanager.h"
53 #include "stringtool.h"
63 GraphicsParticleSystem(NULL),
70 GraphicsParticleSystem(NULL),
106 for(
UInt16 X = 0 ; X < NumEmitters ; ++X )
109 this->
Emitters.push_back(NewEmitter);
113 for(
UInt16 X = 0 ; X < NumAffectors ; ++X )
134 static UInt32 NameCounter = 0;
136 NameStream <<
"ParticleSystem" << ++NameCounter;
137 return NameStream.str();
145 return PT_Graphics_ParticleSystemProxy;
160 if( this->
Paused != Pause ) {
186 {
return this->
Emitters.at(Index); }
195 delete ToBeDestroyed;
222 delete ToBeDestroyed;
314 for(
UInt16 Index = 0 ; Index < NumEmitters ; ++Index )
337 for(
UInt16 Index = 0 ; Index < NumAffectors ; ++Index )
360 if( !PropertiesNode.
Empty() ) {
363 if( !CurrAttrib.
Empty() )
366 CurrAttrib = PropertiesNode.
GetAttribute(
"SpeedFactor");
367 if( !CurrAttrib.
Empty() )
382 if( !ConstructionParamNode.
Empty() ) {
386 CurrAttrib = ConstructionParamNode.
GetAttribute(
"TemplateName");
387 if( !CurrAttrib.
Empty() )
388 TemplateName = CurrAttrib.
AsString();
390 if( !TemplateName.empty() ) {
404 if( !CustomParametersNode.
Empty() ) {
406 String ParamName, ParamValue;
410 if( !(*ParamIt).Empty() ) {
411 if((*ParamIt).GetAttribute(
"Version").AsInt() == 1) {
412 CurrAttrib = (*ParamIt).GetAttribute(
"ParamName");
413 if( !CurrAttrib.
Empty() )
416 CurrAttrib = (*ParamIt).GetAttribute(
"ParamValue");
417 if( !CurrAttrib.
Empty() )
420 if( !ParamName.empty() && !ParamValue.empty() ) {
441 if( !EmittersNode.
Empty() ) {
447 CurrAttrib = (*EmitIt).GetAttribute(
"Index");
448 if( !CurrAttrib.
Empty() ) {
468 if( !AffectorsNode.
Empty() ) {
474 CurrAttrib = (*AffectIt).GetAttribute(
"Index");
475 if( !CurrAttrib.
Empty() ) {
492 {
return "ParticleSystemProxy"; }
Attribute AppendAttribute(const Char8 *Name)
Creates an Attribute and puts it at the end of this Nodes attributes.
A light-weight handle for manipulating attributes in DOM tree.
AffectorContainer::iterator AffectorIterator
Iterator type for ParticleAffector instances stored by this class.
bool Boole
Generally acts a single bit, true or false.
This class contains utilities and functions to allow the manipulation of the Graphical scene...
Boole IsParticleSystemPaused() const
Gets whether or not this particle system is currently paused.
virtual void ProtoDeSerialize(const XML::Node &SelfRoot)
Take the data stored in an XML Node and overwrite this object with it.
virtual void ProtoSerializeImpl(XML::Node &SelfRoot) const
Implementation method for serializing additional sets of data.
virtual void ProtoDeSerialize(const XML::Node &SelfRoot)
Take the data stored in an XML Node and overwrite this object with it.
String GetCustomParam(const String &Name) const
Gets a custom parameter of a particle effect.
Thrown when the requested identity could not be found.
virtual void ProtoSerializeImpl(XML::Node &SelfRoot) const
Implementation method for serializing additional sets of data.
Node GetFirstChild() const
Get the first child Node of this Node.
virtual void CreateParticleSystem(const String &Template)
Constructs this particle system from a pre-made particle script.
#define MEZZ_EXCEPTION(num, desc)
An easy way to throw exceptions with rich information.
void DestroyAllAffectors()
Destroy's all Affectors in use by this particle effect.
SceneManager * Manager
This is a pointer to the scene manager that created and owns this proxy.
virtual void ProtoDeSerialize(const XML::Node &SelfRoot)
Take the data stored in an XML Node and overwrite this object with it.
Thrown when a version is accessed/parsed/required and it cannot work correctly or is missing...
const Char8 * AsString(const Char8 *def="") const
Attempts to convert the value of the attribute to a String and returns the results.
Boole Paused
Stores whether or not updates to this particle system are paused.
This is the base proxy class for world proxies wrapping functionality of the graphics subsystem...
virtual void ProtoSerializeProperties(XML::Node &SelfRoot) const
Convert the properties of this class to an XML::Node ready for serialization.
void SetCustomParam(const String &Name, const String &Value)
Sets a custom parameter of a particle effect.
virtual void ProtoDeSerializeProperties(const XML::Node &SelfRoot)
Take the data stored in an XML Node and overwrite the properties of this object with it...
bool Empty() const
Is this storing anything at all?
This implements the exception hiearchy for Mezzanine.
std::stringstream StringStream
A Datatype used for streaming operations with strings.
virtual String GetDerivedSerializableName() const
Gets the most derived serializable name of this WorldProxy.
Ogre::SceneNode * GraphicsNode
A pointer to the internal object storing the proxy transform.
float Real
A Datatype used to represent a real floating point number.
The interface for serialization.
bool SetValue(const Char8 *rhs)
Set the value of this.
virtual void ProtoSerialize(XML::Node &ParentNode) const
Convert this class to an XML::Node ready for serialization.
ParticleAffector * GetAffector(const UInt16 Index) const
Gets the Affector at the specified index.
uint16_t UInt16
An 16-bit unsigned integer.
virtual void ProtoDeSerializeProperties(const XML::Node &SelfRoot)
Take the data stored in an XML Node and overwrite the properties of this object with it...
Whole AsWhole(Whole def=0) const
Attempts to convert the value of the attribute to a Whole and returns the results.
UInt16 GetNumEmitters() const
Gets the number of Emitters in use by this particle effect.
Child node iterator (a bidirectional iterator over a collection of Node)
Real SpeedFactor
Stores the current speed factor of this particle system for when it gets paused.
A light-weight handle for manipulating nodes in DOM tree.
iterator begin() const
Get a Child node iterator that references the first child Node.
virtual void ProtoDeSerializeImpl(const XML::Node &SelfRoot)
Implementation method for deseriailizing additional sets of data.
int AsInt(int def=0) const
Attempts to convert the value of the attribute to an int and returns the results. ...
ProxyType
Used by all World proxies to describe what their derived types are.
uint32_t UInt32
An 32-bit unsigned integer.
ParticleSystemProxy(const UInt32 ID, const String &Template, SceneManager *Creator)
Template constructor.
ParticleEmitter * GetEmitter(const UInt16 Index) const
Gets the Emitter at the specified index.
iterator end() const
Get a Child node iterator that references one past the last child Node.
bool Empty() const
Is this storing anything at all?
virtual void ProtoSerializeTemplate(XML::Node &SelfRoot) const
Convert the template name of this class to an XML::Node ready for serialization.
virtual Ogre::ParticleSystem * _GetGraphicsObject() const
Accessor for the internal particle system.
const String & GetName() const
Gets the name of this particle effect.
String Template
Stores the template, primarily for serialization.
EmitterContainer::iterator EmitterIterator
Iterator type for ParticleEmitter instances stored by this class.
Real AsReal(Real def=0) const
Attempts to convert the value of the attribute to a Real and returns the results. ...
virtual void ProtoSerialize(XML::Node &ParentNode) const
Convert this class to an XML::Node ready for serialization.
static String GetSerializableName()
Get the name of the the XML tag the proxy class will leave behind as its instances are serialized...
NameValuePairMap CustomSystemParameters
A cache containing all of the custom altered parameters of this particle system.
Real GetSpeedFactor() const
Gets the Factor at which this ParticleEffect is currently progressing.
const String & GetTemplate() const
Gets the name of the template this particle effect is based on.
virtual void ProtoSerializeEmitters(XML::Node &SelfRoot) const
Convert the emitters of this class to an XML::Node ready for serialization.
virtual Ogre::MovableObject * _GetBaseGraphicsObject() const
Accessor for the internal graphics object.
Thrown when parameters are checked at runtime and found invalid.
virtual void ProtoSerializeCustomParameters(XML::Node &SelfRoot) const
Convert the custom altered parameters of this class to an XML::Node ready for serialization.
virtual ~ParticleSystemProxy()
Class destructor.
virtual void ProtoDeSerializeTemplate(const XML::Node &SelfRoot)
Take the data stored in an XML Node and overwrite the template name of this object with it...
Ogre::SceneManager * _GetGraphicsWorldPointer() const
Gets the internal Ogre Scene Manager pointer.
virtual void ProtoSerializeAffectors(XML::Node &SelfRoot) const
Convert the affectors of this class to an XML::Node ready for serialization.
virtual void ProtoDeSerializeCustomParameters(const XML::Node &SelfRoot)
Take the data stored in an XML Node and overwrite the custom altered parameters of this object with i...
The bulk of the engine components go in this namspace.
virtual void ProtoDeSerializeAffectors(const XML::Node &SelfRoot)
Take the data stored in an XML Node and overwrite the affectors of this object with it...
This file contains the declaration for the World proxy wrapping particle functionality.
This class defines how particles of a given particle effect spawn.
Ogre::ParticleSystem * GraphicsParticleSystem
Pointer to the ogre ParticleSystem from which this proxy gets it's functionality. ...
UInt16 GetNumAffectors() const
Gets the number of Affectors in use by this particle effect.
virtual Mezzanine::ProxyType GetProxyType() const
Accessor for the type of proxy.
AffectorContainer Affectors
Vector of affectors in use by this particle effect.
This class defines how particles of a given particle effect behave during their lifetime.
void DestroyEmitter(const UInt16 Index)
Destroy's an Emitter in use by this particle effect.
EmitterContainer Emitters
Vector of emitters in use by this particle effect.
void SerializeError(const String &FailedTo, const String &ClassName, Boole SOrD)
Simply does some string concatenation, then throws an Exception.
virtual void ProtoDeSerializeEmitters(const XML::Node &SelfRoot)
Take the data stored in an XML Node and overwrite the emitters of this object with it...
Node AppendChild(NodeType Type=NodeElement)
Creates a Node and makes it a child of this one.
virtual void DestroyParticleSystem()
Destroys the particle system providing this class with it's functionality.
void DestroyAffector(const UInt16 Index)
Destroy's an Affector in use by this particle effect.
void SetSpeedFactor(const Real Factor)
Sets the factor at which time progresses for this ParticleEffect.
void DestroyAllEmitters()
Destroy's all Emitters in use by this particle effect.
static String GenerateName()
Generates a name for this ParticleSystem to placate the internal system.
std::string String
A datatype used to a series of characters.
void PauseParticleSystem(Boole Pause)
Pauses this proxy, preventing it from emitting, moving, or removing any particles.
Attribute GetAttribute(const Char8 *Name) const
Attempt to get an Attribute on this Node with a given name.
Node GetChild(const Char8 *Name) const
Attempt to get a child Node with a given name.
virtual void ProtoSerializeProperties(XML::Node &SelfRoot) const
Convert the properties of this class to an XML::Node ready for serialization.
virtual void ProtoDeSerializeImpl(const XML::Node &SelfRoot)
Implementation method for deseriailizing additional sets of data.