Spinning Topp Logo BlackTopp Studios
inc
rigiddebris.h
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 _rigiddebris_h
41 #define _rigiddebris_h
42 
43 /// @file
44 /// @brief This file contains the declaration for the debris class that does not deform.
45 
46 #include "debris.h"
47 
48 namespace Mezzanine
49 {
50  namespace Graphics
51  {
52  class EntityProxy;
53  class Mesh;
54  }
55  namespace Physics
56  {
57  class RigidProxy;
58  class CollisionShape;
59  }
60  ///////////////////////////////////////////////////////////////////////////////
61  /// @brief A non-deformable debris.
62  /// @details
63  ///////////////////////////////////////
64  class MEZZ_LIB RigidDebris : public Debris
65  {
66  protected:
67  /// @internal
68  /// @brief A pointer to the graphics representation of this debris.
70  /// @internal
71  /// @brief A pointer to the physics representation of this debris.
73 
74  /// @internal
75  /// @brief Common construction method for RigidDebris.
76  /// @param Mass The mass of the debris object.
77  virtual void CreateRigidDebris(const Real Mass);
78  /// @internal
79  /// @brief Verbose construction method for RigidDebris.
80  /// @param Mass The mass of the debris object.
81  /// @param DebMesh A pointer to the Graphics mesh that will be applied to the new RigidDebris.
82  /// @param DebShape A pointer to the Collision shape that will be applied to the new RigidDebris.
83  virtual void CreateRigidDebris(const Real Mass, Graphics::Mesh* DebMesh, Physics::CollisionShape* DebShape);
84  /// @internal
85  /// @brief Destruction method for RigidDebris.
86  virtual void DestroyRigidDebris();
87  public:
88  /// @brief Blank constructor.
89  /// @param TheWorld A pointer to the world this object belongs to.
90  RigidDebris(World* TheWorld);
91  /// @brief Class constructor.
92  /// @param Name The name to be given to this object.
93  /// @param Mass The mass of the debris object.
94  /// @param TheWorld A pointer to the world this object belongs to.
95  RigidDebris(const String& Name, const Real Mass, World* TheWorld);
96  /// @brief Class constructor.
97  /// @param Name The name to be given to this object.
98  /// @param Mass The mass of the debris object.
99  /// @param DebMesh A pointer to the Graphics mesh that will be applied to the new RigidDebris.
100  /// @param DebShape A pointer to the Collision shape that will be applied to the new RigidDebris.
101  /// @param TheWorld A pointer to the world this object belongs to.
102  RigidDebris(const String& Name, const Real Mass, Graphics::Mesh* DebMesh, Physics::CollisionShape* DebShape, World* TheWorld);
103  /// @brief XML constructor.
104  /// @param SelfRoot An XML::Node containing the data to populate this class with.
105  /// @param TheWorld A pointer to the world this object belongs to.
106  RigidDebris(const XML::Node& SelfRoot, World* TheWorld);
107  /// @brief Class destructor.
108  virtual ~RigidDebris();
109 
110  ///////////////////////////////////////////////////////////////////////////////
111  // Utility and Configuration
112 
113  /// @copydoc Mezzanine::WorldObject::GetType() const
114  virtual WorldObjectType GetType() const;
115 
116  /// @brief Gets a pointer to the graphics portion of this debris.
117  /// @return Returns a pointer to the Entity proxy representing the graphics portion of this debris.
118  virtual Graphics::EntityProxy* GetEntityProxy() const;
119  /// @brief Gets a pointer to the physics portion of this debris.
120  /// @return Returns a pointer to the Rigid proxy representing the physics portion of this debris.
121  virtual Physics::RigidProxy* GetRigidProxy() const;
122 
123  /// @copydoc Mezzanine::WorldObject::IsInWorld() const
124  virtual Boole IsInWorld() const;
125 
126  /// @copydoc Mezzanine::WorldObject::IsStatic() const
127  virtual Boole IsStatic() const;
128  /// @copydoc Mezzanine::WorldObject::IsKinematic() const
129  virtual Boole IsKinematic() const;
130 
131  /// @copydoc Mezzanine::WorldObject::GetProxies(ProxyContainer&)
132  virtual void GetProxies(ProxyContainer& Proxies);
133  /// @copydoc Mezzanine::WorldObject::GetProxies(const UInt32, ProxyContainer&)
134  virtual void GetProxies(const UInt32 Types, ProxyContainer& Proxies);
135 
136  ///////////////////////////////////////////////////////////////////////////////
137  // Working with the World
138 
139  /// @copydoc Mezzanine::WorldObject::AddToWorld()
140  virtual void AddToWorld();
141  /// @copydoc Mezzanine::WorldObject::RemoveFromWorld()
142  virtual void RemoveFromWorld();
143 
144  ///////////////////////////////////////////////////////////////////////////////
145  // Transform Methods
146 
147  /// @copydoc TransformableObject::SetLocation(const Vector3&)
148  virtual void SetLocation(const Vector3& Loc);
149  /// @copydoc TransformableObject::SetLocation(const Real, const Real, const Real)
150  virtual void SetLocation(const Real X, const Real Y, const Real Z);
151  /// @copydoc TransformableObject::GetLocation() const
152  virtual Vector3 GetLocation() const;
153  /// @copydoc TransformableObject::SetOrientation(const Quaternion&)
154  virtual void SetOrientation(const Quaternion& Ori);
155  /// @copydoc TransformableObject::SetOrientation(const Real, const Real, const Real, const Real)
156  virtual void SetOrientation(const Real X, const Real Y, const Real Z, const Real W);
157  /// @copydoc TransformableObject::GetOrientation() const
158  virtual Quaternion GetOrientation() const;
159  /// @copydoc TransformableObject::SetScale(const Vector3&)
160  virtual void SetScale(const Vector3& Sc);
161  /// @copydoc TransformableObject::SetScale(const Real, const Real, const Real)
162  virtual void SetScale(const Real X, const Real Y, const Real Z);
163  /// @copydoc TransformableObject::GetScale() const
164  virtual Vector3 GetScale() const;
165 
166  /// @copydoc TransformableObject::Translate(const Vector3&)
167  virtual void Translate(const Vector3& Trans);
168  /// @copydoc TransformableObject::Translate(const Real, const Real, const Real)
169  virtual void Translate(const Real X, const Real Y, const Real Z);
170  /// @copydoc TransformableObject::Yaw(const Real)
171  virtual void Yaw(const Real Angle);
172  /// @copydoc TransformableObject::Pitch(const Real)
173  virtual void Pitch(const Real Angle);
174  /// @copydoc TransformableObject::Roll(const Real)
175  virtual void Roll(const Real Angle);
176  /// @copydoc TransformableObject::Rotate(const Vector3&, const Real)
177  virtual void Rotate(const Vector3& Axis, const Real Angle);
178  /// @copydoc TransformableObject::Rotate(const Quaternion&)
179  virtual void Rotate(const Quaternion& Rotation);
180  /// @copydoc TransformableObject::Scale(const Vector3&)
181  virtual void Scale(const Vector3& Scale);
182  /// @copydoc TransformableObject::Scale(const Real, const Real, const Real)
183  virtual void Scale(const Real X, const Real Y, const Real Z);
184 
185  ///////////////////////////////////////////////////////////////////////////////
186  // Serialization
187 
188  /// @copydoc Mezzanine::WorldObject::ProtoSerializeProperties(XML::Node&) const
189  virtual void ProtoSerializeProperties(XML::Node& SelfRoot) const;
190  /// @copydoc Mezzanine::WorldObject::ProtoSerializeProxies(XML::Node&) const
191  virtual void ProtoSerializeProxies(XML::Node& SelfRoot) const;
192 
193  /// @copydoc Mezzanine::WorldObject::ProtoDeSerializeProperties(const XML::Node&)
194  virtual void ProtoDeSerializeProperties(const XML::Node& SelfRoot);
195  /// @copydoc Mezzanine::WorldObject::ProtoDeSerializeProxies(const XML::Node&)
196  virtual void ProtoDeSerializeProxies(const XML::Node& SelfRoot);
197 
198  /// @copydoc Mezzanine::WorldObject::GetDerivedSerializableName() const
199  virtual String GetDerivedSerializableName() const;
200  /// @copydoc Mezzanine::WorldObject::GetSerializableName()
201  static String GetSerializableName();
202 
203  ///////////////////////////////////////////////////////////////////////////////
204  // Internal Methods
205 
206  /// @copydoc Mezzanine::WorldObject::_Update()
207  virtual void _Update();
208  /// @copydoc Mezzanine::WorldObject::_NotifyProxyDestroyed(WorldProxy*)
209  virtual void _NotifyProxyDestroyed(WorldProxy* ToBeDestroyed);
210  };//RigidDebris
211 
212  ///////////////////////////////////////////////////////////////////////////////
213  /// @brief A base factory type for the creation of non-deformable Debris objects.
214  /// @details
215  ///////////////////////////////////////
217  {
218  public:
219  /// @brief Class constructor.
221  /// @brief Class destructor.
222  virtual ~RigidDebrisFactory();
223 
224  /// @copydoc DebrisFactory::GetTypeName() const
225  virtual String GetTypeName() const;
226 
227  /// @brief Creates a RigidDebris object.
228  /// @param Name The name to be given to this object.
229  /// @param Mass The mass of the debris object.
230  /// @param TheWorld A pointer to the world this object belongs to.
231  virtual RigidDebris* CreateRigidDebris(const String& Name, const Real Mass, World* TheWorld);
232  /// @brief Creates a RigidDebris object.
233  /// @param Name The name to be given to this object.
234  /// @param Mass The mass of the debris object.
235  /// @param DebMesh A pointer to the Graphics mesh that will be applied to the debris object.
236  /// @param DebShape A pointer to the Collision shape that will be applied to the debris object.
237  /// @param TheWorld A pointer to the world this object belongs to.
238  virtual RigidDebris* CreateRigidDebris(const String& Name, const Real Mass, Graphics::Mesh* DebMesh, Physics::CollisionShape* DebShape, World* TheWorld);
239  /// @brief Creates a RigidDebris object.
240  /// @param XMLNode The node of the xml document to construct from.
241  /// @param TheWorld A pointer to the world this object belongs to.
242  virtual RigidDebris* CreateRigidDebris(const XML::Node& XMLNode, World* TheWorld);
243 
244  /// @copydoc DebrisFactory::CreateDebris(const String&, World*, const NameValuePairMap&)
245  virtual Debris* CreateDebris(const String& Name, World* TheWorld, const NameValuePairMap& Params);
246  /// @copydoc DebrisFactory::CreateDebris(const XML::Node&, World*)
247  virtual Debris* CreateDebris(const XML::Node& XMLNode, World* TheWorld);
248  /// @copydoc DebrisFactory::DestroyDebris(Debris* ToBeDestroyed)
249  virtual void DestroyDebris(Debris* ToBeDestroyed);
250  };//RigidDebrisFactory
251 }//Mezzanine
252 
253 #endif
This is the base class for all collision shapes.
bool Boole
Generally acts a single bit, true or false.
Definition: datatypes.h:173
This class is used to check and modify the properties of a graphics mesh.
Definition: mesh.h:63
A base factory type for the creation of Debris objects.
Definition: debris.h:95
This is the proxy class for placing and manipulating a mesh in the scene.
Definition: entityproxy.h:62
A non-deformable debris.
Definition: rigiddebris.h:64
A base factory type for the creation of non-deformable Debris objects.
Definition: rigiddebris.h:216
float Real
A Datatype used to represent a real floating point number.
Definition: datatypes.h:141
std::vector< WorldProxy * > ProxyContainer
Basic container type for WorldProxy storage by this class.
Definition: worldobject.h:64
A light-weight handle for manipulating nodes in DOM tree.
Definition: node.h:89
A simple world object without a large structure ideal for representing loose small objects...
Definition: debris.h:54
This is the base class for proxy objects belonging to the various 3D subsystems.
Definition: worldproxy.h:53
uint32_t UInt32
An 32-bit unsigned integer.
Definition: datatypes.h:126
This file contains the declaration for the debris class used to represent a small loose object in the...
This is a proxy from which rigid body proxys are handled.
Definition: rigidproxy.h:102
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...
WorldObjectType
Used by various classes to help identify what class an object is.
Definition: enumerations.h:147
The bulk of the engine components go in this namspace.
Definition: actor.cpp:56
This class represents a world for objects to interact within.
Definition: world.h:74
Graphics::EntityProxy * EntProx
A pointer to the graphics representation of this debris.
Definition: rigiddebris.h:69
This is used to store information about rotation in 3d space.
Definition: quaternion.h:68
std::map< String, String > NameValuePairMap
This is a datatype mostly used for describing settings or parameters that can't be declared in advanc...
Definition: datatypes.h:209
std::string String
A datatype used to a series of characters.
Definition: datatypes.h:159
Physics::RigidProxy * RigProx
A pointer to the physics representation of this debris.
Definition: rigiddebris.h:72