Spinning Topp Logo BlackTopp Studios
inc
softproxy.h
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 _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 ID The unique ID assigned to this proxy.
69  /// @param Mass The combined mass of the nodes in the soft body.
70  /// @param Creator A pointer to the manager that created this proxy.
71  SoftProxy(const UInt32 ID, const Real Mass, PhysicsManager* Creator);
72  /// @brief XML constructor.
73  /// @param SelfRoot An XML::Node containing the data to populate this class with.
74  /// @param Creator A pointer to the manager that created this proxy.
75  SoftProxy(const XML::Node& SelfRoot, PhysicsManager* Creator);
76  /// @brief Class destructor.
77  virtual ~SoftProxy();
78 
79  ///////////////////////////////////////////////////////////////////////////////
80  // Utility
81 
82  /// @copydoc WorldProxy::GetProxyType() const
83  virtual Mezzanine::ProxyType GetProxyType() const;
84 
85  /// @copydoc WorldProxy::AddToWorld()
86  virtual void AddToWorld();
87  /// @copydoc WorldProxy::RemoveFromWorld()
88  virtual void RemoveFromWorld();
89 
90  ///////////////////////////////////////////////////////////////////////////////
91  // Collision Settings
92 
93  /// @copydoc CollidableProxy::SetCollisionShape(CollisionShape*)
94  virtual void SetCollisionShape(CollisionShape* Shape);
95 
96  ///////////////////////////////////////////////////////////////////////////////
97  // Transform Methods
98 
99  /// @copydoc WorldProxy::SetLocation(const Vector3&)
100  virtual void SetLocation(const Vector3& Loc);
101  /// @copydoc WorldProxy::SetLocation(const Real, const Real, const Real)
102  virtual void SetLocation(const Real X, const Real Y, const Real Z);
103  /// @copydoc WorldProxy::GetLocation() const
104  virtual Vector3 GetLocation() const;
105  /// @copydoc WorldProxy::SetOrientation(const Quaternion&)
106  virtual void SetOrientation(const Quaternion& Ori);
107  /// @copydoc WorldProxy::SetOrientation(const Real, const Real, const Real, const Real)
108  virtual void SetOrientation(const Real X, const Real Y, const Real Z, const Real W);
109  /// @copydoc WorldProxy::GetOrientation() const
110  virtual Quaternion GetOrientation() const;
111  /// @copydoc CollidableProxy::SetScale(const Vector3&)
112  virtual void SetScale(const Vector3& Sc);
113  /// @copydoc CollidableProxy::SetScale(const Real, const Real, const Real)
114  virtual void SetScale(const Real X, const Real Y, const Real Z);
115  /// @copydoc WorldProxy::GetScale() const
116  virtual Vector3 GetScale() const;
117 
118  ///////////////////////////////////////////////////////////////////////////////
119  // Serialization
120 
121  /// @copydoc WorldProxy::ProtoSerialize(XML::Node&) const
122  virtual void ProtoSerialize(XML::Node& ParentNode) const;
123  /// @copydoc WorldProxy::ProtoSerializeProperties(XML::Node&) const
124  virtual void ProtoSerializeProperties(XML::Node& SelfRoot) const;
125  /// @brief Convert the nodes (and their specific properties) of this class to an XML::Node ready for serialization.
126  /// @param SelfRoot The root node containing all the serialized data for this instance.
127  virtual void ProtoSeriailzeNodes(XML::Node& SelfRoot) const;
128 
129  /// @copydoc WorldProxy::ProtoDeSerialize(const XML::Node&)
130  virtual void ProtoDeSerialize(const XML::Node& SelfRoot);
131  /// @copydoc WorldProxy::ProtoDeSerializeProperties(const XML::Node&)
132  virtual void ProtoDeSerializeProperties(const XML::Node& SelfRoot);
133  /// @brief Take the data stored in an XML Node and overwrite the nodes (and their specific properties) of this object with it.
134  /// @param SelfRoot An XML::Node containing the data to populate this class with.
135  virtual void ProtoDeSeriailzeNodes(XML::Node& SelfRoot) const;
136 
137  /// @copydoc WorldProxy::GetDerivedSerializableName() const
138  virtual String GetDerivedSerializableName() const;
139  /// @copydoc WorldProxy::GetSerializableName()
140  static String GetSerializableName();
141 
142  ///////////////////////////////////////////////////////////////////////////////
143  // Internal Methods
144 
145  /// @internal
146  /// @brief Accessor for the internal soft body physics proxy.
147  /// @return Returns a pointer to the internal proxy this proxy is based on.
148  virtual btSoftBody* _GetPhysicsObject() const;
149  /// @copydoc CollidableProxy::_GetBasePhysicsObject()
150  virtual btCollisionObject* _GetBasePhysicsObject() const;
151  };//SoftProxy
152  }//Physics
153 }//Mezzanine
154 
155 #endif
This is the base class for all collision shapes.
float Real
A Datatype used to represent a real floating point number.
Definition: datatypes.h:141
A light-weight handle for manipulating nodes in DOM tree.
Definition: node.h:89
This is the proxy object for soft/compressable bodies.
Definition: softproxy.h:55
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
btSoftBody * PhysicsSoftBody
SoftBody proxy used by the internal physics.
Definition: softproxy.h:60
This is a proxy from which physics objects that can collide with each other are handled.
This is simply a place for storing all the Physics Related functions.
This is used to represent a point in space, or a vector through space.
Definition: vector3.h:77
#define MEZZ_LIB
Some platforms require special decorations to denote what is exported/imported in a share library...
The bulk of the engine components go in this namspace.
Definition: actor.cpp:56
This is used to store information about rotation in 3d space.
Definition: quaternion.h:68
std::string String
A datatype used to a series of characters.
Definition: datatypes.h:159