MezzanineEngine 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
softproxy.h
1 // © Copyright 2010 - 2012 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 _softproxy_h
41 #define _softproxy_h
42 
43 #include "Physics/collidableproxy.h"
44 
45 class btSoftBody;
46 
47 namespace Mezzanine
48 {
49  namespace Physics
50  {
51  ///////////////////////////////////////////////////////////////////////////////
52  /// @brief This is the proxy object for soft/compressable bodies.
53  /// @details
54  ///////////////////////////////////////
56  {
57  protected:
58  /// @internal
59  /// @brief SoftBody proxy used by the internal physics.
60  btSoftBody* PhysicsSoftBody;
61 
62  /// @internal
63  /// @brief Used to create the physics representation of the soft body.
64  /// @param Mass The mass of the soft body to be created.
65  virtual void CreateSoftObject(const Real Mass);
66  public:
67  /// @brief Class constructor.
68  /// @param Mass The combined mass of the nodes in the soft body.
69  /// @param Creator A pointer to the manager that created this proxy.
70  SoftProxy(const Real Mass, PhysicsManager* Creator);
71  /// @brief XML constructor.
72  /// @param SelfRoot An XML::Node containing the data to populate this class with.
73  /// @param Creator A pointer to the manager that created this proxy.
74  SoftProxy(const XML::Node& SelfRoot, PhysicsManager* Creator);
75  /// @brief Class destructor.
76  virtual ~SoftProxy();
77 
78  ///////////////////////////////////////////////////////////////////////////////
79  // Utility
80 
81  /// @copydoc WorldProxy::GetProxyType() const
82  virtual Mezzanine::ProxyType GetProxyType() const;
83 
84  /// @copydoc WorldProxy::AddToWorld()
85  virtual void AddToWorld();
86  /// @copydoc WorldProxy::RemoveFromWorld()
87  virtual void RemoveFromWorld();
88 
89  ///////////////////////////////////////////////////////////////////////////////
90  // Collision Settings
91 
92  /// @copydoc CollidableProxy::SetCollisionShape(CollisionShape*)
93  virtual void SetCollisionShape(CollisionShape* Shape);
94 
95  ///////////////////////////////////////////////////////////////////////////////
96  // Transform Methods
97 
98  /// @copydoc WorldProxy::SetLocation(const Vector3&)
99  virtual void SetLocation(const Vector3& Loc);
100  /// @copydoc WorldProxy::SetLocation(const Real, const Real, const Real)
101  virtual void SetLocation(const Real X, const Real Y, const Real Z);
102  /// @copydoc WorldProxy::GetLocation() const
103  virtual Vector3 GetLocation() const;
104  /// @copydoc WorldProxy::SetOrientation(const Quaternion&)
105  virtual void SetOrientation(const Quaternion& Ori);
106  /// @copydoc WorldProxy::SetOrientation(const Real, const Real, const Real, const Real)
107  virtual void SetOrientation(const Real X, const Real Y, const Real Z, const Real W);
108  /// @copydoc WorldProxy::GetOrientation() const
109  virtual Quaternion GetOrientation() const;
110  /// @copydoc CollidableProxy::SetScale(const Vector3&)
111  virtual void SetScale(const Vector3& Sc);
112  /// @copydoc CollidableProxy::SetScale(const Real, const Real, const Real)
113  virtual void SetScale(const Real X, const Real Y, const Real Z);
114  /// @copydoc WorldProxy::GetScale() const
115  virtual Vector3 GetScale() const;
116 
117  ///////////////////////////////////////////////////////////////////////////////
118  // Serialization
119 
120  /// @copydoc WorldProxy::ProtoSerialize(XML::Node&) const
121  virtual void ProtoSerialize(XML::Node& ParentNode) const;
122  /// @copydoc WorldProxy::ProtoSerializeProperties(XML::Node&) const
123  virtual void ProtoSerializeProperties(XML::Node& SelfRoot) const;
124  /// @brief Convert the nodes (and their specific properties) of this class to an XML::Node ready for serialization.
125  /// @param SelfRoot The root node containing all the serialized data for this instance.
126  virtual void ProtoSeriailzeNodes(XML::Node& SelfRoot) const;
127 
128  /// @copydoc WorldProxy::ProtoDeSerialize(const XML::Node&)
129  virtual void ProtoDeSerialize(const XML::Node& SelfRoot);
130  /// @copydoc WorldProxy::ProtoDeSerializeProperties(const XML::Node&)
131  virtual void ProtoDeSerializeProperties(const XML::Node& SelfRoot);
132  /// @brief Take the data stored in an XML Node and overwrite the nodes (and their specific properties) of this object with it.
133  /// @param SelfRoot An XML::Node containing the data to populate this class with.
134  virtual void ProtoDeSeriailzeNodes(XML::Node& SelfRoot) const;
135 
136  /// @copydoc WorldProxy::GetDerivedSerializableName() const
137  virtual String GetDerivedSerializableName() const;
138  /// @copydoc WorldProxy::GetSerializableName()
139  static String GetSerializableName();
140 
141  ///////////////////////////////////////////////////////////////////////////////
142  // Internal Methods
143 
144  /// @internal
145  /// @brief Accessor for the internal soft body physics proxy.
146  /// @return Returns a pointer to the internal proxy this proxy is based on.
147  virtual btSoftBody* _GetPhysicsObject() const;
148  /// @copydoc CollidableProxy::_GetBasePhysicsObject()
149  virtual btCollisionObject* _GetBasePhysicsObject() const;
150  };//SoftProxy
151  }//Physics
152 }//Mezzanine
153 
154 #endif