Spinning Topp Logo BlackTopp Studios
inc
particlesystemproxy.cpp
Go to the documentation of this file.
1 // © Copyright 2010 - 2016 BlackTopp Studios Inc.
2 /* This file is part of The Mezzanine Engine.
3 
4  The Mezzanine Engine is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  The Mezzanine Engine is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with The Mezzanine Engine. If not, see <http://www.gnu.org/licenses/>.
16 */
17 /* The original authors have included a copy of the license specified above in the
18  'Docs' folder. See 'gpl.txt'
19 */
20 /* We welcome the use of the Mezzanine engine to anyone, including companies who wish to
21  Build professional software and charge for their product.
22 
23  However there are some practical restrictions, so if your project involves
24  any of the following you should contact us and we will try to work something
25  out:
26  - DRM or Copy Protection of any kind(except Copyrights)
27  - Software Patents You Do Not Wish to Freely License
28  - Any Kind of Linking to Non-GPL licensed Works
29  - Are Currently In Violation of Another Copyright Holder's GPL License
30  - If You want to change our code and not add a few hundred MB of stuff to
31  your distribution
32 
33  These and other limitations could cause serious legal problems if you ignore
34  them, so it is best to simply contact us or the Free Software Foundation, if
35  you have any questions.
36 
37  Joseph Toppi - toppij@gmail.com
38  John Blackwood - makoenergy02@gmail.com
39 */
40 #ifndef _graphicsparticlesystemproxy_cpp
41 #define _graphicsparticlesystemproxy_cpp
42 
43 /// @file
44 /// @brief This file contains the implementation for the World proxy wrapping particle functionality.
45 
47 #include "Graphics/particleaffector.h"
48 #include "Graphics/particleemitter.h"
49 #include "Graphics/scenemanager.h"
50 
51 #include "exception.h"
52 #include "serialization.h"
53 #include "stringtool.h"
54 
55 #include <Ogre.h>
56 
57 namespace Mezzanine
58 {
59  namespace Graphics
60  {
61  ParticleSystemProxy::ParticleSystemProxy(const UInt32 ID, const String& Template, SceneManager* Creator) :
62  RenderableProxy(ID,Creator),
63  GraphicsParticleSystem(NULL),
64  SpeedFactor(1.0),
65  Paused(false)
66  { this->CreateParticleSystem(Template); }
67 
69  RenderableProxy(Creator),
70  GraphicsParticleSystem(NULL),
71  SpeedFactor(1.0),
72  Paused(false)
73  { this->ProtoDeSerialize(SelfRoot); }
74 
76  { this->DestroyParticleSystem(); }
77 
79  {
80  this->ProtoSerializeTemplate(SelfRoot);
81  this->ProtoSerializeCustomParameters(SelfRoot);
82  this->WorldProxy::ProtoSerializeImpl(SelfRoot);
83  this->ProtoSerializeEmitters(SelfRoot);
84  this->ProtoSerializeAffectors(SelfRoot);
85  }
86 
88  {
89  this->ProtoDeSerializeTemplate(SelfRoot);
90  this->ProtoDeSerializeCustomParameters(SelfRoot);
91  this->WorldProxy::ProtoDeSerializeImpl(SelfRoot);
92  this->ProtoDeSerializeEmitters(SelfRoot);
93  this->ProtoDeSerializeAffectors(SelfRoot);
94  }
95 
97  {
98  this->GraphicsParticleSystem = this->Manager->_GetGraphicsWorldPointer()->createParticleSystem(ParticleSystemProxy::GenerateName(),Template);
99  this->GraphicsNode->attachObject( this->GraphicsParticleSystem );
100  this->GraphicsParticleSystem->setUserAny( Ogre::Any( static_cast<RenderableProxy*>( this ) ) );
101  this->GraphicsParticleSystem->setVisibilityFlags(0);
102  this->GraphicsParticleSystem->setQueryFlags(0);
103 
104  // Wrap our emitters
105  UInt16 NumEmitters = this->GraphicsParticleSystem->getNumEmitters();
106  for( UInt16 X = 0 ; X < NumEmitters ; ++X )
107  {
108  Graphics::ParticleEmitter* NewEmitter = new Graphics::ParticleEmitter( this->GraphicsParticleSystem->getEmitter(X), this );
109  this->Emitters.push_back(NewEmitter);
110  }
111  // Wrap our affectors
112  UInt16 NumAffectors = this->GraphicsParticleSystem->getNumAffectors();
113  for( UInt16 X = 0 ; X < NumAffectors ; ++X )
114  {
115  Graphics::ParticleAffector* NewAffector = new Graphics::ParticleAffector( this->GraphicsParticleSystem->getAffector(X), this );
116  this->Affectors.push_back(NewAffector);
117  }
118  }
119 
121  {
122  this->DestroyAllEmitters();
123  this->DestroyAllAffectors();
124 
125  if( this->GraphicsParticleSystem ) {
126  this->GraphicsNode->detachObject( this->GraphicsParticleSystem );
127  this->Manager->_GetGraphicsWorldPointer()->destroyParticleSystem( this->GraphicsParticleSystem );
128  }
129  this->CustomSystemParameters.clear();
130  }
131 
133  {
134  static UInt32 NameCounter = 0;
135  StringStream NameStream;
136  NameStream << "ParticleSystem" << ++NameCounter;
137  return NameStream.str();
138  }
139 
140  ///////////////////////////////////////////////////////////////////////////////
141  // Utility
142 
144  {
145  return PT_Graphics_ParticleSystemProxy;
146  }
147 
149  {
150  return this->GraphicsParticleSystem->getName();
151  }
152 
154  {
155  return this->Template;
156  }
157 
159  {
160  if( this->Paused != Pause ) {
161  this->Paused = Pause;
162  this->GraphicsParticleSystem->setSpeedFactor( this->Paused ? 0.0 : this->SpeedFactor );
163  }
164  }
165 
167  {
168  return this->Paused;
169  }
170 
171  void ParticleSystemProxy::SetCustomParam(const String& Name, const String& Value)
172  {
173  this->GraphicsParticleSystem->setParameter(Name,Value);
174  this->CustomSystemParameters[Name] = Value;
175  }
176 
178  {
179  return this->GraphicsParticleSystem->getParameter(Name);
180  }
181 
182  ///////////////////////////////////////////////////////////////////////////////
183  // Emitters
184 
186  { return this->Emitters.at(Index); }
187 
189  { return this->Emitters.size(); }
190 
192  {
193  ParticleEmitter* ToBeDestroyed = this->GetEmitter(Index);
194  this->Emitters.erase( this->Emitters.begin() + Index );
195  delete ToBeDestroyed;
196  this->GraphicsParticleSystem->removeEmitter(Index);
197  }
198 
200  {
201  for( EmitterIterator EmitIt = this->Emitters.begin() ; EmitIt != this->Emitters.end() ; ++EmitIt )
202  {
203  delete (*EmitIt);
204  }
205  this->Emitters.clear();
206  this->GraphicsParticleSystem->removeAllEmitters();
207  }
208 
209  ///////////////////////////////////////////////////////////////////////////////
210  // Affectors
211 
213  { return this->Affectors.at(Index); }
214 
216  { return this->Affectors.size(); }
217 
219  {
220  ParticleAffector* ToBeDestroyed = this->GetAffector(Index);
221  this->Affectors.erase( this->Affectors.begin() + Index );
222  delete ToBeDestroyed;
223  this->GraphicsParticleSystem->removeAffector(Index);
224  }
225 
227  {
228  for( AffectorIterator AffectIt = this->Affectors.begin() ; AffectIt != this->Affectors.end() ; ++AffectIt )
229  {
230  delete (*AffectIt);
231  }
232  this->Affectors.clear();
233  this->GraphicsParticleSystem->removeAllAffectors();
234  }
235 
236  ///////////////////////////////////////////////////////////////////////////////
237  // ParticleSystem Properties
238 
240  {
241  this->SpeedFactor = Factor;
242  if( !this->Paused ) {
243  this->GraphicsParticleSystem->setSpeedFactor( this->SpeedFactor );
244  }
245  }
246 
248  {
249  return this->SpeedFactor;
250  }
251 
252  ///////////////////////////////////////////////////////////////////////////////
253  // Serialization
254 
256  {
258 
259  XML::Node PropertiesNode = SelfRoot.AppendChild( ParticleSystemProxy::GetSerializableName() + "Properties" );
260 
261  if( PropertiesNode.AppendAttribute("Version").SetValue("1") &&
262  PropertiesNode.AppendAttribute("Paused").SetValue( this->IsParticleSystemPaused() ) &&
263  PropertiesNode.AppendAttribute("SpeedFactor").SetValue( this->GetSpeedFactor() ) )
264  {
265  return;
266  }else{
267  SerializeError("Create XML Attribute Values",ParticleSystemProxy::GetSerializableName() + "Properties",true);
268  }
269  }
270 
272  {
273  XML::Node ConstructionParamNode = SelfRoot.AppendChild( ParticleSystemProxy::GetSerializableName() + "Template" );
274 
275  if( ConstructionParamNode.AppendAttribute("Version").SetValue("1") &&
276  ConstructionParamNode.AppendAttribute("TemplateName").SetValue( this->GetTemplate() ) )
277  {
278  return;
279  }else{
280  SerializeError("Create XML Attribute Values",ParticleSystemProxy::GetSerializableName() + "TemplateAndName",true);
281  }
282  }
283 
285  {
286  XML::Node CustomParametersNode = SelfRoot.AppendChild( ParticleSystemProxy::GetSerializableName() + "CustomParameters" );
287 
288  if( CustomParametersNode.AppendAttribute("Version").SetValue("1") )
289  {
290  for( NameValuePairMap::const_iterator ParamIt = this->CustomSystemParameters.begin() ; ParamIt != this->CustomSystemParameters.end() ; ++ParamIt )
291  {
292  XML::Node CustomParamNode = CustomParametersNode.AppendChild( "CustomParam" );
293  if( CustomParamNode.AppendAttribute("Version").SetValue("1") &&
294  CustomParamNode.AppendAttribute("ParamName").SetValue( (*ParamIt).first ) &&
295  CustomParamNode.AppendAttribute("ParamValue").SetValue( (*ParamIt).second ) )
296  {
297  return;
298  }else{
299  SerializeError("Create XML Attribute Values",ParticleSystemProxy::GetSerializableName() + "CustomParameters",true);
300  }
301  }
302  }else{
303  SerializeError("Create XML Attribute Values",ParticleSystemProxy::GetSerializableName() + "CustomParameters",true);
304  }
305  }
306 
308  {
309  XML::Node EmittersNode = SelfRoot.AppendChild( ParticleSystemProxy::GetSerializableName() + "Emitters" );
310 
311  if( EmittersNode.AppendAttribute("Version").SetValue("1") )
312  {
313  const UInt16 NumEmitters = this->GetNumEmitters();
314  for( UInt16 Index = 0 ; Index < NumEmitters ; ++Index )
315  {
316  XML::Node EmitterNode = EmittersNode.AppendChild( "Emitter" );
317  if( EmitterNode.AppendAttribute("Version").SetValue("1") &&
318  EmitterNode.AppendAttribute("Index").SetValue( Index ) )
319  {
320  this->GetEmitter(Index)->ProtoSerialize(EmitterNode);
321  }else{
322  SerializeError("Create XML Attribute Values","Emitter",true);
323  }
324  }
325  }else{
326  SerializeError("Create XML Attribute Values",ParticleSystemProxy::GetSerializableName() + "Emitters",true);
327  }
328  }
329 
331  {
332  XML::Node AffectorsNode = SelfRoot.AppendChild( ParticleSystemProxy::GetSerializableName() + "Affectors" );
333 
334  if( AffectorsNode.AppendAttribute("Version").SetValue("1") )
335  {
336  const UInt16 NumAffectors = this->GetNumAffectors();
337  for( UInt16 Index = 0 ; Index < NumAffectors ; ++Index )
338  {
339  XML::Node AffectorNode = AffectorsNode.AppendChild( "Affector" );
340  if( AffectorNode.AppendAttribute("Version").SetValue("1") &&
341  AffectorNode.AppendAttribute("Index").SetValue( Index ) )
342  {
343  this->GetAffector(Index)->ProtoSerialize(AffectorNode);
344  }else{
345  SerializeError("Create XML Attribute Values","Affector",true);
346  }
347  }
348  }else{
349  SerializeError("Create XML Attribute Values",ParticleSystemProxy::GetSerializableName() + "Affectors",true);
350  }
351  }
352 
354  {
356 
357  XML::Attribute CurrAttrib;
358  XML::Node PropertiesNode = SelfRoot.GetChild( ParticleSystemProxy::GetSerializableName() + "Properties" );
359 
360  if( !PropertiesNode.Empty() ) {
361  if(PropertiesNode.GetAttribute("Version").AsInt() == 1) {
362  CurrAttrib = PropertiesNode.GetAttribute("Paused");
363  if( !CurrAttrib.Empty() )
365 
366  CurrAttrib = PropertiesNode.GetAttribute("SpeedFactor");
367  if( !CurrAttrib.Empty() )
368  this->SetSpeedFactor( CurrAttrib.AsReal() );
369  }else{
370  MEZZ_EXCEPTION(ExceptionBase::INVALID_VERSION_EXCEPTION,"Incompatible XML Version for " + (ParticleSystemProxy::GetSerializableName() + "Properties" ) + ": Not Version 1.");
371  }
372  }else{
373  MEZZ_EXCEPTION(ExceptionBase::II_IDENTITY_NOT_FOUND_EXCEPTION,ParticleSystemProxy::GetSerializableName() + "Properties" + " was not found in the provided XML node, which was expected.");
374  }
375  }
376 
378  {
379  XML::Attribute CurrAttrib;
380  XML::Node ConstructionParamNode = SelfRoot.GetChild( ParticleSystemProxy::GetSerializableName() + "Mesh" );
381 
382  if( !ConstructionParamNode.Empty() ) {
383  if(ConstructionParamNode.GetAttribute("Version").AsInt() == 1) {
384  String TemplateName;
385 
386  CurrAttrib = ConstructionParamNode.GetAttribute("TemplateName");
387  if( !CurrAttrib.Empty() )
388  TemplateName = CurrAttrib.AsString();
389 
390  if( !TemplateName.empty() ) {
391  this->CreateParticleSystem(TemplateName);
392  }else{
393  MEZZ_EXCEPTION(ExceptionBase::PARAMETERS_EXCEPTION,"Attempting to DeSerialize a ParticleSystemProxy with an empty name or template.");
394  }
395  }
396  }
397  }
398 
400  {
401  XML::Attribute CurrAttrib;
402  XML::Node CustomParametersNode = SelfRoot.GetChild( ParticleSystemProxy::GetSerializableName() + "CustomParameters" );
403 
404  if( !CustomParametersNode.Empty() ) {
405  if(CustomParametersNode.GetAttribute("Version").AsInt() == 1) {
406  String ParamName, ParamValue;
407 
408  for( XML::NodeIterator ParamIt = CustomParametersNode.begin() ; ParamIt != CustomParametersNode.end() ; ++ParamIt )
409  {
410  if( !(*ParamIt).Empty() ) {
411  if((*ParamIt).GetAttribute("Version").AsInt() == 1) {
412  CurrAttrib = (*ParamIt).GetAttribute("ParamName");
413  if( !CurrAttrib.Empty() )
414  ParamName = CurrAttrib.AsString();
415 
416  CurrAttrib = (*ParamIt).GetAttribute("ParamValue");
417  if( !CurrAttrib.Empty() )
418  ParamValue = CurrAttrib.AsString();
419 
420  if( !ParamName.empty() && !ParamValue.empty() ) {
421  this->SetCustomParam(ParamName,ParamValue);
422  }
423  }
424  }
425  }
426  }else{
427  MEZZ_EXCEPTION(ExceptionBase::INVALID_VERSION_EXCEPTION,"Incompatible XML Version for " + (ParticleSystemProxy::GetSerializableName() + "CustomParameters" ) + ": Not Version 1.");
428  }
429  }else{
430  MEZZ_EXCEPTION(ExceptionBase::II_IDENTITY_NOT_FOUND_EXCEPTION,ParticleSystemProxy::GetSerializableName() + "CustomParameters" + " was not found in the provided XML node, which was expected.");
431  }
432  }
433 
435  {
436  // Currently this assume the emitters were already created when deserializing the template.
437  // So just use what we have and call DeSerialize on them.
438  XML::Attribute CurrAttrib;
439  XML::Node EmittersNode = SelfRoot.GetChild( ParticleSystemProxy::GetSerializableName() + "Emitters" );
440 
441  if( !EmittersNode.Empty() ) {
442  if(EmittersNode.GetAttribute("Version").AsInt() == 1) {
443  UInt16 Index = 0;
444 
445  for( XML::NodeIterator EmitIt = EmittersNode.begin() ; EmitIt != EmittersNode.end() ; ++EmitIt )
446  {
447  CurrAttrib = (*EmitIt).GetAttribute("Index");
448  if( !CurrAttrib.Empty() ) {
449  Index = static_cast<UInt16>( CurrAttrib.AsWhole() );
450  }else{
451  MEZZ_EXCEPTION(ExceptionBase::PARAMETERS_EXCEPTION,"Attempting to DeSerialize a ParticleEmitter without a valid Index.");
452  }
453 
454  XML::Node EmitterNode = (*EmitIt).GetFirstChild();
455  this->GetEmitter(Index)->ProtoDeSerialize(EmitterNode);
456  }
457  }
458  }
459  }
460 
462  {
463  // Currently this assume the emitters were already created when deserializing the template.
464  // So just use what we have and call DeSerialize on them.
465  XML::Attribute CurrAttrib;
466  XML::Node AffectorsNode = SelfRoot.GetChild( ParticleSystemProxy::GetSerializableName() + "Affectors" );
467 
468  if( !AffectorsNode.Empty() ) {
469  if(AffectorsNode.GetAttribute("Version").AsInt() == 1) {
470  UInt16 Index = 0;
471 
472  for( XML::NodeIterator AffectIt = AffectorsNode.begin() ; AffectIt != AffectorsNode.end() ; ++AffectIt )
473  {
474  CurrAttrib = (*AffectIt).GetAttribute("Index");
475  if( !CurrAttrib.Empty() ) {
476  Index = static_cast<UInt16>( CurrAttrib.AsWhole() );
477  }else{
478  MEZZ_EXCEPTION(ExceptionBase::PARAMETERS_EXCEPTION,"Attempting to DeSerialize a ParticleAffector without a valid Index.");
479  }
480 
481  XML::Node AffectorNode = (*AffectIt).GetFirstChild();
482  this->GetAffector(Index)->ProtoDeSerialize(AffectorNode);
483  }
484  }
485  }
486  }
487 
490 
492  { return "ParticleSystemProxy"; }
493 
494  ///////////////////////////////////////////////////////////////////////////////
495  // Internal Methods
496 
497  Ogre::ParticleSystem* ParticleSystemProxy::_GetGraphicsObject() const
498  { return this->GraphicsParticleSystem; }
499 
500  Ogre::MovableObject* ParticleSystemProxy::_GetBaseGraphicsObject() const
501  { return this->GraphicsParticleSystem; }
502  }//Graphics
503 }//Mezzanine
504 
505 #endif
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.
Definition: attribute.h:74
AffectorContainer::iterator AffectorIterator
Iterator type for ParticleAffector instances stored by this class.
bool Boole
Generally acts a single bit, true or false.
Definition: datatypes.h:173
This class contains utilities and functions to allow the manipulation of the Graphical scene...
Definition: scenemanager.h:85
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.
Definition: exception.h:94
virtual void ProtoSerializeImpl(XML::Node &SelfRoot) const
Implementation method for serializing additional sets of data.
Definition: worldproxy.cpp:66
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.
Definition: exception.h:3048
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.
Definition: worldproxy.cpp:114
Thrown when a version is accessed/parsed/required and it cannot work correctly or is missing...
Definition: exception.h:112
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.
Definition: datatypes.h:176
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.
Definition: datatypes.h:141
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.
Definition: datatypes.h:122
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.
Boole ConvertToBool(const String &ToConvert, const Boole Default)
Converts a string into a Boole.
Definition: stringtool.cpp:379
Child node iterator (a bidirectional iterator over a collection of Node)
Definition: nodeiterator.h:77
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.
Definition: node.h:89
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.
Definition: enumerations.h:91
uint32_t UInt32
An 32-bit unsigned integer.
Definition: datatypes.h:126
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.
Definition: exception.h:108
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.
Definition: actor.cpp:56
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.
Definition: datatypes.h:159
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.
Definition: worldproxy.cpp:69