MezzanineEngine 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
worldproxy.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 #ifndef _worldproxy_h
41 #define _worldproxy_h
42 
43 #include "transformableobject.h"
44 
45 namespace Mezzanine
46 {
47  class WorldObject;
48  class WorldManager;
49  ///////////////////////////////////////////////////////////////////////////////
50  /// @brief This is the base class for proxy objects belonging to the various 3D subsystems.
51  /// @details
52  ///////////////////////////////////////
54  {
55  protected:
56  /// @internal
57  /// @brief Pointer to the Object this proxy belongs to.
59  public:
60  /// @brief Class constructor.
61  WorldProxy();
62  /// @brief Class destructor.
63  virtual ~WorldProxy();
64 
65  ///////////////////////////////////////////////////////////////////////////////
66  // Utility
67 
68  /// @brief Accessor for the type of proxy.
69  /// @return Returns enum value for the type of proxy this object is.
70  virtual Mezzanine::ProxyType GetProxyType() const = 0;
71  /// @brief Performs all the necessary task to ensure this object is connected to it's respective world and ready for use.
72  virtual void AddToWorld() = 0;
73  /// @brief Unhooks this proxy from it's respective world.
74  virtual void RemoveFromWorld() = 0;
75  /// @brief Gets whether or not this object is inside of it's world.
76  /// @return Returns true if this proxy is inserted in it's respective subsystems world.
77  virtual bool IsInWorld() const = 0;
78 
79  /// @brief Gets a pointer to the parent object controlling this proxy.
80  /// @return Returns a pointer to the WorldObject controlling this proxy, or NULL if this proxy isn't bound to a WorldObject.
81  virtual WorldObject* GetParentObject() const;
82  /// @brief Gets a pointer to this proxies creator.
83  /// @return Returns a pointer to the WorldManager that created this WorldProxy.
84  virtual WorldManager* GetCreator() const = 0;
85 
86  ///////////////////////////////////////////////////////////////////////////////
87  // Transform Methods
88 
89  /// @copydoc TransformableObject::SetLocation(const Vector3&)
90  /// @warning Calling this method directly can de-sync a WorldObject. Do NOT do this unless you know exactly what you are doing.
91  virtual void SetLocation(const Vector3& Loc) = 0;
92  /// @copydoc TransformableObject::SetLocation(const Real, const Real, const Real)
93  /// @warning Calling this method directly can de-sync a WorldObject. Do NOT do this unless you know exactly what you are doing.
94  virtual void SetLocation(const Real X, const Real Y, const Real Z) = 0;
95  /// @copydoc TransformableObject::GetLocation() const
96  /// @warning Calling this method directly can de-sync a WorldObject. Do NOT do this unless you know exactly what you are doing.
97  virtual Vector3 GetLocation() const = 0;
98  /// @copydoc TransformableObject::SetOrientation(const Quaternion&)
99  /// @warning Calling this method directly can de-sync a WorldObject. Do NOT do this unless you know exactly what you are doing.
100  virtual void SetOrientation(const Quaternion& Ori) = 0;
101  /// @copydoc TransformableObject::SetOrientation(const Real, const Real, const Real, const Real)
102  /// @warning Calling this method directly can de-sync a WorldObject. Do NOT do this unless you know exactly what you are doing.
103  virtual void SetOrientation(const Real X, const Real Y, const Real Z, const Real W) = 0;
104  /// @copydoc TransformableObject::GetOrientation() const
105  /// @warning Calling this method directly can de-sync a WorldObject. Do NOT do this unless you know exactly what you are doing.
106  virtual Quaternion GetOrientation() const = 0;
107  /// @copydoc TransformableObject::SetScale(const Vector3&)
108  /// @warning Calling this method directly can de-sync a WorldObject. Do NOT do this unless you know exactly what you are doing.
109  virtual void SetScale(const Vector3& Sc) = 0;
110  /// @copydoc TransformableObject::SetScale(const Real, const Real, const Real)
111  /// @warning Calling this method directly can de-sync a WorldObject. Do NOT do this unless you know exactly what you are doing.
112  virtual void SetScale(const Real X, const Real Y, const Real Z) = 0;
113  /// @copydoc TransformableObject::GetScale() const
114  /// @warning Calling this method directly can de-sync a WorldObject. Do NOT do this unless you know exactly what you are doing.
115  virtual Vector3 GetScale() const = 0;
116 
117  /// @copydoc TransformableObject::Translate(const Vector3&)
118  /// @warning Calling this method directly can de-sync a WorldObject. Do NOT do this unless you know exactly what you are doing.
119  virtual void Translate(const Vector3& Trans) = 0;
120  /// @copydoc TransformableObject::Translate(const Real, const Real, const Real)
121  /// @warning Calling this method directly can de-sync a WorldObject. Do NOT do this unless you know exactly what you are doing.
122  virtual void Translate(const Real X, const Real Y, const Real Z) = 0;
123  /// @copydoc TransformableObject::Yaw(const Real)
124  /// @warning Calling this method directly can de-sync a WorldObject. Do NOT do this unless you know exactly what you are doing.
125  virtual void Yaw(const Real Angle) = 0;
126  /// @copydoc TransformableObject::Pitch(const Real)
127  /// @warning Calling this method directly can de-sync a WorldObject. Do NOT do this unless you know exactly what you are doing.
128  virtual void Pitch(const Real Angle) = 0;
129  /// @copydoc TransformableObject::Roll(const Real)
130  /// @warning Calling this method directly can de-sync a WorldObject. Do NOT do this unless you know exactly what you are doing.
131  virtual void Roll(const Real Angle) = 0;
132  /// @copydoc TransformableObject::Rotate(const Vector3&, const Real)
133  /// @warning Calling this method directly can de-sync a WorldObject. Do NOT do this unless you know exactly what you are doing.
134  virtual void Rotate(const Vector3& Axis, const Real Angle) = 0;
135  /// @copydoc TransformableObject::Rotate(const Quaternion&)
136  /// @warning Calling this method directly can de-sync a WorldObject. Do NOT do this unless you know exactly what you are doing.
137  virtual void Rotate(const Quaternion& Rotation) = 0;
138  /// @copydoc TransformableObject::Scale(const Vector3&)
139  /// @warning Calling this method directly can de-sync a WorldObject. Do NOT do this unless you know exactly what you are doing.
140  virtual void Scale(const Vector3& Scale) = 0;
141  /// @copydoc TransformableObject::Scale(const Real, const Real, const Real)
142  /// @warning Calling this method directly can de-sync a WorldObject. Do NOT do this unless you know exactly what you are doing.
143  virtual void Scale(const Real X, const Real Y, const Real Z) = 0;
144 
145  ///////////////////////////////////////////////////////////////////////////////
146  // Serialization
147 
148  /// @brief Convert this class to an XML::Node ready for serialization.
149  /// @param ParentNode The point in the XML hierarchy that all this renderable should be appended to.
150  virtual void ProtoSerialize(XML::Node& ParentNode) const;
151  /// @brief Convert the properties of this class to an XML::Node ready for serialization.
152  /// @param SelfRoot The root node containing all the serialized data for this instance.
153  virtual void ProtoSerializeProperties(XML::Node& SelfRoot) const;
154 
155  /// @brief Take the data stored in an XML Node and overwrite this object with it.
156  /// @param SelfRoot An XML::Node containing the data to populate this class with.
157  virtual void ProtoDeSerialize(const XML::Node& SelfRoot);
158  /// @brief Take the data stored in an XML Node and overwrite the properties of this object with it.
159  /// @param SelfRoot An XML::Node containing the data to populate this class with.
160  virtual void ProtoDeSerializeProperties(const XML::Node& SelfRoot);
161 
162  /// @brief Gets the most derived serializable name of this WorldProxy.
163  /// @note When creating a new WorldProxy class verify this method has a valid return for it in order for serialization to work properly.
164  /// @return Returns the name of the XML tag from the most derived class of "this".
165  virtual String GetDerivedSerializableName() const;
166  /// @brief Get the name of the the XML tag the proxy class will leave behind as its instances are serialized.
167  /// @return A string containing the name of this class.
168  static String GetSerializableName();
169 
170  ///////////////////////////////////////////////////////////////////////////////
171  // Internal Methods
172 
173  /// @internal
174  /// @brief Binds this proxy to a WorldObject.
175  /// @param NewParent A pointer to the WorldObject taking possession of this proxy.
176  void _Bind(WorldObject* NewParent);
177  };//WorldProxy
178 }//Mezzanine
179 
180 #endif