MezzanineEngine 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
particleaffector.h
1 // © Copyright 2010 - 2014 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 
41 #ifndef _graphicsparticleaffector_h
42 #define _graphicsparticleaffector_h
43 
44 #include "datatypes.h"
45 #include "XML/xml.h"
46 
47 namespace Ogre
48 {
49  class ParticleAffector;
50 }
51 
52 namespace Mezzanine
53 {
54  namespace Graphics
55  {
56  class ParticleSystemProxy;
57  ///////////////////////////////////////////////////////////////////////////////
58  /// @brief This class defines how particles of a given particle effect behave during their lifetime.
59  /// @details
60  ///////////////////////////////////////
62  {
63  protected:
64  /// @internal
65  /// @brief A cache containing all of the custom altered parameters of this particle affector.
66  /// @note Once we have a proper wrapper for particle systems (or our own implementation) this no longer needs to exist.
68  /// @internal
69  /// @brief The internal affector class this class get's it functionality from.
70  Ogre::ParticleAffector* GraphicsAffector;
71  /// @internal
72  /// @brief A pointer to the system that this affector is affecting.
74  public:
75  /// @brief Internal Class constructor.
76  /// @param InternalAffector A pointer to the internal affector providing this class' functionality.
77  /// @param Creator A pointer to the particle system that created this affector.
78  ParticleAffector(Ogre::ParticleAffector* InternalAffector, ParticleSystemProxy* Creator);
79  /// @brief Class destructor.
80  virtual ~ParticleAffector();
81 
82  ///////////////////////////////////////////////////////////////////////////////
83  // Utility
84 
85  /// @brief Sets a custom parameter of a particle affector.
86  /// @remarks The params available to change depends on the internal particle affector used.
87  /// You should check your particle script where possible to ensure particles you are
88  /// changing are the type you expect.
89  /// @param Name The name of the parameter to alter.
90  /// @param Value The new value to set for the named parameter.
91  void SetCustomParam(const String& Name, const String& Value);
92  /// @brief Gets a custom parameter of a particle affector.
93  /// @remarks The params available to change depends on the internal particle affector used.
94  /// You should check your particle script where possible to ensure the particle has the
95  /// param you are looking for.
96  /// @param Name The name of the parameter to fetch.
97  String GetCustomParam(const String& Name) const;
98 
99  ///////////////////////////////////////////////////////////////////////////////
100  // Serialization
101 
102  /// @copydoc WorldProxy::ProtoSerialize(XML::Node&) const
103  virtual void ProtoSerialize(XML::Node& ParentNode) const;
104  /*/// @copydoc WorldProxy::ProtoSerializeProperties(XML::Node& SelfRoot) const
105  virtual void ProtoSerializeProperties(XML::Node& SelfRoot) const;*/
106  /// @brief Convert the custom altered parameters of this class to an XML::Node ready for serialization.
107  /// @param SelfRoot The root node containing all the serialized data for this instance.
108  virtual void ProtoSerializeCustomParameters(XML::Node& SelfRoot) const;
109 
110  /// @copydoc WorldProxy::ProtoDeSerialize(const XML::Node&)
111  virtual void ProtoDeSerialize(const XML::Node& SelfRoot);
112  /*/// @copydoc WorldProxy::ProtoDeSerializeProperties(const XML::Node& SelfRoot)
113  virtual void ProtoDeSerializeProperties(const XML::Node& SelfRoot);*/
114  /// @brief Take the data stored in an XML Node and overwrite the custom altered parameters of this object with it.
115  /// @param SelfRoot An XML::Node containing the data to populate this class with.
116  virtual void ProtoDeSerializeCustomParameters(const XML::Node& SelfRoot);
117 
118  /// @copydoc WorldProxy::GetDerivedSerializableName() const
119  virtual String GetDerivedSerializableName() const;
120  /// @copydoc WorldProxy::GetSerializableName()
121  static String GetSerializableName();
122 
123  ///////////////////////////////////////////////////////////////////////////////
124  // Internal Methods
125 
126  /// @internal
127  /// @brief Accessor for the internal particle affector.
128  /// @return Returns a pointer to the internal particle affector this proxy is based on.
129  virtual Ogre::ParticleAffector* _GetGraphicsAffector() const;
130  };//ParticleAffector
131  }//Graphics
132 }//Mezzanine
133 
134 #endif